[PYTHON] PyTorch module says libcusparse.so.10 is missing

Personal notes

OS : Ubuntu 18.04 LTS PyTorch : 1.5.0, 1.6.0 CUDA : 10.2 NVIDIA-driver : 440

Originally, the error that occurred when importing PyTorch Geometric. I thought it was strange that I installed it as officially ... but in conclusion, NVIDIA-driver was installed properly, but NVCC was not installed.

Case

import torch_geometric.transforms as T

OSError: libcusparse.so.10: cannot open shared object file: No such file or directory

ImportError of libcublas.so.10.0 with tensorflow-gpu https://qiita.com/Uejun/items/fbb579374eafab8633d6

This is a similar case, but it seems that you only have to pass it. However, no matter where I looked, my personal computer did not have a library called libcusparse.so.10. There was something like this in the official issue.

libcusparse.so.10 error when importing https://github.com/rusty1s/pytorch_geometric/issues/1092

The situation of the problem is different, but it seems that libcusparse.so.10 is under / usr / local / cuda / lib64, and $ nvcc -V needs to pass properly. In my case, $ nvcc -V didn't pass in the first place. When you hit this command

$ nvcc -V

Command 'nvcc' not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit

Is displayed, but $ sudo apt install nvidia-cuda-toolkit In , the target library was not included. Before that, it seems that you need to install cuda 10.2.

solution

Reinsert cuda 10.2.

$  sudo apt purge nvidia-cuda-* 

After (just in case you don't have to), based on Official Install cuda 10.2. I will omit this because I think it is different for each device. After this, in .bashrc

export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"

After writing, $ nvcc -V passed and PyTorch Geometric became available. Also, if there is a module such as libucusparse.so.10.0, it seems that it may be possible to deal with $ ln -s libucusparse.so.10.0 libucusparse.so.10, but in my case an error occurred.

Recommended Posts

PyTorch module says libcusparse.so.10 is missing
[PyTorch Tutorial ①] What is PyTorch?
PyTorch DataLoader is slow