解决报错ImportError: unique_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28T
最近在调试有关pytorch-geometric包的代码的时候遇到了这个错误,具体报错如下所示:ImportError: /home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_sparse/unique_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caff
·
最近在调试有关pytorch-geometric包的代码的时候遇到了这个错误,具体报错如下所示:
ImportError: /home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_sparse/unique_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c108BFloat16EEEPKNS_6detail12TypeMetaDataEv
(SGE) amax@admin:~/XJY/Semantic-Graph/Semantic-Graph/SGE-GNN$ python train_cross-modal.py --data_dir /home/amax/XJY/Semantic-Graph/Semantic-Graph/SGE/data_process/pascal/ --model_dir /home/amax/XJY/Semantic-Graph/Semantic-Graph/SGE/data_process/pascal
Traceback (most recent call last):
File "train_cross-modal.py", line 5, in <module>
from GNN.model import *
File "/home/amax/XJY/Semantic-Graph/Semantic-Graph/SGE-GNN/GNN/model.py", line 1, in <module>
from .conv import *
File "/home/amax/XJY/Semantic-Graph/Semantic-Graph/SGE-GNN/GNN/conv.py", line 5, in <module>
from torch_geometric.nn import GCNConv, GATConv
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_geometric/__init__.py", line 2, in <module>
import torch_geometric.nn
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_geometric/nn/__init__.py", line 2, in <module>
from .data_parallel import DataParallel
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_geometric/nn/data_parallel.py", line 5, in <module>
from torch_geometric.data import Batch
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
from .data import Data
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_geometric/data/data.py", line 7, in <module>
from torch_sparse import coalesce
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_sparse/__init__.py", line 2, in <module>
from .coalesce import coalesce
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_sparse/coalesce.py", line 4, in <module>
from .utils.unique import unique
File "/home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_sparse/utils/unique.py", line 5, in <module>
import torch_sparse.unique_cuda
ImportError: /home/amax/.conda/envs/SGE/lib/python3.7/site-packages/torch_sparse/unique_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c108BFloat16EEEPKNS_6detail12TypeMetaDataEv
可以看到这个错误最终是指向了pytorch-sparse这个包,我们知道pytorch-geometric这个包主要有三个依赖包分别是:
torch-cluster
torch-scatter
torch-sparse
解决方案
因为我之前安装这三个包都是直接使用pip命令安装,问题好像出在使用pip安装即是安装成功了也会出现编译错误?于是我跑到了github把三个包重新下载了一遍,再用如下命令进行编译:
python setup.py install
下面给出几个包的下载地址:
torch-cluster | https://github.com/rusty1s/pytorch_cluster/releases |
torch-scatter | https://github.com/rusty1s/pytorch_scatter/releases |
torch-sparse | https://github.com/rusty1s/pytorch_sparse/releases |
更多推荐
已为社区贡献1条内容
所有评论(0)