NNabla を Windows 10 上の Python 3.5.2 (Anacondaじゃない方)にインストールしようとしたところエラーが発生しました。
ですが、下記のインストール手順を採用してみた結果、うまく動かすことができました。
動作環境
Windows 10 Pro (64 bit)
Python 3.5.2
pip 9.0.1
NNabla 0.9.2
インストール手順
次の3ステップになります。
- ここ からVisual C++ 2015 Build Toolsをダウンロードしてインストールする。
- ここ からpywin32ダウンロードしてインストールする。
- ここ の Installation に従ってNNablaをインストールする。
エラーも含めた再現手順(TL;DR)
1. pipでnnablaをインストールする
C:\Users\user>pip install nnabla
Collecting nnabla
Using cached nnabla-0.9.2-cp35-cp35m-win_amd64.whl
(中略)
copying skimage\_shared\tests\__init__.py -> build\lib.win-amd64-3.5\skimage\_shared\tests
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
building 'skimage._shared.geometry' extension
compiling C sources
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "c:\users\user\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\user\\AppData\\Local\\Temp\\pip-build-ii84r4r3\\scikit-image\\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\user\AppData\Local\Temp\pip-2lsao591-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-build-ii84r4r3\scikit-image\
エラー発生。
2. Visual C++ 2015 Build Tools をダウンロードしてインストールする
下記URLからダウンロード可能。
http://landinghub.visualstudio.com/visual-cpp-build-tools
3. もう一度pipでnnablaをインストールする
C:\Users\akihi>pip install nnabla
Collecting nnabla
Using cached nnabla-0.9.2-cp35-cp35m-win_amd64.whl
(中略)
Successfully built scikit-image
Installing collected packages: scikit-image, nnabla
Successfully installed nnabla-0.9.2 scikit-image-0.13.0
成功した。
4. 確認のためnnablaをインポートしてみる
C:\> python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nnabla
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\nnabla\__init__.py", line 16, in <module>
from .logger import logger
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\nnabla\logger.py", line 50, in <module>
from .config import nnabla_config
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\nnabla\config.py", line 87, in <module>
nnabla_config = _get_nnabla_config()
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\nnabla\config.py", line 71, in _get_nnabla_config
from win32com.shell import shell, shellcon
ImportError: No module named 'win32com'
>>>
再びエラー発生。
5. pywin32-221.win-amd64-py3.5.exe をダウンロードしてインストールする
下記URLからダウンロード可能。
https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/
6. 確認のため再度nnablaをインポートしてみる
C:\Users\user>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nnabla
2017-08-03 14:56:05,283 [nnabla][INFO]: Initializing CPU extension...
>>>
成功!