Deformable-Convolution-V2-PyTorch icon indicating copy to clipboard operation
Deformable-Convolution-V2-PyTorch copied to clipboard

Solution about `ImportError: undefined symbol`

Open cjnjuwhy opened this issue 6 years ago • 5 comments

I download the code and successfully compile it, I can run the test.py file, and pass almost every test but with a small mistake(according to the annotations, it's not a big deal). When I try to import DCN and use the module in my code, the error occurs:

ImportError:~/anaconda3/lib/python3.7/site-packages/DCN-1.0-py3.7-linux-x86_64.egg/DCN.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at19UndefinedTensorImpl10_singletonE

The DCN package was installed in my site-packages, it's really strange that when I import another package before import DCN, this problem solved! 😳 How STRANGE it is!

from torch.autograd.function import once_differentiable
import DCN

cjnjuwhy avatar May 02 '19 12:05 cjnjuwhy

or you should rename DCN-1.0-py3.7-linux-x86_64.egg to DCN or dcn

cjnjuwhy avatar May 02 '19 13:05 cjnjuwhy

To use a custom extension, you may refer to the official tutorial. As stated in the documentation,

Just be sure to import torch first, as this will resolve some symbols that the dynamic linker must see

hellock avatar May 02 '19 23:05 hellock

I rename DCN-1.0-py3.7-linux-x86_64.egg to DCN. running python test.py. error:AttributeError: module 'DCN' has no attribute 'deform_conv_forward'

zhuwanling avatar May 09 '19 15:05 zhuwanling

I ran into this error: undefined symbol: __cudaPopCallConfiguration and waste time to find the solution all the day. Finally, check the environment version follow this link: https://rusty1s.github.io/pytorch_geometric/build/html/notes/installation.html I found the conda virtual env's and system's cuda version do not match. After I create a new env, this issue gone.

Periter avatar Jun 01 '19 11:06 Periter

or you should rename DCN-1.0-py3.7-linux-x86_64.egg to DCN or dcn

I met import error. And rename the directory name import worked.

but I should use DCN.deform_conv_forward it will occur same problem. So what should I do ?

Traceback (most recent call last): File "<stdin>", line 1, in ImportError: libc10.so: cannot open shared object file: No such file or directory

Sorry for careless. Finally I run the code well use the advice from @hellock

igo312 avatar Feb 02 '21 06:02 igo312