質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Chainer

Chainerは、国産の深層学習フレームワークです。あらゆるニューラルネットワークをPythonで柔軟に書くことができ、学習させることが可能。GPUをサポートしており、複数のGPUを用いた学習も直感的に記述できます。

CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

pip

pipとは、Pythonを用いて書かれているパッケージソフトのインストールや管理を行うためのパッケージマネジメントシステムです。pipを使う主なメリットは、コマンドラインインターフェースにて容易にPythonパッケージソフトをインストール可能だという点です。

Q&A

解決済

2回答

3074閲覧

pip install cupy エラー

harusige

総合スコア9

Chainer

Chainerは、国産の深層学習フレームワークです。あらゆるニューラルネットワークをPythonで柔軟に書くことができ、学習させることが可能。GPUをサポートしており、複数のGPUを用いた学習も直感的に記述できます。

CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

pip

pipとは、Pythonを用いて書かれているパッケージソフトのインストールや管理を行うためのパッケージマネジメントシステムです。pipを使う主なメリットは、コマンドラインインターフェースにて容易にPythonパッケージソフトをインストール可能だという点です。

0グッド

0クリップ

投稿2018/06/23 11:12

前提・実現したいこと

pip install cupy がエラーで実現できません。

とりあえず下記環境で利用しようとしています
Windows 10
Visual Studio 2015 Community
CUDA 9.0
CuDNN 7.0

Cupy がインストールできたら、Chainer のインストールをを行う予定ですが、うまく実現できません。インストール方法についてご教授ください。

よろしくお願いいたします。

発生している問題・エラーメッセージ

-> Check your CFLAGS environment variable.
CFLAGS の環境変数をしなおす必要があるように思うのですが、CFLAGS がどこにあるのかわかりません。また、設定の仕方がわかりません。

該当のソースコード

PS C:\Users\harus> pip install cupy
Collecting cupy
Using cached https://files.pythonhosted.org/packages/99/fe/6a0dde420e07b1b447b4c3540a4bed9747027860e897afad602866c77784/cupy-4.2.0.zip
Complete output from command python setup.py egg_info:
Options: {'profile': False, 'annotate': False, 'linetrace': False, 'wheel_libs': [], 'package_name': 'cupy', 'no_rpath': False, 'no_cuda': False, 'long_description': None}

-------- Configuring Module: cuda -------- Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 ************************************************************ * CuPy Configuration Summary * ************************************************************ Build Environment: Include directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\include'] Library directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64'] nvcc command : ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin/nvcc.exe'] Environment Variables: CFLAGS : (none) LDFLAGS : (none) LIBRARY_PATH : (none) CUDA_PATH : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 NVTOOLSEXT_PATH : C:\Program Files\NVIDIA Corporation\NvToolsExt\ 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\harus\appdata\local\temp\pip-install-b9dig2\cupy\setup.py", line 64, in <module> ext_modules = cupy_setup_build.get_ext_modules() File "cupy_setup_build.py", line 561, in get_ext_modules extensions = make_extensions(arg_options, compiler, use_cython) File "cupy_setup_build.py", line 374, in make_extensions raise Exception('Your CUDA environment is invalid. ' Exception: Your CUDA environment is invalid. Please check above error log. ----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in c:\users\harus\appdata\local\temp\pip-install-b9dig2\cupy\

試したこと

WINDOWS - SYSTEM - 詳細設定 - 環境変数 に
変数名 CFAGS
変数値 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include

と設定してみましたが効果はありませんでした。

補足情報(FW/ツールのバージョンなど)

上記の通りです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

wakame

2018/06/23 12:17

Pythonのversionを教えて下さい。
harusige

2018/06/23 14:17

Python 2.7.12 |Anaconda 4.2.0 (64-bit)| こちらです。Anaconda を使ってます。
guest

回答2

0

ベストアンサー

エラーの原因は

ERROR: CUDA could not be found on your system.

とあるようにCUDAがみつからないことにあるようです。既にインストール済みということなので、CUDAのインストール場所などを示す環境変数の設定が不足していることが原因と思われます。
エラーメッセージによると

Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html

ということで参照にしてはいかがでしょうか。
念のためにCUDAインストール時に参照内容をチェックして環境変数が正しく設定されていることを確認したほうがいいでしょう。

投稿2018/06/23 19:24

R.Shigemori

総合スコア3376

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

harusige

2018/06/24 21:13

ご回答ありがとうございます。 CUDA 9.0、CuDNN 7.0 を入れなおした結果、あと少しというところまで進められるようになりました。もう少しだと思うのですが、まだ完了はしておりません。 ーーーーーーーーーーーーーーーーーーーーーーーー PS C:\Users\harus> pip install cupy==2.3.0 --no-cache-dir Collecting cupy==2.3.0 Downloading https://files.pythonhosted.org/packages/51/ce/9c4789dd570935c5fd8c9f71aa4e0761aaaef195ef1f017e4174e7c266dc/cupy-2.3.0.tar.gz (1.9MB) 100% |################################| 1.9MB 1.6MB/s Requirement already satisfied: numpy>=1.9.0 in c:\users\harus\anaconda2\lib\site-packages (from cupy==2.3.0) (1.11.1) Requirement already satisfied: six>=1.9.0 in c:\users\harus\anaconda2\lib\site-packages (from cupy==2.3.0) (1.10.0) Requirement already satisfied: fastrlock>=0.3 in c:\users\harus\anaconda2\lib\site-packages (from cupy==2.3.0) (0.3) Installing collected packages: cupy Running setup.py install for cupy ... error Complete output from command c:\users\harus\anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\harus\appdata\local\temp\pip-install-qzwcb4\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 c:\users\harus\appdata\local\temp\pip-record-rx3ndg\install-record.txt --single-version-externally-managed --compile: ************************************************** *** WARNING: Cannot find nvToolsExt. nvtx was disabled. ************************************************** Options: {'profile': False, 'annotate': False, 'linetrace': False, 'no_cuda': False} Include directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\include'] Library directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64'] a.cpp C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss a.cpp a.cpp Include directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\include'] Library directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64'] a.cpp C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss a.cpp a.cpp C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss Include directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\include'] Library directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64'] a.cpp c:\users\harus\appdata\local\temp\tmpcdo1es\a.cpp(1) : fatal error C1083: Cannot open include file: 'nccl.h': No such file or directory command 'C:\Users\harus\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2 ************************************************** *** WARNING: Include files not found: ['nccl.h'] *** WARNING: Skip installing nccl support *** WARNING: Check your CFLAGS environment variable ************************************************** Include directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\include'] Library directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64'] a.cpp a.cpp a.cpp Include directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\include'] Library directories: ['C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64', 'C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64'] a.cpp C:\Users\harus\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\thrust/system/detail/error_category.inl(102) : warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\Users\harus\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\string.h(126) : see declaration of 'strerror' a.cpp a.cpp running install running build running build_py ~中略~ C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\cuda_runtime_api.h(1950) : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\cuda_runtime.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss C:\Program Files\NVIDIA Corporation\NvToolsExt\include\nvToolsExt.h(84) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory error: command 'C:\Users\harus\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2 ---------------------------------------- Command "c:\users\harus\anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\harus\appdata\local\temp\pip-install-qzwcb4\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 c:\users\harus\appdata\local\temp\pip-record-rx3ndg\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\harus\appdata\local\temp\pip-install-qzwcb4\cupy\
guest

0

CUDA toolkitも必要らしいので、こちらもインストールしてから試してみてはいかがでしょうか?エラーメッセージにもwarningにそれらしいことが出ています

投稿2018/06/24 22:50

R.Shigemori

総合スコア3376

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問