Reputation: 41
After installing cupy via "pip install cupy-cuda110", I tried this in python3:
import cupy as cp
However, it failed:
" $ python3 Python 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import cupy as cp Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/cupy/init.py", line 18, in from cupy import _core # NOQA File "/usr/local/lib/python3.8/dist-packages/cupy/_core/init.py", line 1, in from cupy._core import core # NOQA ImportError: libnvrtc.so.11.0: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Failed to import CuPy.
If you installed CuPy via wheels (cupy-cudaXXX or cupy-rocm-X-X), make sure that the package matches with the version of CUDA or ROCm installed.
On Linux, you may need to set LD_LIBRARY_PATH environment variable depending on how you installed CUDA/ROCm. On Windows, try setting CUDA_PATH environment variable.
Check the Installation Guide for details: https://docs.cupy.dev/en/latest/install.html
"
May you know how to resolve this problem? Many thanks!
Upvotes: 3
Views: 14493
Reputation: 1
When installing these packages with CUDA 11.2, 11.3, or 11.4, you may experience a “Failed to import CuPy” error. To resolve this error, please uninstall cupy-cuda115 and install cupy-cuda11x:
pip uninstall cupy-cuda115
pip install cupy-cuda11x
Upvotes: 0
Reputation: 505
Before installing cupy, you should check the version of Cuda that is installed on your device :
!nvcc --version
For me, the Cuda version installed on my device is 11.0 (See the picture below) :
After that go to the official Cupy website https://docs.cupy.dev/en/stable/install.html
The following image is from the page I referred to above:
Then type the install command that matches your Cuda version, for me, the install command will be :
pip install cupy-cuda110
Upvotes: 5