We recommend the following Linux distributions.
We are automatically testing Chainer on all the recommended environments above. We cannot guarantee that Chainer works on other environments including Windows and macOS (especially with CUDA support), even if Chainer may seem to be running correctly.
You need to have the following components to use Chainer.
Supported Versions: 2.7.6+, 3.5.1+, 3.6.0+ and 3.7.0+.
Supported Versions: 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16 and 1.17 (*).
NumPy will be installed automatically during the installation of Chainer.
Before installing Chainer, we recommend that you upgrade
$ pip install -U setuptools pip
Hardware Acceleration Support¶
You can accelerate performance of Chainer by installing the following optional components.
The following packages are optional dependencies. Chainer can be installed without them, in which case the corresponding features are not available.
We recommend to install Chainer via pip:
$ pip install chainer
Any optional dependencies (including CuPy) can be added after installing Chainer. Chainer automatically detects the available packages and enables/disables the optional features appropriately.
The tarball of the source tree is available via
pip download chainer or from the release notes page.
You can install Chainer from the tarball:
$ pip install chainer-x.x.x.tar.gz
You can also install the development version of Chainer from a cloned Git repository:
$ git clone https://github.com/chainer/chainer.git $ cd chainer $ pip install .
Enable CUDA/cuDNN support¶
In order to enable CUDA support, you have to install CuPy manually. If you also want to use cuDNN, you have to install CuPy with cuDNN support. See CuPy’s installation guide to install CuPy. Once CuPy is correctly set up, Chainer will automatically enable CUDA support.
You can refer to the following flags to confirm if CUDA/cuDNN support is actually available.
Trueif Chainer successfully imports
Trueif cuDNN support is available.
Use pip to uninstall Chainer:
$ pip uninstall chainer
When you upgrade Chainer,
pip sometimes install the new version without removing the old one in
In this case,
pip uninstall only removes the latest one.
To ensure that Chainer is completely removed, run the above command repeatedly until
pip returns an error.
$ pip install -U chainer
If you want to reinstall Chainer, please uninstall Chainer and then install it.
We recommend to use
--no-cache-dir option as
pip sometimes uses cache:
$ pip uninstall chainer $ pip install chainer --no-cache-dir
Run Chainer with Docker¶
We are providing the official Docker image. Use nvidia-docker command to run Chainer image with GPU. You can login to the environment with bash, and run the Python interpreter:
$ nvidia-docker run -it chainer/chainer /bin/bash
Or run the interpreter directly:
$ nvidia-docker run -it chainer/chainer /usr/bin/python
Warning message “cuDNN is not enabled” appears¶
You failed to build CuPy with cuDNN.
If you don’t need cuDNN, ignore this message.
Otherwise, retry to install CuPy with cuDNN.
pip install -vvvv option helps you.
There is no need of re-installing Chainer itself.
See CuPy’s installation guide for more details.
CuPy always raises
See FAQ section of CuPy’s installation guide for details.
h5py installation failed¶
If the installation failed with error saying
hdf5.h is not found, you need to install
The way to install it depends on your environment:
# Ubuntu 14.04/16.04 $ apt-get install libhdf5-dev # CentOS 7 $ yum -y install epel-release $ yum install hdf5-devel
h5py is not required unless you need HDF5 serialization support.