当前位置:  开发笔记 > 编程语言 > 正文

如何在DGL中修复“导入错误:/ home / ... ... / lib / libtorch.so.1:未定义的符号:nvrtcGetProgramLogSize”?

如何解决《如何在DGL中修复“导入错误:/home//lib/libtorch.so.1:未定义的符号:nvrtcGetProgramLogSize”?》经验,为你挑选了1个好方法。

我在dgl(DeepMind的Deep Graph Library)中导入pytorch时遇到错误,具体是:

ImportError:/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/lib/libtorch.so.1:未定义的符号:nvrtcGetProgramLogSize

我试图重新安装pytorch(使用卸载重新安装conda un/install)。我也在Google中搜索,发现了这个https://github.com/pytorch/pytorch/issues/14973。在那里,他们解决它在连接libnvrtc.solibcuda.so,但我不知道这意味着什么。有人知道吗?

这是基本代码:

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)

这是错误:

Traceback (most recent call last):
  File "/home/user/Documentos/Repo/grafos.py", line 1, in 
    import dgl
  File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/__init__.py", line 2, in 
    from . import function
  File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/function/__init__.py", line 5, in 
    from .message import *
  File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/function/message.py", line 7, in 
    from .. import backend as F
  File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/backend/__init__.py", line 46, in 
    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 
    from .tensor import *
  File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/dgl/backend/pytorch/tensor.py", line 5, in 
    import torch as th
  File "/home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/__init__.py", line 102, in 
    from torch._C import *
ImportError: /home/user/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/lib/libtorch.so.1: undefined symbol: nvrtcGetProgramLogSize

如何解决此错误?前一段时间,我在Windows 10中正确运行了此代码,而现在我正在运行Ubuntu 18.04。



1> 小智..:

我也遇到了这个问题,但是我实际上想使用GPU,因此安装pytorch-cpu不是我的选择。

相反,pytorchpytorch渠道安装软件包(而不是defaults)为我解决了这个问题:conda install pytorch --channel pytorch

推荐阅读
喜生-Da
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有