Prepare Chainer environment on Windows

Introduction

Deep Learning is a hot topic in recent years. There are various frameworks such as Caffe and TensorFlow, but I'm mostly Chainer. I usually use Ubuntu 14.04, but the other day I had to handle Chainer on a Windows machine, and I couldn't install Chainer as smoothly as I did on Ubuntu, so it took a lot of time. I think it's a rare case, but I've summarized where it got caught and how to solve it.

environment

I will omit the introduction of Python and Git. By the way, since it was a CPU environment, I can't explain about CUDA etc.

Where I got caught

Module does not fit!

It seems that chainer cannot be installed unless numpy, scipy, and h5py are installed.

When installing these modules, I can't install them by suddenly doing "pip install numpy". Apparently you need to install from a compiled file called whl. There are various whl files on this site, so download them here. Once you've downloaded the whl file you need, use that file to pip install. Below is an example of numpy.

 cd [directory with whl files]
pip install numpy-1.11.1+mkl-cp27-cp27m-win_amd64.whl

Install scipy and h5py from the whl file as well.

 $ pip install [module name] --proxy = [user] @ [proxy]: [port]

There is no whl file for chainer!

Well, there is no chainer whl file on the previous site. (As of 2016/06/30) So let's clone the code from GitHub and build it.

$ git clone https://github.com/pfnet/chainer.git
$ cd chainer
$ python setup.py install

Execution of setup.py stops halfway

I think it will appear in the error message, but it seems that Visual Studio C ++ is required Download and install from here

Verification

You should finally be able to install it.

Let's recognize MNIST in Example to check if Chainer was installed properly. Try running the following in the directory you've git cloned into.

$ python examples/mnist/train_mnist.py
GPU: -1
 unit: 1000
 Minibatch-size: 100
 epoch: 20
Network type: simple

load MNIST dataset
epoch 1
graph generated
train mean loss=0.190369202715, accuracy=0.941016668603, throughput=994.727940618 images/sec
test  mean loss=0.0899474363861, accuracy=0.970900004506
epoch 2
 ・
 ・
 ・

It took about 10 minutes because it is a CPU environment

in conclusion

It seems that bash will be introduced in Windows 10, so I think that it will not be necessary to take such troublesome steps in the future. If you can't wait until it is introduced, please try this method.

Recommended Posts

Prepare Chainer environment on Windows
Install Chainer 1.5.0 on Windows
Build Python environment on Windows
Django environment development on Windows 10
Install Chainer 1.6 (GPU) on Windows 7.
Build python environment on windows
[Tensorflow] Tensorflow environment construction on Windows 10
[Python] [Chainer] [Windows] Install Chainer on Windows
Python environment construction memo on Windows 10
Prepare Python development environment on Ubuntu
Anaconda python environment construction on Windows 10
Install python2.7 on windows 32bit environment
Create a Linux environment on Windows 10
Install Python development environment on Windows 10
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Programming environment for beginners made on Windows
python windows environment
Creating a python virtual environment on Windows
I built a TensorFlow environment on windows10
YOLO on Chainer
Building an environment for "Tello_Video" on Windows
Prepare the environment of Chainer on EC2 spot instance with AWS Lambda
Simply build a Python 3 execution environment on Windows
Create a Python virtual development environment on Windows
python windows environment construction
Pylint on Windows Atom
Linux (WSL) on Windows
Use pyvenv on Windows
Anaconda on Windows Terminal
Install Anaconda on Windows 10
python basic on windows ②
virtualenvwrapper in windows environment
Install python on windows
Install pycuda on Windows10
Build TensorFlow on Windows
Try FEniCS on Windows!
Build XGBoost on Windows
Install pygraphviz on Windows 10
Use Ansible on Windows
Try Poerty on Windows
Use QuTiP on Windows
Use pip on Windows
Install Chainer on CentOS 6.7
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Create a comfortable Python 3 (Anaconda) development environment on windows
A memo of installing Chainer 1.5 for GPU on Windows
Building a TensorFlow environment that uses GPU on Windows 10
Build a GVim-based Python development environment on Windows 10 (1) Installation
Procedure for building a CDK environment on Windows (Python)
Create an OpenAI Gym environment with bash on Windows 10
Create a decent shell and python environment on Windows
Cross development environment (developing programs for windows on linux)
Prepare Django development environment using homebrew on MacOSX Mavericks (10.9)
Build a machine learning environment natively on Windows 10 (x64)
Make anaconda environment available from command prompt on windows
Install Numpy on virtualenv on Windows
Set-enable Python virtualenv on Windows
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
Run Jupyter on Ubuntu on Windows
Run Openpose on Python (Windows)
A memo on how to easily prepare a Linux exercise environment