pip install cupy 失败,出现如下的错误信息:
Collecting cupy
Using cached https://files.pythonhosted.org/packages/4d/08/2b25443d31ea34cdd259a689d67bc20f19df0c079e1f517ca1bd5bd7e6e2/cupy-6.2.0.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False}
-------- Configuring Module: cuda --------
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
/tmp/tmpemmkk1to/a.cpp:1:23: fatal error: cublas_v2.h: No such file or directory
compilation terminated.
command 'gcc' failed with exit status 1
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: []
Library directories: []
nvcc command : (not found)
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
Modules:
cuda : No
-> Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'cufft.h', 'curand.h', 'cusparse.h', 'nvrtc.h']
-> Check your CFLAGS environment variable.
ERROR: CUDA could not be found on your system.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-bocabbej/cupy/setup.py", line 120, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "/tmp/pip-install-bocabbej/cupy/cupy_setup_build.py", line 632, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "/tmp/pip-install-bocabbej/cupy/cupy_setup_build.py", line 387, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-bocabbej/cupy/
升级setuptools和pip :pip install -U setuptools pip, 好像并不能解决问题。
解决的方法主要在于加上cuda版本号,类似于这样:pip install --pre cupy-cuda90
(这个可能只对cuda9.0好用)