I've been making the rounds on forums trying out different ways to install cupy on MacOS running on a device without a Nvidia GPU. So far, nothing has worked. I've tried both a Homebrew install of Python 3.7 and a conda install of Python 3.7 and attempted each of the following:
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 .
The errors are always in the same vein...for conda, the MacOS repos don't have it, and for pip the installation complains CUDA isn't installed on my system. From what I've read online, cupy should be able to install as CPU-only for development purposes, and I was hoping someone could shed some light on what I might be able to do to get a working installation.
Here's an example error log for reference with 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
************************************************************
There is no Mac support in CuPy since NVIDIA no longer supports MacOS. Whatever you read is outdated. I know because I sent a PR to remove the last broken bits from CuPy's codebase, and I also maintain the CuPy package on conda-forge.