之前一直以为是这个问题:https://blog.youkuaiyun.com/qq_35294564/article/details/115461626
直到这一次cuda cudatoolkit pytorch NVIDIA驱动版本完全支持还出现这个错误:OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory
但是其他的代码可以跑,这个不行,那肯定是代码问题了(引用包的版本与pytorch不一致,环境真是矫情。。。)
然后直接在命令行下:python 回车
然后 from torch_sparse import coalesce 回车
报错:OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory
from torch_scatter import scatter_add 回车
报错:OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory
from torch_sparse import coalesce 回车
报错:OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory
说明以上三个包均与pytorch不相容
解决方案:重新安装相容版本的包
比如pytorch如下:
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=10.2 -c pytorch
打开连接:https://pytorch-geometric.com/whl/torch-1.7.0+cu102.html
下载对应版本(ubuntu环境下):
torch_scatter-2.0.5-cp36-cp36m-linux_x86_64.whl
torch_sparse-0.6.8-cp36-cp36m-linux_x86_64.whl
然后pip install 包名 安装完成!!
再跑程序,完美解决!!!