Reputation: 547
The following code give error:
import spacy
spacy.require_gpu()
Traceback (most recent call last):
File "/home/user/PycharmProjects/new_tsg/training/spacy_train_data/spacy_pipeline.py", line 39, in <module>
spacy.require_gpu()
File "/home/user/PycharmProjects/new_tsg/venv/lib/python3.6/site-packages/thinc/neural/util.py", line 87, in require_gpu
raise ValueError("GPU is not accessible. Was the library installed correctly?")
ValueError: GPU is not accessible. Was the library installed correctly?
My configuration is:
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105
GeForce RTX 2080 Driver Version: 418.39
Spacy v 2.3.5 was installed with cuda 10.1 support by:
pip install --no-cache-dir spacy[cuda101]
What can I try to fix that?
Upvotes: 4
Views: 6690
Reputation: 5572
My mistake in this case was in using the CUDA version specified in by nvidia-smi
instead of nvcc --version
.
You should use the version specified in nvcc --version
. I think nvidia-smi
indicates the maximum possible cuda version supported by your GPU, rather than the actual version that you have installed.
So if nvcc says you have version 11.1, then you should install spacy with:
pip install -U spacy[cuda111]
Upvotes: 2
Reputation: 547
I managed to fix this by updating cuda 10.1 to latest release:
CUDA Toolkit 10.1 update2 (Aug 2019)
... from
https://developer.nvidia.com/cuda-toolkit-archive
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
I used the following commands:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda-10-1
... the in last one I used not just cuda
(like on nvidia-site) but cuda-10-1
After that video driver was updated to 455.45.01
$ nvidia-smi
Mon Dec 14 22:14:53 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.45.01 Driver Version: 455.45.01 CUDA Version: 11.1 |
...
Update:
On other PC I had similar issue and previous answer didn't help.
After investigation I find out that cupy
library call cuda
.
So I installed cupy-cuda[101]
and executed the following code:
import cupy
a = cupy.zeros((5, 5))
... and got the No such file error with libcublas.so.10
This file was in
/usr/local/cuda-10.2/targets/x86_64-linux/lib
... and not in:
/usr/local/cuda-10.1/targets/x86_64-linux/lib
So I added /usr/local/cuda-10.2/targets/x86_64-linux/lib
path to /etc/ld.so.conf.d/cuda-10-1.conf
and execute ldconfig
- see answer answer
Upvotes: 1