RoIAlign.pytorch icon indicating copy to clipboard operation
RoIAlign.pytorch copied to clipboard

ModuleNotFoundError: No module named 'roi_align.crop_and_resize_cpu'

Open kgavrilyuk opened this issue 4 years ago • 30 comments

I am using anaconda 3. When I run

python setup.py install

it works fine without any errors:

running install
running bdist_egg
running egg_info
creating roi_align.egg-info
writing roi_align.egg-info/PKG-INFO
writing dependency_links to roi_align.egg-info/dependency_links.txt
writing requirements to roi_align.egg-info/requires.txt
writing top-level names to roi_align.egg-info/top_level.txt
writing manifest file 'roi_align.egg-info/SOURCES.txt'
reading manifest file 'roi_align.egg-info/SOURCES.txt'
writing manifest file 'roi_align.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/roi_align
copying roi_align/crop_and_resize.py -> build/lib.linux-x86_64-3.7/roi_align
copying roi_align/__init__.py -> build/lib.linux-x86_64-3.7/roi_align
copying roi_align/roi_align.py -> build/lib.linux-x86_64-3.7/roi_align
running build_ext
building 'roi_align.crop_and_resize_cpu' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/roi_align
creating build/temp.linux-x86_64-3.7/roi_align/src
gcc -pthread -B /home/kirill/workspace/software/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/home/kirill/workspace/software/anaconda3/include/python3.7m -c roi_align/src/crop_and_resize.cpp -o build/temp.linux-x86_64-3.7/roi_align/src/crop_and_resize.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=crop_and_resize_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
roi_align/src/crop_and_resize.cpp:31:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
     #pragma omp parallel for
 
g++ -pthread -shared -B /home/kirill/workspace/software/anaconda3/compiler_compat -L/home/kirill/workspace/software/anaconda3/lib -Wl,-rpath=/home/kirill/workspace/software/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/roi_align/src/crop_and_resize.o -o build/lib.linux-x86_64-3.7/roi_align/crop_and_resize_cpu.cpython-37m-x86_64-linux-gnu.so
building 'roi_align.crop_and_resize_gpu' extension
creating build/temp.linux-x86_64-3.7/roi_align/src/cuda
gcc -pthread -B /home/kirill/workspace/software/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/kirill/workspace/software/anaconda3/include/python3.7m -c roi_align/src/crop_and_resize_gpu.cpp -o build/temp.linux-x86_64-3.7/roi_align/src/crop_and_resize_gpu.o -g -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=crop_and_resize_gpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/kirill/workspace/software/anaconda3/include/python3.7m -c roi_align/src/cuda/crop_and_resize_kernel.cu -o build/temp.linux-x86_64-3.7/roi_align/src/cuda/crop_and_resize_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -O2 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=crop_and_resize_gpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
g++ -pthread -shared -B /home/kirill/workspace/software/anaconda3/compiler_compat -L/home/kirill/workspace/software/anaconda3/lib -Wl,-rpath=/home/kirill/workspace/software/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/roi_align/src/crop_and_resize_gpu.o build/temp.linux-x86_64-3.7/roi_align/src/cuda/crop_and_resize_kernel.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/roi_align/crop_and_resize_gpu.cpython-37m-x86_64-linux-gnu.so
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/roi_align
copying build/lib.linux-x86_64-3.7/roi_align/crop_and_resize.py -> build/bdist.linux-x86_64/egg/roi_align
copying build/lib.linux-x86_64-3.7/roi_align/crop_and_resize_gpu.cpython-37m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/roi_align
copying build/lib.linux-x86_64-3.7/roi_align/__init__.py -> build/bdist.linux-x86_64/egg/roi_align
copying build/lib.linux-x86_64-3.7/roi_align/crop_and_resize_cpu.cpython-37m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/roi_align
copying build/lib.linux-x86_64-3.7/roi_align/roi_align.py -> build/bdist.linux-x86_64/egg/roi_align
byte-compiling build/bdist.linux-x86_64/egg/roi_align/crop_and_resize.py to crop_and_resize.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/roi_align/__init__.py to __init__.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/roi_align/roi_align.py to roi_align.cpython-37.pyc
creating stub loader for roi_align/crop_and_resize_cpu.cpython-37m-x86_64-linux-gnu.so
creating stub loader for roi_align/crop_and_resize_gpu.cpython-37m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/roi_align/crop_and_resize_cpu.py to crop_and_resize_cpu.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/roi_align/crop_and_resize_gpu.py to crop_and_resize_gpu.cpython-37.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying roi_align.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying roi_align.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying roi_align.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying roi_align.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying roi_align.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
roi_align.__pycache__.crop_and_resize_cpu.cpython-37: module references __file__
roi_align.__pycache__.crop_and_resize_gpu.cpython-37: module references __file__
creating dist
creating 'dist/roi_align-0.0.1-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing roi_align-0.0.1-py3.7-linux-x86_64.egg
removing '/home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/roi_align-0.0.1-py3.7-linux-x86_64.egg' (and everything under it)
creating /home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/roi_align-0.0.1-py3.7-linux-x86_64.egg
Extracting roi_align-0.0.1-py3.7-linux-x86_64.egg to /home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages
roi-align 0.0.1 is already the active version in easy-install.pth

Installed /home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages/roi_align-0.0.1-py3.7-linux-x86_64.egg
Processing dependencies for roi-align==0.0.1
Searching for torch==1.1.0
Best match: torch 1.1.0
Adding torch 1.1.0 to easy-install.pth file
Installing convert-caffe2-to-onnx script to /home/kirill/workspace/software/anaconda3/bin
Installing convert-onnx-to-caffe2 script to /home/kirill/workspace/software/anaconda3/bin

Using /home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages
Searching for numpy==1.16.2
Best match: numpy 1.16.2
Adding numpy 1.16.2 to easy-install.pth file
Installing f2py script to /home/kirill/workspace/software/anaconda3/bin
Installing f2py3 script to /home/kirill/workspace/software/anaconda3/bin
Installing f2py3.7 script to /home/kirill/workspace/software/anaconda3/bin

Using /home/kirill/workspace/software/anaconda3/lib/python3.7/site-packages
Finished processing dependencies for roi-align==0.0.1

However, when I run

./test.sh

it outputs the following:

Unexpected error: <class 'ModuleNotFoundError'>
Traceback (most recent call last):
  File "tests/test.py", line 13, in <module>
    from roi_align.crop_and_resize import CropAndResizeFunction
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/__init__.py", line 1, in <module>
    from .roi_align import RoIAlign, CropAndResizeFunction
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/roi_align.py", line 4, in <module>
    from .crop_and_resize import CropAndResizeFunction, CropAndResize
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/crop_and_resize.py", line 7, in <module>
    import roi_align.crop_and_resize_cpu as crop_and_resize_cpu
ModuleNotFoundError: No module named 'roi_align.crop_and_resize_cpu'
Traceback (most recent call last):
  File "tests/test2.py", line 5, in <module>
    from roi_align.roi_align import RoIAlign
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/__init__.py", line 1, in <module>
    from .roi_align import RoIAlign, CropAndResizeFunction
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/roi_align.py", line 4, in <module>
    from .crop_and_resize import CropAndResizeFunction, CropAndResize
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/crop_and_resize.py", line 7, in <module>
    import roi_align.crop_and_resize_cpu as crop_and_resize_cpu
ModuleNotFoundError: No module named 'roi_align.crop_and_resize_cpu'
Traceback (most recent call last):
  File "tests/crop_and_resize_example.py", line 5, in <module>
    from roi_align.crop_and_resize import CropAndResizeFunction
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/__init__.py", line 1, in <module>
    from .roi_align import RoIAlign, CropAndResizeFunction
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/roi_align.py", line 4, in <module>
    from .crop_and_resize import CropAndResizeFunction, CropAndResize
  File "/data/kirill/volleyball_activity/software/RoIAlign.pytorch/roi_align/crop_and_resize.py", line 7, in <module>
    import roi_align.crop_and_resize_cpu as crop_and_resize_cpu
ModuleNotFoundError: No module named 'roi_align.crop_and_resize_cpu'

What could be the reason of the problem? How to fix it?

kgavrilyuk avatar Jul 09 '19 16:07 kgavrilyuk