ValueError: GPU is not accessible. Was the library installed correctly?

I installed spacy 3 in a venv and tried to execute:

spacy.require_gpu()

Then I got this as output:

 spacy.require_gpu()
Traceback (most recent call last):
File stdin, line 1, in module
File /home/user/.virtualenvs/spacy3/lib/python3.8/site-packages/thinc/util.py, line 187, in require_gpu
raise ValueError(GPU is not accessible. Was the library installed correctly?)
ValueError: GPU is not accessible. Was the library installed correctly?

How can I get rid of this?

Im using:

nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.119.04   Driver Version: 450.119.04   CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 166...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P8     1W /  N/A |     11MiB /  5944MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1493      G   /usr/lib/xorg/Xorg                  4MiB |
|    0   N/A  N/A      1919      G   /usr/lib/xorg/Xorg                  4MiB |
+-----------------------------------------------------------------------------+

nvcc -version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

spacy version

'3.1.0'

Python version

3.8

Installed spacy using :

pip install -U spacy[cuda110]

Selected driver details

When trying to import cupy, it shows this error:

 import cuda
Traceback (most recent call last):
  File stdin, line 1, in module
ModuleNotFoundError: No module named 'cuda'
 import cupy
Traceback (most recent call last):
  File /home/user/.virtualenvs/spacy3/lib/python3.8/site-packages/cupy/__init__.py, line 15, in module
    from cupy import core  # NOQA
  File /home/user/.virtualenvs/spacy3/lib/python3.8/site-packages/cupy/core/__init__.py, line 1, in module
    from cupy.core import core  # NOQA
ImportError: libcublas.so.11: cannot open shared object file: No such file or directory

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/user/.virtualenvs/spacy3/lib/python3.8/site-packages/cupy/__init__.py, line 36, in module
    raise ImportError(_msg) from e
ImportError: CuPy is not correctly installed.

If you are using wheel distribution (cupy-cudaXX), make sure that the version of CuPy you installed matches with the version of CUDA on your host.
Also, confirm that only one CuPy package is installed:
  $ pip freeze

If you are building CuPy from source, please check your environment, uninstall CuPy and reinstall it with:
  $ pip install cupy --no-cache-dir -vvvv

Check the Installation Guide for details:
  https://docs.cupy.dev/en/latest/install.html

original error: libcublas.so.11: cannot open shared object file: No such file or directory

But while installing spacy it showed cupy like this:

Successfully installed MarkupSafe-2.0.1 blis-0.7.4 catalogue-2.0.4 certifi-2021.5.30 chardet-4.0.0 click-7.1.2 cupy-cuda110-9.0.0b3 cymem-2.0.5 fastrlock-0.6 idna-2.10 jinja2-3.0.1 murmurhash-1.0.5 numpy-1.21.0 packaging-21.0 pathy-0.6.0 preshed-3.0.5 pydantic-1.8.2 pyparsing-2.4.7 requests-2.25.1 smart-open-5.1.0 spacy-3.1.0 spacy-legacy-3.0.8 srsly-2.4.1 thinc-8.0.7 tqdm-4.61.2 typer-0.3.2 typing-extensions-3.10.0.0 urllib3-1.26.6 wasabi-0.8.2

Thinc version

'8.0.7'

Any help will be greatly appreciated.

Topic cuda spacy nvidia gpu

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.