[Python] [Chainer] [Windows] Install Chainer on Windows

Chainer environment creation procedure memo on Windows (mainly a memorandum on handling errors)

Chainer: A flexible framework for neural networks

※Caution! In my environment, I could not create an execution environment for the GPU version (CUDA version), so please refer to it for the CPU version.

Verification environment

Installation procedure

(Option) Install CUDA Toolkit

If you want to use CUDA with Chainer, be sure to install CUDA Toolkit first.

CUDA Toolkit | NVIDIA Developer

Example: Select [Download] => [Windows] => [x86_64] => [10] => [exe (network)].

Install Chainer

Install Chainer.

$ pip install chainer

Sample operation check

pfnet/chainer: A flexible framework of neural networks for deep learning

Normal execution

Normal execution


$ python examples/mnist/train_mnist.py

無題.png

Execution using GPU

TODO: In my environment, I get an error at runtime, so I'm verifying => Even if I imitate another person's article and make trial and error, I am giving up because I can not detect the headers of CUDA by any means ... (v1.21.0).

If the installation is successful, you should be able to do the following:

Execution using gpu


$ python train_mnist.py -g 0

trouble shooting

If Microsoft Visual C ++ 14.0 does not exist

NOTE: This error did not occur in an environment where Visual Studio 2015 was already installed.

When I tried to install with pip, I got the following error.

Running chainer installation with pip failed


$ pip install chainer
  Using cached chainer-1.10.0.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info\chainer.egg-info
    writing top-level names to pip-egg-info\chainer.egg-info\top_level.txt
    writing dependency_links to pip-egg-info\chainer.egg-info\dependency_links.txt
    writing pip-egg-info\chainer.egg-info\PKG-INFO
    writing requirements to pip-egg-info\chainer.egg-info\requires.txt
    writing manifest file 'pip-egg-info\chainer.egg-info\SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
    Executing cythonize
    Options: {'annotate': False, 'no_cuda': False, 'profile': False, 'linetrace': False}
    **************************************************
    *** WARNING: nvcc not in path.
    *** WARNING: Please set path to nvcc.
    **************************************************
    Include directories: []
    Library directories: []

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\<username>\AppData\Local\Temp\pip-build-7ak65o9t\chainer\

Apparently there is no compiler for Cython, so it seems to be useless, so install Microsoft Visual C ++ Build Tools, which is also specified in the error log, first. (I think it depends on the environment, but it took a long time to install. About 30 minutes?)

Download the Visual C++ Build Tools (standalone C++ compiler, libraries and tools)

You should now be able to install it by running it again.

AttributeError:'module' object has no attribute'PlotReport' when running sample

As I wrote above, I got this error when the installed Chainer version and the sample version do not match. In my case I used master when using chainer 1.21.0 and got this error. As a workaround, I checked out the 1.21.0 tag and used the sample for that version and it worked fine.

cuda.h etc. not found (unsolved)

The following error may occur when installing chainer.

**************************************************
*** WARNING: Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'curand.h']
*** WARNING: Skip installing cuda support
*** WARNING: Check your CFLAGS environment variable
**************************************************

TODO: Currently unsolved in my environment ... In other people's articles, there was a description such as adding a path to INCLUDE, so I tried adding it, but it did not solve.

cudnn.h not found (unverified)

**************************************************
*** WARNING: Include files not found: ['cudnn.h']
*** WARNING: Skip installing cudnn support
*** WARNING: Check your CFLAGS environment variable
**************************************************

reference

Chainer MNIST Error AttributeError: 'module' object has no attribute 'PlotReport' Install Chainer + CUDA 8.0 on Windows 10-Qiita

Recommended Posts

[Python] [Chainer] [Windows] Install Chainer on Windows
Install python on windows
Install Chainer 1.5.0 on Windows
Install watchdog on Windows + Python 3.3
Install Chainer 1.6 (GPU) on Windows 7.
Python on Windows
Install python2.7 on windows 32bit environment
Install xgboost (python version) on Windows
Install Pytorch on Blender 2.90 python on Windows
Install python on WSL
Install Python on Pidora.
Install Scrapy on python3
[Kivy] How to install Kivy on Windows [Python]
Install Python on Mac
Install Anaconda on Windows 10
python basic on windows ②
Install pycuda on Windows10
Install Python 2.7.3 on CentOS 5.4
Install pygraphviz on Windows 10
Install Python 3.3 on Ubuntu 12.04
Install Chainer on CentOS 6.7
Install Python 3.6 on Docker
Install Python (for Windows)
Install and run Python3.5 + NumPy + SciPy on Windows 10
Install Python3, numpy, pandas, matplotlib, etc. on Windows
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
[Python] How to install OpenCV on Anaconda [Windows]
Install ZIP version Python and pip on Windows 10
Install Numpy on virtualenv on Windows
Set-enable Python virtualenv on Windows
Run Openpose on Python (Windows)
Install Python 3.8 on RHEL 8 (AppStream)
Install Python and Flask (Windows 10)
Install Win-Kex (kali-linux) on Windows 10.
Install pygame on python3.4 on mac
Windows10: Install python dlib library
Install cvxpy on windows, Anaconda
Python + Kivy development on Windows
Prepare Chainer environment on Windows
Sphinx-autobuild (0.5.2) on Windows7, Python 3.5.1, Sphinx 1.3.5
Fastest Python installation on Windows
Build Python environment on Windows
Install pandas 0.14 on python3.4 [on Mac]
Install OpenCV on Ubuntu + python
Build python environment on windows
Python --Install MySQLDB on EC2
Install Python 3.8 on CentOS 8 (AppStream)
I ran python on windows
Python install in 2 lines @Windows
Use Python on Windows (PyCharm)
Install dlib for Python (Windows)
install python
[Windows] [Python3] Install python3 and Jupyter Notebook (formerly ipython notebook) on Windows
Install Bash on Ubuntu on Windows, Ruby, Python, Jupyter, etc.
For those who can't install Python on Windows XP
Install Python Pillow on Amazon Linux
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Python environment construction memo on Windows 10
Python 3.6 on Windows ... and to Xamarin.
Installing Kivy on Windows10 64bit Python3.5
Install Python3 on Sakura server (FreeBSD)