目次
Windows 10 に NVIDIA CUDA をインストールする方法
CUDA Toolkit 10.1 Update 1 のダウンロード
CUDA Toolkit | NVIDIA Developer より CUDA Toolkit 10.1 Update 1 をダウンロードする。
Operating System: Windows
Architecture: x86_64
Version: 10
Installer Type: exe (local)
CUDA Toolkit のインストール
インストーラーの「次へ」をクリックしてインストールを行う。オプションはデフォルトのまま。
トラブルシューティング
pip install CuPy で WARNING: nvcc not in path が表示される
Collecting CuPy
Downloading https://files.pythonhosted.org/packages/fb/18/a8c5f594d6fc70d70e53c7847eabc9b922c037b3b7dff4af89a499217d42/cupy-6.1.0.tar.gz (3.1MB)
|████████████████████████████████| 3.1MB 1.3MB/s
ERROR: Complete output from command python setup.py egg_info:
ERROR: Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False}
**************************************************
*** WARNING: nvcc not in path.
*** WARNING: Please set path to nvcc.
**************************************************
-------- Configuring Module: cuda --------
a.cpp
C:\Users\tomoyan\AppData\Local\Temp\tmplz2aff47\a.cpp(1): fatal error C1083: include ファイルを開けません。'cublas_v2.h':No such file or directory
command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.20.27305\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: []
Library directories: []
nvcc command : (not found)
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (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.chainer.org/en/stable/install.html
************************************************************
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\tomoyan\AppData\Local\Temp\pip-install-ny1cq3om\CuPy\setup.py", line 120, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "C:\Users\tomoyan\AppData\Local\Temp\pip-install-ny1cq3om\CuPy\cupy_setup_build.py", line 632, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "C:\Users\tomoyan\AppData\Local\Temp\pip-install-ny1cq3om\CuPy\cupy_setup_build.py", line 387, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\tomoyan\AppData\Local\Temp\pip-install-ny1cq3om\CuPy\
これは CUDA Toolkit をインストールすると改善される。
CUDA Toolkit をインストールしてから CuPy のインストールを行う。
>pip install CuPy Collecting CuPy Using cached https://files.pythonhosted.org/packages/fb/18/a8c5f594d6fc70d70e53c7847eabc9b922c037b3b7dff4af89a499217d42/cupy-6.1.0.tar.gz Requirement already satisfied: numpy>=1.9.0 in c:\python37\lib\site-packages (from CuPy) (1.16.4) Requirement already satisfied: six>=1.9.0 in c:\python37\lib\site-packages (from CuPy) (1.12.0) Collecting fastrlock>=0.3 (from CuPy) Downloading https://files.pythonhosted.org/packages/8f/ff/6777b85fdbc6efd572a2b713e044c29f5f01ca8b1c74f8d94b427bac60c3/fastrlock-0.4.tar.gz (47kB) |████████████████████████████████| 51kB 1.1MB/s Installing collected packages: fastrlock, CuPy Running setup.py install for fastrlock ... done Running setup.py install for CuPy ... done Successfully installed CuPy-6.1.0 fastrlock-0.4