Faster-rcnn.pytorch: ImportError... undefined symbol: _ZN3c1019UndefinedTensorImpl10_singletonE

Created on 18 Jul 2019  ยท  4Comments  ยท  Source: jwyang/faster-rcnn.pytorch

An error occurred while trying to run the โ€test_net.pyโ€.

ImportError: /.../python3.6/site-packages/torchvision/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c1019UndefinedTensorImpl10_singletonE

Please help me.

Most helpful comment

Actually, this problem is solved by importing torch before importing _C in my case. No packages or drivers need to be reinstalled.

All 4 comments

Wrong version of torchvision, you should reinstall torchvision and reinstall the framework, specifically, you can try to uninstall the torchvision and reinstall a new one, then try to run the script again: python setup.py build develop(before this, you should delete build file), hope it may help you.

Just adding on to what @LYH-YNU mentioned. These types of errors can occur due to incompatibility of packages with each other. You might want to check what your nvcc version is. Then check if your nvidia-drivers correspond to your cuda toolkit version. Once these two are in check make sure that your pytroch and torchvision are compatible with the cuda version.
Here is a list of step you could go through:

  1. Check nvcc --version (My cuda toolkit version is 10.1)
  2. Check your driver using nvidia-smi. On the top right corner of the table produced you can see CUDA Version . Make sure that this is the same as the version of your CUDA toolkit. If not you might want to reinstall your driver.
  3. Chech the torch cuda version. For this import troch in python and type torch.version.cuda. If they don't match with the cuda toolkit version, uninstall and install both pytorch and torchvision.
    Hope this helps

It works fine.
thank you!

Actually, this problem is solved by importing torch before importing _C in my case. No packages or drivers need to be reinstalled.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gayathrimahalingam picture gayathrimahalingam  ยท  3Comments

twangnh picture twangnh  ยท  5Comments

Feiyu-Zhang picture Feiyu-Zhang  ยท  5Comments

HaiminZhang picture HaiminZhang  ยท  3Comments

ZhangJiajun1995 picture ZhangJiajun1995  ยท  5Comments