cupy 指定版本安装

我的目标是安装cuda=9.0下的cupy,且cupy的版本为4.1.0
开始使用源码安装的过程中失败:pip install cupy。后尝试其他方法成功安装:

  • 先安装对应版本的cudatoolkit:
conda install -c conda-forge cudatoolkit=9.0
  • 然后安装cupy
pip install cupy-cuda90==4.1.0

这个时候使用pip show cupy-cuda90能找到,但是运行代码的过程中报错:

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.chainer.org/en/latest/install.html

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

原因是找不到libcublas.so.9.0文件,因为安装过程中找的是服务器中默认的CUDA,往往和我们目标的版本不一样。前面我们已经安装了对应版本的cudatoolkit,只需要在服务器中找到libcublas.so.9.0文件,并添加环境变量:export LD_LIBRARY_PATH=/home/Users/usr/.conda/envs/envname/lib:$LD_LIBRARY_PATH
验证安装成功:

python -c "import cupy; print(cupy.__version__)"
4.1.0
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值