cupy 安装时提示报错 Exception: Your CUDA environment is invalid.

执行 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.
    ----------------------------------------

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值