The easiest way to get Chainer v1.5 + CUDA + cuDNN on Windows

Chainer has become dependent on Cython and h5py since 1.5. How to install on Windows is described in Day 2 article (Installing Chainer 1.5.0 on Windows), but everyone is more I would like to add some supplements so that you can easily use Chainer properly on Windows.

** Note: As of 12/10/2015, Chainer (v1.5.1) does not officially support Windows. ** If you git clone and execute nosetest, you can see the reality that various functions are not actually working ...

Overall flow

--Preparing Windows --Prepare a 64-bit Windows environment and a new NVIDIA GPU (option: if you want to use CUDA) --Preparing Python -Install Anaconda --Compiler preparation -Install Microsoft Visual C ++ Compiler for Python 2.7 (if you want to use Python2) -Install Visual Studio Community 2013 (if you want to use CUDA, Python3.4) -Install Visual Studio Community 2015 (if you want to use Python3.5) --Preparation of CUDA (optional) -Install CUDA Toolkit (7.5 is included in this article) -Install cuDNN (optional) --Chainer preparation --pip install chainer

What Python environment should I choose?

First, CUDA only supports 7.0 to 64bit. If you want to use Chainer + CUDA environment, please use ** Python 64bit version **. If you only have a CPU, either is fine. H5py, which has become a dependent package from Chainer 1.5, is a little troublesome to install on 64bit Python. Considering various other circumstances, it is best to use the 64-bit version of Python 2.7 of ** Anaconda **. Both Python 2.7 and 3.4 can be used, so please choose according to your preference (3.5 is unconfirmed by the author).

If you want to use standard Python, there seems to be a way to use the package distributed at here. In particular, in the case of ** 64bit and non-Anaconda environment, be sure to install h5py ** before installing Chainer.

Chainer operation on cygwin has not been confirmed so far ...

Compiler preparation

Those who want to have fun preparing the compiler can be a little happy with the Python 2 system ...

If you want to use Python 2.7

For Python 2.7, please install Microsoft Visual C ++ Compiler for Python 2.7. Python finds this compiler in the registry, so you don't need to set environment variables, etc.

If you want to use Python 3.4

The required version of Visual Studio differs depending on the version of Python3. However, if you have the new Visual Studio installed, you can work around this specification by setting environment variables. Here, prepare the same one in consideration of the trouble when installing CUDA. The compiler available for both is Visual Studio Community 2013. Microsoft sites change addresses from time to time, so look for broken links (or have a suitable compiler).

If you include VS2013 Community, you need to set environment variables. Run set VS100COMNTOOLS =% VS120COMNTOOLS% every time before pip install, or set an environment variable.

If you want to use Python3.5 (unconfirmed procedure)

Visual Studio Community 2015 is. Just install it and you're ready to go.

If you want to use CUDA (optional)

You need a Visual Studio compiler. If it is too new, CUDA's compiler nvcc will not work properly, so please refer to the manual and use the appropriate version. In this article, we will assume that you are using CUDA 7.5.

Please install Visual Studio Community 2013 as well as Python 3.4. Add C: \ Program Files (x86) \ Microsoft Visual Studio 12.0 \ VC \ bin to the environment variable PATH.

CUDA installation (optional)

It's a waste not to use CUDA because you use Chainer. Download and install the CUDA Toolkit from the NVIDIA site.

cuDNN (optional)

cuDNN is a library that can perform the calculations required for NN at high speed and with low memory. Let's install it. After registering as a user at cuDNN, you will be able to download it within a few days. If you want to use Chainer right now, skip this step. Please note that you will need to reinstall Chainer after installing ** cuDNN ** (pip install chainer after pip unisntall chainer).

If you have successfully downloaded cuDNN, overwrite the extracted files with C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v7.5. For cuDNNv3, cudnn64_70.dll is in the CUDA \ v7.5 \ bin folder, cudnn.h is in the CUDA \ v7.5 \ include folder, and cudnn.lib is in the CUDA \ v7. It's okay if it's in 5 \ lib \ x64.

Confirmation of CUDA

Launch the command line and see if you can use the nvcc command.

Install Chainer

Now let's install Chainer. pip install chainer If you cannot install or if various modules cannot be installed correctly, use the commands below. pip install -U chainer -vvvv

In addition, it has been confirmed that infinite loops occur when cython, pip, and setuptools are old. Try updating those libraries to the latest version.

Confirmation method

Execute the following command and check if import can be done without error. --python -c "import chainer" Chainer test --python -c "import cupy" CUDA test (optional) --python -c "import cupy.cudnn" cuDNN test (optional)

If the cupy import fails, try the following test again. -- nvcc Test if nvcc can be executed

If you want to check if the installation is correct, run pip uninstall chainer multiple times until the chainer is gone, and then Please install with pip install --no-cache -vvvv chainer with cache disabled and debug display enabled. If there is a problem with the installation, you should see an error log.

Other notes

** chainer-cuda-deps is no longer needed. Please do not install. ** **

References

-Is it possible to process natural language with chainer? Prepare the development environment with man windows -Unofficial tips for people who have trouble installing Chainer 1.5 -Install Chainer 1.5.0 on Windows

Recommended Posts

The easiest way to get Chainer v1.5 + CUDA + cuDNN on Windows
How to update to Chainer 2.0 (Windows + CUDA 8.0 + CUDNN)
The easiest way to get started with Django
The easiest way to try PyQtGraph
The easiest way to get started in Slack socket mode (Go)
The easiest way to synthesize speech with python
Install the latest Cuda + CuDNN on Ubuntu 18.04 @ Spring 2020
The easiest way to use OpenCV with python
Introduction to Python with Atom (on the way)
Steps to build PyTorch 1.5 for CUDA 10.2 on Windows
The easiest way to set up Last-Modified in Flask
Install Chainer 1.5.0 on Windows
Let's Deep Learning on Windows! (VS2013 + caffe + CUDA7.5 + cudnn5.1)
Notes on the version of CUDA, cuDNN where tensorflow-gpu worked
Memo to get the value on the html-javascript side with jupyter
Probably the easiest way to create a pdf with Python3
How to deploy the easiest python textbook pybot on Heroku
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
Migrating from Chainer v1 to Chainer v2
Prepare Chainer environment on Windows
Install Chainer 1.6 (GPU) on Windows 7.
[Python] [Chainer] [Windows] Install Chainer on Windows
Build a Chainer environment using CUDA and cuDNN on a p2 instance
The day Chainer runs on GPU CentOS edition (up to CPU)
The simplest way to build a Spleeter usage environment using Windows
I tried to get started with Bitcoin Systre on the weekend
The fastest way to get camera images regularly with python opencv
Python 3.6 on Windows ... and to Xamarin.
How to use Dataiku on Windows
Install CUDA 8.0 and Chainer on Ubuntu 16.04
How to install pycrypto on Windows
How to deploy django-compressor on Windows
How to get the Python version
The fastest way to try EfficientNet
How to install music 21 on windows
Matching karaoke keys ~ I tried to put it on Laravel ~ <on the way>
What to do if the Chainer (Windows) sample mnist terminates with WinError 183.