Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.
This repository was archived by the owner on Nov 20, 2023. It is now read-only.

something wrong about train.py #8

Description

@YukioSama
  from _ext import slice_pool_layer

ImportError: No module named _ext

Activity

  1. YukioSama commented on Oct 16, 2018

    @YukioSama
    Author

    soory,I did know

  2. YukioSama commented on Oct 16, 2018

    @YukioSama
    Author

    help!too much problems like this:
    from _ext import slice_unpool_layer
    ImportError: cannot import name 'slice_unpool_layer'
    please ?

  3. Timaces commented on Jun 19, 2019

    @Timaces

    I meet the same question:ImportError: No module named _ext?can you help me ? thank you

  4. longmalongma commented on Oct 8, 2019

    @longmalongma

    I meet the same question:ImportError: No module named _ext?can you help me ? thank you

    Hi,when I try to run your code,I find I can not compile your slice_pool_layer and slice_unpool_layer,can you send me your files have compiled files?my email is that:1442342449@qq.com.looking forward your reply

  5. zkm98 commented on May 25, 2020

    @zkm98

    this means we should learn how to compile the .c file, hope u could see the compile method in pointnet++ which also uses .c and .cuda files.

  6. DChoLee commented on Sep 22, 2020

    @DChoLee

    I think this importerror is from circular dependency problem. In this repository, so many modules have same name such as slice_pool_layer. To avoid this issue, I copied slice_pool_layer 'in _ext folder' outside, and changed the slice_pool_layer.py which contains SP class to slice_pool_layer2.py and in net.py, I directly imported layers.slice_unpool_layer2 as import slice_unpool_layer2. Then you can call SP layer as slice_unpool_layer2.SP().

  7. MCemGunes commented on Jan 31, 2022

    @MCemGunes

    Hi there, Is there anyone who could solve the problem? I followed the instructions in the layers folder. However, I still get the error. :
    root@6e57005559fd:/app/RSNet# whereis cuda cuda: /usr/local/cuda

    root@6e57005559fd:/app/RSNet# python train.py Traceback (most recent call last): File "train.py", line 76, in <module> from net import RSNet File "/app/RSNet/net.py", line 7, in <module> from layers.slice_pool_layer.slice_pool_layer import * File "/app/RSNet/layers/slice_pool_layer/slice_pool_layer.py", line 3, in <module> from _ext import slice_pool_layer ModuleNotFoundError: No module named '_ext'

    root@6e57005559fd:/usr/local# ls bin cuda cuda-10.0 etc games include lib man sbin share src root@6e57005559fd:/usr/local# cd cuda-10.0/ root@6e57005559fd:/usr/local/cuda-10.0# ls LICENSE README bin compat doc extras include lib64 nvml nvvm share src targets version.txt root@6e57005559fd:/usr/local/cuda-10.0# cd targets/ root@6e57005559fd:/usr/local/cuda-10.0/targets# ls x86_64-linux root@6e57005559fd:/usr/local/cuda-10.0/targets# cd x86_64-linux/ root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux# ls include lib root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux# cd include/ root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux/include# $CPATH=/usr/local/cuda-10.0/targets/x86_64-linux/include bash: /usr/usc/cuda/10.0/include/=/usr/local/cuda-10.0/targets/x86_64-linux/include: No such file or directory root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux/include# CPATH=/usr/local/cuda-10.0/targets/x86_64-linux/include root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux/include# cd /app/RSNet/ root@6e57005559fd:/app/RSNet# cdc layers/slice_pool_layer/src/cuda/ bash: cdc: command not found root@6e57005559fd:/app/RSNet# cd layers/slice_pool_layer/src/cuda/ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer/src/cuda# nvcc -c -o slice_pool_layer_cuda_kernel.cu.o slice_pool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_61 root@6e57005559fd:/app/RSNet/layers/slice_pool_layer/src/cuda# cd ../../ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# python build.py build /app/RSNet/layers/slice_pool_layer Build with GPU mode. running build running build_ext root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# cd ../slice_unpool_layer/s slice_unpool_layer.py src/ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# cd ../slice_unpool_layer/s slice_unpool_layer.py src/ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# cd ../slice_unpool_layer/src/cuda/ root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer/src/cuda# nvcc -c -o slice_unpool_layer_cuda_kernel.cu.o slice_unpool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_61 root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer/src/cuda# cd ../../ root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer# py pyclean pydoc pydoc3 pygettext pygmentize python2 python3 python3.6 python3.6m pyvenv pyversions pycompile pydoc2.7 pydoc3.6 pygettext2.7 python python2.7 python3-config python3.6-config python3.6m-config pyvenv-3.6 root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer# python build.py build /app/RSNet/layers/slice_unpool_layer Build with GPU mode. running build running build_ext root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer# ls

  8. YukioSama commented on Jan 31, 2022

    @YukioSama
    Author
  9. MCemGunes commented on Feb 1, 2022

    @MCemGunes

    I'm not sure if it is the best way to go but I think I've solved the problem.

    First of all, you need to define the CPATH properly. In my case it is CPATH=/usr/local/cuda/include
    You can check it by the whereis cuda command.

    Secondly, You need to be careful about the computing capabilities of your graphic card. Otherwise, you will see Cuda-related errors when you run the train.py file. Such as this one ==> cudaCheckError() failed : no kernel image is available for execution on the device . I attach a website that includes the numbers for the Nvidia GPUs. In my case, it was 52, because I was using GTX 970m mobile GPU.

    RSNet/layers/slice_pool_layer/src/cuda
    nvcc -c -o slice_pool_layer_cuda_kernel.cu.o slice_pool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52 RSNet/layers/slice_unpool_layer/src/cuda
    nvcc -c -o slice_unpool_layer_cuda_kernel.cu.o slice_unpool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52
    Then, we need to run the build.py file in both RSNet/layers/slice_pool_layer/ and RSNet/layers/slice_unpool_layer/ directories by running python build.py build command. It will create a build folder including lib.linux-x86_64-3.6 that involves _ext folder.

    I copied the _ext folders to directly RSNet/layers/slice_pool_layer/ RSNet/layers/slice_unpool_layer/ directories. So whenever slice_unpool_layer.py or slice_pool_layer.py looks for its _ext file we can import the _ext with a small update in both codes.

    So I updated from _ext import slice_pool_layer line as from ._ext import slice_pool_layer (I did the same for the unpool one too.). I added . to represent the directory that we run the code (RSNet/layers/slice_pool_layer/ or RSNet/layers/slice_unpool_layer/)

    And, voila! now you can get yourno module named CV2 error in peace 🦖

    I hope it helps someone.

  10. YukioSama commented on Mar 31, 2022

    @YukioSama
    Author
  11. Niko85858 commented on Apr 29, 2022

    @Niko85858

    您好,我编译文件失败了,出现很多无法解析的符号,能否发一份您已经编译好的文件?我的邮箱:nikohua@163.com,万分感谢!

  12. YukioSama commented on Apr 29, 2022

    @YukioSama
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions