cuda 9.0 安装torch 0.4_PyTorch geometric 安装中libcusparse.so.10 error的解决策略
生活随笔
收集整理的這篇文章主要介紹了
cuda 9.0 安装torch 0.4_PyTorch geometric 安装中libcusparse.so.10 error的解决策略
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
準備工作(自己的電腦):
- OS: Ubuntu 16.04
- Python version: 3.6
- PyTorch version: 1.6.0
- CUDA version: 10.1
安裝流程(pip):
2. 查詢GPU版PyTorch的CUDA版本
$ python -c "import torch; print(torch.version.cuda)" >>> 10.13. 安裝依賴包
$ pip install torch-scatter==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html $ pip install torch-sparse==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html $ pip install torch-cluster==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html $ pip install torch-spline-conv==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html $ pip install torch-geometric其中“cu101” 和 “torch-1.6.0” 可依據自己的配置來選擇4. 測試是否安裝成功
$ python >>> import torch >>> from torch_geometric.data import DataOSError: libcusparse.so.10: cannot open shared object file: No such file or directory顯然,未能成功安裝。
修復流程
1. 檢查 nvcc
$ nvcc --version-base:/usr/lib/command-not-found:/usr/bin/python3: bad interpreter: No such file or directory又出問題!既然不識別命令,那就安裝唄~
2. 打開terminal
$ nano /home/username/.bashrc# or$ nano /home/$USER/.bashrc3. 添加以下命令行
export PATH="/usr/local/cuda-10.1/bin:$PATH"export LD_LIBRARY_PATH="/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH"4. 保存并關閉terminal
On you keyboard press the following: ctrl + o --> save enter or return key --> accept changesctrl + x --> close editor5. 運行nvcc(一定要確保PyTorch和CUDA的版本一致)
$ nvcc --version >>> 10.1$ python -c "import torch; print(torch.version.cuda)" >>> 10.16. 再次測試是否安裝成功
import torch from torch_geometric.data import Dataedge_index = torch.tensor([[0, 1, 1, 2],[1, 0, 2, 1]], dtype=torch.long) x = torch.tensor([[-1], [0], [1]], dtype=torch.float)data = Data(x=x, edge_index=edge_index)>>> print(data.keys) >>> ['x', 'edge_index']恭喜,安裝成功:)
總結
以上是生活随笔為你收集整理的cuda 9.0 安装torch 0.4_PyTorch geometric 安装中libcusparse.so.10 error的解决策略的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python 读取鼠标选中文本_木辛老师
- 下一篇: python鸢尾花数据集_Python实