在没有 GPU 支持的 MacOS 上安装 cupy
Install cupy on MacOS without GPU support
我一直在论坛上转来转去,尝试在没有 Nvidia GPU 的设备上尝试在 MacOS 运行 上安装 cupy 的不同方法。到目前为止,没有任何效果。我已经尝试了 Python 3.7 的 Homebrew 安装和 Python 3.7 的 conda 安装,并尝试了以下各项:
conda install -c conda-forge cupy
conda install cupy
pip install cupy
-
git clone https://github.com/cupy/cupy.git
cd cupy
git submodule update --init
pip install -e .
错误总是一脉相承...对于 conda,MacOS 存储库没有它,对于 pip,安装抱怨 CUDA 没有安装在我的系统上。根据我在网上阅读的内容,cupy 应该能够安装为 CPU-仅用于开发目的,我希望有人可以阐明我可以做些什么来获得一个有效的安装。
这是一个错误日志示例,供 pip install cupy
参考:
ERROR: Command errored out with exit status 1:
command: /Users/nold/miniconda3/envs/SPANet/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/setup.py'"'"'; __file__='"'"'/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-pip-egg-info-2bbvs1rw
cwd: /private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/
Complete output (49 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'wheel_metadata': None, 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}
-------- Configuring Module: cuda --------
Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -D_FORCE_INLINES=1 -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include/cupy/cub -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include -c /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmphc_ag1dw/a.cpp -o /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmphc_ag1dw/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmphc_ag1dw/a.o" failed with exit status 1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/setup.py", line 118, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/cupy_setup_build.py", line 963, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/cupy_setup_build.py", line 693, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
**************************************************
*** WARNING: Cannot check compute capability
Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include/cupy/cub -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include -c /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmpkdbb5_vj/a.cpp -o /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmpkdbb5_vj/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmpkdbb5_vj/a.o" failed with exit status 1
**************************************************
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include/cupy/cub', '/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include']
Library directories: []
nvcc command : (not found)
hipcc command : (not found)
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
HIPCC : (none)
ROCM_HOME : (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.dev/en/stable/install.html
************************************************************
CuPy 不支持 Mac,因为 NVIDIA 不再支持 MacOS。无论你读什么都过时了。我知道是因为我从 CuPy 的代码库向 remove the last broken bits 发送了一个 PR,并且我还在 conda-forge 上维护了 CuPy 包。
我一直在论坛上转来转去,尝试在没有 Nvidia GPU 的设备上尝试在 MacOS 运行 上安装 cupy 的不同方法。到目前为止,没有任何效果。我已经尝试了 Python 3.7 的 Homebrew 安装和 Python 3.7 的 conda 安装,并尝试了以下各项:
conda install -c conda-forge cupy
conda install cupy
pip install cupy
-
git clone https://github.com/cupy/cupy.git cd cupy git submodule update --init pip install -e .
错误总是一脉相承...对于 conda,MacOS 存储库没有它,对于 pip,安装抱怨 CUDA 没有安装在我的系统上。根据我在网上阅读的内容,cupy 应该能够安装为 CPU-仅用于开发目的,我希望有人可以阐明我可以做些什么来获得一个有效的安装。
这是一个错误日志示例,供 pip install cupy
参考:
ERROR: Command errored out with exit status 1:
command: /Users/nold/miniconda3/envs/SPANet/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/setup.py'"'"'; __file__='"'"'/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-pip-egg-info-2bbvs1rw
cwd: /private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/
Complete output (49 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'wheel_metadata': None, 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}
-------- Configuring Module: cuda --------
Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -D_FORCE_INLINES=1 -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include/cupy/cub -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include -c /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmphc_ag1dw/a.cpp -o /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmphc_ag1dw/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmphc_ag1dw/a.o" failed with exit status 1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/setup.py", line 118, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/cupy_setup_build.py", line 963, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/cupy_setup_build.py", line 693, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
**************************************************
*** WARNING: Cannot check compute capability
Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -I/Users/ajpfahnl/miniconda3/envs/SPANet/include -arch x86_64 -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include/cupy/cub -I/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include -c /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmpkdbb5_vj/a.cpp -o /var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmpkdbb5_vj/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/tmpkdbb5_vj/a.o" failed with exit status 1
**************************************************
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include/cupy/cub', '/private/var/folders/j4/nzmp4kf17z3d1z22wzwjy3m00000gn/T/pip-install-uyg_c8fb/cupy_3e5357e9d2ae4f96a8575fd2e4cc5b5e/install/../cupy/_core/include']
Library directories: []
nvcc command : (not found)
hipcc command : (not found)
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
HIPCC : (none)
ROCM_HOME : (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.dev/en/stable/install.html
************************************************************
CuPy 不支持 Mac,因为 NVIDIA 不再支持 MacOS。无论你读什么都过时了。我知道是因为我从 CuPy 的代码库向 remove the last broken bits 发送了一个 PR,并且我还在 conda-forge 上维护了 CuPy 包。