I get an error in the importation of pytorch inside dgl (Deep Graph Library by DeepMind), concretely:
ImportError: /home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/lib/libtorch.so.1: undefined symbol: nvrtcGetProgramLogSize
I tried to reinstall pytorch (uninstall reinstall with conda un/install
). I also search in google and I found this https://github.com/pytorch/pytorch/issues/14973. There, they solve it linking in libnvrtc.so
and libcuda.so
, but I have no idea what that means. Does anyone know it?
This is the basic code:
import dgl
from parseador import train_df
g = dgl.DGLGraph()
g.add_nodes(5)
g.add_edges([0, 0, 0, 0], [1, 2, 3, 4])
g.ndata['h'] = th.randn(5, 3)
g.edata['h'] = th.randn(4, 4)
And this is the error:
Traceback (most recent call last):
File "/home/user/Documentos/Repo/grafos.py", line 1, in <module>
import dgl
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/__init__.py", line 2, in <module>
from . import function
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/function/__init__.py", line 5, in <module>
from .message import *
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/function/message.py", line 7, in <module>
from .. import backend as F
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/backend/__init__.py", line 46, in <module>
load_backend(os.environ.get('DGLBACKEND', 'pytorch').lower())
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/backend/__init__.py", line 18, in load_backend
mod = importlib.import_module('.%s' % mod_name, __name__)
File "/home/user/anaconda3/envs/my_env/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/backend/pytorch/__init__.py", line 1, in <module>
from .tensor import *
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/backend/pytorch/tensor.py", line 5, in <module>
import torch as th
File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/__init__.py", line 102, in <module>
from torch._C import *
ImportError: /home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/lib/libtorch.so.1: undefined symbol: nvrtcGetProgramLogSize
How can I fix this error? some time ago I run correctly this code in Windows 10, now I'm running Ubuntu 18.04.
I also ran into this, but I actually wanted to use GPU, so installing pytorch-cpu
was not an option for me.
Instead, installing pytorch
package from pytorch
channel (instead of defaults
) solved the issue for me: conda install pytorch --channel pytorch
I just fixed this same exception with conda install pytorch-cpu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With