执行 pip install cupy 之后报错,提示cuda环境不合法
解决方法:
1. 查看当前环境cuda版本
cat /usr/local/ cuda /version.txt
得到cuda10.2
2. 根据cuda版本指定cupy版本安装
pip install cupy-cuda102
成功安装
ref:https://blog.youkuaiyun.com/qq907482638/article/details/102586724
具体报错信息如下
ERROR: Command errored out with exit status 1:
command: /usr/local/miniconda3/envs/dl/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-vzzat06i
cwd: /tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/
Complete output (25 lines):
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
/tmp/tmp2t32ou6n/a.cpp:1:10: fatal error: cublas_v2.h: No such file or directory
#include <cublas_v2.h>
^~~~~~~~~~~~~
compilation terminated.
Options: {'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False}
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib64']
command '/usr/local/miniconda3/envs/dl/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
**************************************************
*** WARNING: Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'curand.h', 'cusparse.h', 'nvrtc.h', 'nvToolsExt.h']
*** WARNING: Skip installing cuda support
*** WARNING: Check your CFLAGS environment variable
**************************************************
/tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/setup.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/setup.py", line 32, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "/tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/cupy_setup_build.py", line 374, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "/tmp/pip-install-hi6brf50/cupy_2e41c9f2cfd94922b9669c2acf9fd3a1/cupy_setup_build.py", line 267, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
----------------------------------------