我无法用 pip 安装 cupy
I cannot install cupy with pip
我附上了错误消息,因为我不知道从哪里开始。我已尝试更新 setuptools 并清除并重新安装 pip。
我是 运行 Linux 薄荷 19.3 肉桂 4.4.8.
如果有人遇到过这个问题或对解决方案有任何建议,非常感谢您的回答。
Building wheels for collected packages: cupy
Building wheel for cupy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-l4z23_lk
cwd: /tmp/pip-install-u16qlzud/cupy/
Complete output (322 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}
-------- Configuring Module: cuda --------
-------- Configuring Module: cusolver --------
-------- Configuring Module: cudnn --------
/tmp/tmp1qjn9w6q/a.cpp:1:10: fatal error: cudnn.h: No such file or directory
#include <cudnn.h>
^~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nccl --------
/tmp/tmp2iuqiy0h/a.cpp:1:10: fatal error: nccl.h: No such file or directory
#include <nccl.h>
^~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nvtx --------
-------- Configuring Module: thrust --------
-------- Configuring Module: cutensor --------
/tmp/tmp_s6hfvnf/a.cpp:1:10: fatal error: cutensor.h: No such file or directory
#include <cutensor.h>
^~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: cub --------
/tmp/tmpuygeof24/a.cpp:1:10: fatal error: cub/util_namespace.cuh: No such file or directory
#include <cub/util_namespace.cuh>
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib64']
nvcc command : ['/usr/local/cuda/bin/nvcc']
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
ROCM_HOME : (none)
Modules:
cuda : Yes (version 10020)
cusolver : Yes
cudnn : No
-> Include files not found: ['cudnn.h']
-> Check your CFLAGS environment variable.
nccl : No
-> Include files not found: ['nccl.h']
-> Check your CFLAGS environment variable.
nvtx : Yes
thrust : Yes
cutensor : No
-> Include files not found: ['cutensor.h']
-> Check your CFLAGS environment variable.
cub : No
-> Include files not found: ['cub/util_namespace.cuh']
-> Check your CFLAGS environment variable.
WARNING: Some modules could not be configured.
CuPy will be installed without these modules.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
然后它继续了一段时间没有错误,列出了它正在复制的文件(由于字符限制不能粘贴整个东西)并输出:
O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_FORCE_INLINES=1 -I/usr/local/cuda/include -I/usr/include/python3.6m -c cupy/core/_dtype.cpp -o build/temp.linux-x86_64-3.6/cupy/core/_dtype.o
cupy/core/_dtype.cpp:41:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cupy
Running setup.py clean for cupy
Failed to build cupy
Installing collected packages: cupy
Running setup.py install for cupy ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xu7deyq_/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rjyarwood/.local/include/python3.6m/cupy
cwd: /tmp/pip-install-u16qlzud/cupy/
Complete output (322 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}
-------- Configuring Module: cuda --------
-------- Configuring Module: cusolver --------
-------- Configuring Module: cudnn --------
/tmp/tmp860stz4q/a.cpp:1:10: fatal error: cudnn.h: No such file or directory
#include <cudnn.h>
^~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nccl --------
/tmp/tmpgzs7nn1l/a.cpp:1:10: fatal error: nccl.h: No such file or directory
#include <nccl.h>
^~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nvtx --------
-------- Configuring Module: thrust --------
-------- Configuring Module: cutensor --------
/tmp/tmp0evja8r4/a.cpp:1:10: fatal error: cutensor.h: No such file or directory
#include <cutensor.h>
^~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: cub --------
/tmp/tmpofwkp36s/a.cpp:1:10: fatal error: cub/util_namespace.cuh: No such file or directory
#include <cub/util_namespace.cuh>
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib64']
nvcc command : ['/usr/local/cuda/bin/nvcc']
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
ROCM_HOME : (none)
Modules:
cuda : Yes (version 10020)
cusolver : Yes
cudnn : No
-> Include files not found: ['cudnn.h']
-> Check your CFLAGS environment variable.
nccl : No
-> Include files not found: ['nccl.h']
-> Check your CFLAGS environment variable.
nvtx : Yes
thrust : Yes
cutensor : No
-> Include files not found: ['cutensor.h']
-> Check your CFLAGS environment variable.
cub : No
-> Include files not found: ['cub/util_namespace.cuh']
-> Check your CFLAGS environment variable.
WARNING: Some modules could not be configured.
CuPy will be installed without these modules.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
做和以前一样的事情然后输出:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cupy
copying cupy/__init__.py -> build/lib.linux-
building 'cupy.core._dtype' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cupy
creating build/temp.linux-x86_64-3.6/cupy/core
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_FORCE_INLINES=1 -I/usr/local/cuda/include -I/usr/include/python3.6m -c cupy/core/_dtype.cpp -o build/temp.linux-x86_64-3.6/cupy/core/_dtype.o
cupy/core/_dtype.cpp:41:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xu7deyq_/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rjyarwood/.local/include/python3.6m/cupy Check the logs for full command output.
对于 Python.h 错误,您可能需要使用您的 python3-dev (Debian/Ubuntu/Mint) 或 python3-devel (Fedora/CentOS/RHEL) 安装操作系统的包管理器,如 apt 或 dnf。
对于其他缺失的 .h,您通常可以 google for:
cudnn.h: No such file or directory Debian
...找出哪个 Debian 软件包包含 cudnn.h
HTH.
已解决的问题: 检查此 Doc。各种 cuda 版本存在支持问题。
检查“安装 CuPy”
例如:pip install cupy-cuda101
我附上了错误消息,因为我不知道从哪里开始。我已尝试更新 setuptools 并清除并重新安装 pip。
我是 运行 Linux 薄荷 19.3 肉桂 4.4.8.
如果有人遇到过这个问题或对解决方案有任何建议,非常感谢您的回答。
Building wheels for collected packages: cupy
Building wheel for cupy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-l4z23_lk
cwd: /tmp/pip-install-u16qlzud/cupy/
Complete output (322 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}
-------- Configuring Module: cuda --------
-------- Configuring Module: cusolver --------
-------- Configuring Module: cudnn --------
/tmp/tmp1qjn9w6q/a.cpp:1:10: fatal error: cudnn.h: No such file or directory
#include <cudnn.h>
^~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nccl --------
/tmp/tmp2iuqiy0h/a.cpp:1:10: fatal error: nccl.h: No such file or directory
#include <nccl.h>
^~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nvtx --------
-------- Configuring Module: thrust --------
-------- Configuring Module: cutensor --------
/tmp/tmp_s6hfvnf/a.cpp:1:10: fatal error: cutensor.h: No such file or directory
#include <cutensor.h>
^~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: cub --------
/tmp/tmpuygeof24/a.cpp:1:10: fatal error: cub/util_namespace.cuh: No such file or directory
#include <cub/util_namespace.cuh>
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib64']
nvcc command : ['/usr/local/cuda/bin/nvcc']
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
ROCM_HOME : (none)
Modules:
cuda : Yes (version 10020)
cusolver : Yes
cudnn : No
-> Include files not found: ['cudnn.h']
-> Check your CFLAGS environment variable.
nccl : No
-> Include files not found: ['nccl.h']
-> Check your CFLAGS environment variable.
nvtx : Yes
thrust : Yes
cutensor : No
-> Include files not found: ['cutensor.h']
-> Check your CFLAGS environment variable.
cub : No
-> Include files not found: ['cub/util_namespace.cuh']
-> Check your CFLAGS environment variable.
WARNING: Some modules could not be configured.
CuPy will be installed without these modules.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
然后它继续了一段时间没有错误,列出了它正在复制的文件(由于字符限制不能粘贴整个东西)并输出:
O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_FORCE_INLINES=1 -I/usr/local/cuda/include -I/usr/include/python3.6m -c cupy/core/_dtype.cpp -o build/temp.linux-x86_64-3.6/cupy/core/_dtype.o
cupy/core/_dtype.cpp:41:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cupy
Running setup.py clean for cupy
Failed to build cupy
Installing collected packages: cupy
Running setup.py install for cupy ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xu7deyq_/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rjyarwood/.local/include/python3.6m/cupy
cwd: /tmp/pip-install-u16qlzud/cupy/
Complete output (322 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}
-------- Configuring Module: cuda --------
-------- Configuring Module: cusolver --------
-------- Configuring Module: cudnn --------
/tmp/tmp860stz4q/a.cpp:1:10: fatal error: cudnn.h: No such file or directory
#include <cudnn.h>
^~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nccl --------
/tmp/tmpgzs7nn1l/a.cpp:1:10: fatal error: nccl.h: No such file or directory
#include <nccl.h>
^~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: nvtx --------
-------- Configuring Module: thrust --------
-------- Configuring Module: cutensor --------
/tmp/tmp0evja8r4/a.cpp:1:10: fatal error: cutensor.h: No such file or directory
#include <cutensor.h>
^~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
-------- Configuring Module: cub --------
/tmp/tmpofwkp36s/a.cpp:1:10: fatal error: cub/util_namespace.cuh: No such file or directory
#include <cub/util_namespace.cuh>
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
command 'x86_64-linux-gnu-gcc' failed with exit status 1
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib64']
nvcc command : ['/usr/local/cuda/bin/nvcc']
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
ROCM_HOME : (none)
Modules:
cuda : Yes (version 10020)
cusolver : Yes
cudnn : No
-> Include files not found: ['cudnn.h']
-> Check your CFLAGS environment variable.
nccl : No
-> Include files not found: ['nccl.h']
-> Check your CFLAGS environment variable.
nvtx : Yes
thrust : Yes
cutensor : No
-> Include files not found: ['cutensor.h']
-> Check your CFLAGS environment variable.
cub : No
-> Include files not found: ['cub/util_namespace.cuh']
-> Check your CFLAGS environment variable.
WARNING: Some modules could not be configured.
CuPy will be installed without these modules.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
做和以前一样的事情然后输出:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cupy
copying cupy/__init__.py -> build/lib.linux-
building 'cupy.core._dtype' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cupy
creating build/temp.linux-x86_64-3.6/cupy/core
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_FORCE_INLINES=1 -I/usr/local/cuda/include -I/usr/include/python3.6m -c cupy/core/_dtype.cpp -o build/temp.linux-x86_64-3.6/cupy/core/_dtype.o
cupy/core/_dtype.cpp:41:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u16qlzud/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xu7deyq_/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rjyarwood/.local/include/python3.6m/cupy Check the logs for full command output.
对于 Python.h 错误,您可能需要使用您的 python3-dev (Debian/Ubuntu/Mint) 或 python3-devel (Fedora/CentOS/RHEL) 安装操作系统的包管理器,如 apt 或 dnf。
对于其他缺失的 .h,您通常可以 google for:
cudnn.h: No such file or directory Debian
...找出哪个 Debian 软件包包含 cudnn.h
HTH.
已解决的问题: 检查此 Doc。各种 cuda 版本存在支持问题。 检查“安装 CuPy” 例如:pip install cupy-cuda101