Pytorch_geometric: Undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

Created on 2 Mar 2020  Â·  13Comments  Â·  Source: rusty1s/pytorch_geometric

📚 Installation

Environment

  • OS: Ubuntu 18.04
  • Python version: 3.6.9
  • PyTorch version: 1.4.0
  • CUDA/cuDNN version: 10.0
  • GCC version: 7.4
  • How did you try to install PyTorch Geometric and its extensions (pip, source): pip
  • Any other relevant information: I have been using this library for a long time. I am quite surprised by this sudden error, even after couple of reinstalls.

Checklist

  • [x] I followed the installation guide.
  • [x] I cannot find my error message in the FAQ.
  • [x] I set up CUDA correctly and can compile CUDA code via nvcc.
  • [ ] I have cloned the repository and tried a manual installation from source.
  • [ ] I do have multiple CUDA versions on my machine.
  • [ ] I checked if the official extension example runs on my machine.
  • [ ] The offical extension example runs on my machine.

Additional context

Error log while importing:

>>> import torch
>>> import torch_scatter
Traceback (most recent call last):
  File "/home/pranav/.local/lib/python3.6/site-packages/torch_scatter/__init__.py", line 13, in <module>
    library, [osp.dirname(__file__)]).origin)
  File "/usr/lib/python3/dist-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/pranav/.local/lib/python3.6/site-packages/torch_scatter/_version.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pranav/.local/lib/python3.6/site-packages/torch_scatter/__init__.py", line 21, in <module>
    raise OSError(e)
OSError: /home/pranav/.local/lib/python3.6/site-packages/torch_scatter/_version.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs
>>> import torch_sparse
Traceback (most recent call last):
  File "/home/pranav/.local/lib/python3.6/site-packages/torch_sparse/__init__.py", line 14, in <module>
    library, [osp.dirname(__file__)]).origin)
  File "/usr/lib/python3/dist-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/pranav/.local/lib/python3.6/site-packages/torch_sparse/_version.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pranav/.local/lib/python3.6/site-packages/torch_sparse/__init__.py", line 22, in <module>
    raise OSError(e)
OSError: /home/pranav/.local/lib/python3.6/site-packages/torch_sparse/_version.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

Most helpful comment

I have solved this problem. The reason is that: do not install pytorch via anaconda-navigator ! It will install both cpu and gpu versions, even though you only select the pytorch. You can download the specific version of the pytorch from:

https://download.pytorch.org/whl/torch_stable.html,

and this problem will be solved. All dependent packages are listed:
cu101/torch-1.4.0-cp38-cp38-linux_x86_64.whl
cu101/torchvision-0.5.0-cp38-cp38-linux_x86_64.whl
torch_cluster-1.5.3+cu101-cp38-cp38-linux_x86_64.whl
torch_scatter-2.0.4+cu101-cp38-cp38-linux_x86_64.whl
torch_sparse-0.6.1+cu101-cp38-cp38-linux_x86_64.whl
torch_spline_conv-1.2.0+cu101-cp38-cp38-linux_x86_64.whl

The author is right! Multi-versions of pytorch (CPU and GPU) result in this problem!

All 13 comments

This error is usually explained by using multiple PyTorch or multiple CUDA versions, and the extensions get compiled with the one that you are not using within PyTorch. BTW, you can now also try out our Python binaries for a smoother installation.

As far as I can tell, I don't have multiple versions of CUDA and Pytorch. I have tried re-installing Pytorch and all PyG dependencies multiple times using the new binaries, but still, I get the same error.

Are you sure you do not multiple versions of the extension installed and python just refers to the false one?

I am quite sure that I do not have multiple versions of those libraries. Currently, I did a quick fix by installing them in a docker container.

I have solved this problem. The reason is that: do not install pytorch via anaconda-navigator ! It will install both cpu and gpu versions, even though you only select the pytorch. You can download the specific version of the pytorch from:

https://download.pytorch.org/whl/torch_stable.html,

and this problem will be solved. All dependent packages are listed:
cu101/torch-1.4.0-cp38-cp38-linux_x86_64.whl
cu101/torchvision-0.5.0-cp38-cp38-linux_x86_64.whl
torch_cluster-1.5.3+cu101-cp38-cp38-linux_x86_64.whl
torch_scatter-2.0.4+cu101-cp38-cp38-linux_x86_64.whl
torch_sparse-0.6.1+cu101-cp38-cp38-linux_x86_64.whl
torch_spline_conv-1.2.0+cu101-cp38-cp38-linux_x86_64.whl

The author is right! Multi-versions of pytorch (CPU and GPU) result in this problem!

I have solved this problem. The reason is that: do not install pytorch via anaconda-navigator ! It will install both cpu and gpu versions, even though you only select the pytorch. You can download the specific version of the pytorch from:

https://download.pytorch.org/whl/torch_stable.html,

and this problem will be solved. All dependent packages are listed:
cu101/torch-1.4.0-cp38-cp38-linux_x86_64.whl
cu101/torchvision-0.5.0-cp38-cp38-linux_x86_64.whl
torch_cluster-1.5.3+cu101-cp38-cp38-linux_x86_64.whl
torch_scatter-2.0.4+cu101-cp38-cp38-linux_x86_64.whl
torch_sparse-0.6.1+cu101-cp38-cp38-linux_x86_64.whl
torch_spline_conv-1.2.0+cu101-cp38-cp38-linux_x86_64.whl

The author is right! Multi-versions of pytorch (CPU and GPU) result in this problem!

hello...... I find I can not do it ... I have download the wheel. But the error is still exits。。😭

@dongweidongwei Thank you verrrrry much! I solved my error with your method.

How do i solve this in colab?

See here.

I think you may use conda to install torch and pip to install torchtext. Try to use the same package manager

This error is usually explained by using multiple PyTorch or multiple CUDA versions, and the extensions get compiled with the one that you are not using within PyTorch. BTW, you can now also try out our Python binaries for a smoother installation.

multiple Pytorch you mean cpu and gpu versions? does that mean I should uninstall the cpu version? thanks

Yes, this might be a problem.

I had the same problem in NextJournal (https://nextjournal.com) installing pytorch-geometric with conda. It was solved using the recommended pip installation procedure at https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SaschaStenger picture SaschaStenger  Â·  4Comments

JsBlueCat picture JsBlueCat  Â·  3Comments

yanzhangnlp picture yanzhangnlp  Â·  3Comments

a060146251 picture a060146251  Â·  3Comments

zhangfuyang picture zhangfuyang  Â·  4Comments