shrubb / box-convolutions

PyTorch code for the "Deep Neural Networks with Box Convolutions" paper
Apache License 2.0
511 stars 35 forks source link

Import Error #9

Closed the-butterfly closed 5 years ago

the-butterfly commented 5 years ago

Success build with ubuntu 16.04, cuda 10 and gcc 7.4. But import error encountered:

In [1]: import torch

In [2]: from box_convolution import BoxConv2d

ImportError                               Traceback (most recent call last)
<ipython-input-2-2424917dbf01> in <module>()
----> 1 from box_convolution import BoxConv2d

~/Software/pkgs/box-convolutions/box_convolution/__init__.py in <module>()
----> 1 from .box_convolution_module import BoxConv2d

~/Software/pkgs/box-convolutions/box_convolution/box_convolution_module.py in <module>()
      2 import random
      3 
----> 4 from .box_convolution_function import BoxConvolutionFunction, reparametrize
      5 import box_convolution_cpp_cuda as cpp_cuda
      6 

~/Software/pkgs/box-convolutions/box_convolution/box_convolution_function.py in <module>()
      1 import torch
      2 
----> 3 import box_convolution_cpp_cuda as cpp_cuda
      4 
      5 def reparametrize(

ImportError: /usr/Software/anaconda3/lib/python3.6/site-packages/box_convolution_cpp_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: __cudaPopCallConfiguration

@shrubb

shrubb commented 5 years ago

Oh, Anaconda often doesn't make life easier :(

Most likely, you have two different CUDA toolkits (maybe one in Anaconda and one system-wide) and your PyTorch is using one version while setup.py picks up another.

Check your PyTorch's CUDA version via torch.version.cuda. Then, before build, set CUDA_HOME environment variable to the location of that toolkit. Example:

rm -rf build/
CUDA_HOME=/usr/local/cuda-9.2 python3 -m pip install .

By the way, if you use the CUDA toolkit that is shipped by Anaconda, keep in mind that it is not a real toolkit but some truncated version of it, which is unsuitable for compiling. That might also be the cause.

the-butterfly commented 5 years ago

Thanks for your meticulous reply! I have just re-install pytorch 1.0.1 with cuda 10, and make install again, everything works fine.

Flock1 commented 5 years ago

@the-butterfly, can you tell me if you installed pytorch from source or by using pip? Is your system's CUDA version different from the one installed with torch?

the-butterfly commented 5 years ago

I think system's CUDA version should match with torch. And my pytorch is installed by pip.

Flock1 commented 5 years ago

Okay, thanks