conda-forge / cupy-feedstock

A conda-smithy repository for cupy.
BSD 3-Clause "New" or "Revised" License
5 stars 23 forks source link

original error: libcuda.so.1: cannot open shared object file: No such file or directory #137

Closed liyun-lu closed 3 years ago

liyun-lu commented 3 years ago

Issue:my order is: conda install -c conda-forge cupy cudatoolkit=10.1
but when I import cupy ,there are some error.


Environment (conda list):

``` $ conda list # Name Version Build Channel _libgcc_mutex 0.1 main defaults _openmp_mutex 4.5 1_gnu defaults ca-certificates 2021.5.30 ha878542_0 conda-forge certifi 2021.5.30 py37h89c1867_0 conda-forge cudatoolkit 10.1.243 h036e899_8 conda-forge cupy 9.2.0 py37h464e165_0 conda-forge fastrlock 0.6 py37hcd2ae1e_1 conda-forge libblas 3.9.0 9_openblas conda-forge libcblas 3.9.0 9_openblas conda-forge libedit 3.1.20210216 h27cfd23_1 defaults libffi 3.2.1 hf484d3e_1007 defaults libgcc-ng 9.3.0 h5101ec6_17 defaults libgfortran-ng 9.3.0 hff62375_19 conda-forge libgfortran5 9.3.0 hff62375_19 conda-forge libgomp 9.3.0 h5101ec6_17 defaults liblapack 3.9.0 9_openblas conda-forge libopenblas 0.3.15 pthreads_h8fe5266_1 conda-forge libstdcxx-ng 9.3.0 hd4cf53a_17 defaults ncurses 6.2 he6710b0_1 defaults numpy 1.21.0 py37h038b26d_0 conda-forge openssl 1.0.2u h516909a_0 conda-forge pip 21.1.2 py37h06a4308_0 defaults python 3.7.0 h6e4f718_3 defaults python_abi 3.7 2_cp37m conda-forge readline 7.0 h7b6447c_5 defaults setuptools 52.0.0 py37h06a4308_0 defaults sqlite 3.33.0 h62c20be_0 defaults tk 8.6.10 hbc83047_0 defaults wheel 0.36.2 pyhd3eb1b0_0 defaults xz 5.2.5 h7b6447c_0 defaults zlib 1.2.11 h7b6447c_3 defaults ```


Details about conda and system ( conda info ):

``` $ conda info active environment : chainer active env location : /public/home/jd_shb/miniconda3/envs/chainer shell level : 2 user config file : /public/home/jd_shb/.condarc populated config files : /public/home/jd_shb/.condarc conda version : 4.8.5 conda-build version : not installed python version : 3.8.3.final.0 virtual packages : __glibc=2.17 base environment : /public/home/jd_shb/miniconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /public/home/jd_shb/miniconda3/pkgs /public/home/jd_shb/.conda/pkgs envs directories : /public/home/jd_shb/miniconda3/envs /public/home/jd_shb/.conda/envs platform : linux-64 user-agent : conda/4.8.5 requests/2.23.0 CPython/3.8.3 Linux/3.10.0-693 .el7.x86_64 centos/7.4.1708 glibc/2.17 UID:GID : 1239:100 netrc file : None offline mode : False ```


Error (import cupy):

``` >>> import cupy Traceback (most recent call last): File "/public/home/jd_shb/miniconda3/envs/chainer/lib/python3.7/site-packages/cupy/__init__.py", line 16, in from cupy import _core # NOQA File "/public/home/jd_shb/miniconda3/envs/chainer/lib/python3.7/site-packages/cupy/_core/__init__.py", line 1, in from cupy._core import core # NOQA File "cupy/_core/core.pyx", line 1, in init cupy._core.core File "/public/home/jd_shb/miniconda3/envs/chainer/lib/python3.7/site-packages/cupy/cuda/__init__.py", line 8, in from cupy.cuda import compiler # NOQA File "/public/home/jd_shb/miniconda3/envs/chainer/lib/python3.7/site-packages/cupy/cuda/compiler.py", line 12, in from cupy.cuda import function File "cupy/cuda/function.pyx", line 1, in init cupy.cuda.function File "cupy/cuda/texture.pyx", line 1, in init cupy.cuda.texture ImportError: libcuda.so.1: 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 "", line 1, in File "/public/home/jd_shb/miniconda3/envs/chainer/lib/python3.7/site-packages/cupy/__init__.py", line 37, in 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: libcuda.so.1: cannot open shared object file: No such file or directory ```
leofang commented 3 years ago

You need to have a driver targeting your GPU installed.

liyun-lu commented 3 years ago

Because I am running on a server. I cannot find the location of cuda. I don't have nvcc. But when I execute nvidia-smi, it shows that there is a driver430.50 and cuda 10.1. It's on lab machine so I don't know how it had been installed. How i should do? Thank.

leofang commented 3 years ago

@liyun-lu This is something you need to ask your server admin. If this is a cluster, it could be that you need to activate the CUDA environment on the compute nodes via module load or some other mechanisms. Your admin knows the best. Once the driver is loaded correctly, nvidia-smi should give you correct outputs anywhere that has an NVIDIA GPU, and the output of conda info would contain a virtual package called __cuda that captures the corresponding driver version.

liyun-lu commented 3 years ago

Thank you very much for your reply! After I asked the administrator for the CUDA installation path, after adding the CUDA_PATH and LD_LIBRARY_PATH environment variables, the problem was resolved. By the way, if someone encounters the same problem as me, you can go to my blog to view the details of the solution. The link is: https://blog.csdn.net/qq_36484003/article/details/118369276

leofang commented 3 years ago

Glad to know your admin was able to help!