python - 在没有 GPU 支持的 MacOS 上安装 cupy

标签 python cupy

我一直在论坛上四处走动,尝试以不同的方式在没有 Nvidia GPU 的设备上运行的 MacOS 上安装 cupy。到目前为止,没有任何效果。我已经尝试了 Python 3.7 的 Homebrew 安装和 Python 3.7 的 conda 安装,并尝试了以下各项:

  • conda install -c conda-forge cupy
  • conda 安装 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-only 用于开发目的,我希望有人可以阐明我可以做些什么来获得一个有效的安装。

这是一个示例错误日志,供引用 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。无论你读什么都过时了。我知道,因为我向 remove the last broken bits 发送了 PR来自 CuPy 的代码库,我还在 conda-forge 上维护 CuPy 包。

关于python - 在没有 GPU 支持的 MacOS 上安装 cupy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69626458/

相关文章:

python - 更实用的os.walk

python - 属性错误: module 'cupy' has no attribute 'array'

python - CuPy 不适用于带有 CUDA 9.0 的 Ubuntu 18.04

python - 仅针对选定的GPU架构编译Cupy

Python 正则表达式搜索和拆分

python - Python/C API 中的内存泄漏和引用计数

python - 如何使用多个自定义值标记条形

python - 即使我在每次迭代结束时删除所有变量,python for 循环中也会出现内存泄漏

python - 如何使用 GPU 实现更快的 convolve2d

python - 编写一个在 ubuntu 终端上输入命令的 python 脚本?