Theano
Windows Installation Instructions
Warning
If you want to install the bleeding-edge or development version of Theano from GitHub, please make sure you are reading the latest version of this page.
Requirements
Note
We only support the installation of the requirements through conda.
Python == 2.7* or ( >= 3.4 and < 3.6 )
The conda distribution is highly recommended. Python 2.4 was supported up to and including the release 0.6. Python 2.6 was supported up to and including the release 0.8.2. Python 3.3 was supported up to and including release 0.9.
NumPy >= 1.9.1 <= 1.12
Earlier versions could work, but we don’t test it.
SciPy >= 0.14 < 0.17.1
Only currently required for sparse matrix and special functions support, but highly recommended. SciPy >=0.8 could work, but earlier versions have known bugs with sparse matrices.
BLAS installation (with Level 3 functionality)
Recommended: MKL, which is free through Conda with mkl-service
package. Alternatively, we suggest to install OpenBLAS, with the development headers (-dev
, -devel
, depending on your Linux distribution).
Optional requirements
GCC compiler with g++
(version >= 4.2.*
), and Python development files
Highly recommended. Theano can fall back on a NumPy-based Python execution model, but a C compiler allows for vastly faster execution.
nose >= 1.3.0
Recommended, to run Theano’s test-suite.
Sphinx >= 0.5.1, pygments
For building the documentation. LaTeX and dvipng are also necessary for math to show up as images.
pydot-ng
To handle large picture for gif/images.
NVIDIA CUDA drivers and SDK
Highly recommended Required for GPU code generation/execution on NVIDIA gpus. See instruction below.
libgpuarray
Required for GPU/CPU code generation on CUDA and OpenCL devices (see: GpuArray Backend).
pycuda and skcuda
Required for some extra operations on the GPU like fft and solvers. We use them to wrap cufft and cusolver. Quick install pip install pycuda scikit-cuda
. For cuda 8, the dev version of skcuda (will be released as 0.5.2) is needed for cusolver: pip install pycuda; pip install git+https://github.com/lebedov/scikit-cuda.git#egg=scikit-cuda
.
warp-ctc
Required for Theano CTC implementation. It is faster then using an equivalent graph of Theano ops.
Requirements installation through Conda (recommended)
Install Miniconda
Follow this link to install Miniconda.
Note
If you want fast compiled code (recommended), make sure you have g++
installed.
Install requirements and optional packages
conda install numpy scipy mkl-service libpython <m2w64-toolchain> <nose> <sphinx> <pydot-ng> <git>
Note
Arguments between <…> are optional. m2w64-toolchain
package provides a fully-compatible version of GCC and is then highly recommended. git
package installs git source control through conda, which is required for the development versions of Theano and libgpuarray
Package parameterized
is also optional but may be required for unit testing. It is available via pip
.
pip install parameterized
Install and configure the GPU drivers (recommended)
Warning
OpenCL support is still minimal for now.
Install CUDA drivers
Follow this link to install the CUDA driver and the CUDA Toolkit.
You must reboot the computer after the driver installation.
Installation
Stable Installation
With conda
If you use conda, you can directly install both theano and pygpu. Libgpuarray will be automatically installed as a dependency of pygpu.
conda install theano pygpu
Warning
Latest conda packages for theano (>= 0.9
) and pygpu (>= 0.6*
) currently don’t support Python 3.4 branch.
With pip
If you use pip, you have to install Theano and libgpuarray separately.
theano
Install the latest stable version of Theano with:
<sudo> pip install <--user> Theano[test, doc]
Any argument between <…> is optional. Use sudo for a root installation. Use user for a user installation without admin rights. It will install Theano in your local site-packages. [test] will install the requirements for testing. [doc] will install the requirements in order to generate the documentation.
If you encountered any trouble, head to the Troubleshooting page.
The latest stable version of Theano is 0.9.0
(tagged with rel-0.9.0
).
libgpuarray
For the stable version of Theano you need a specific version of libgpuarray, that has been tagged v0.6.9
. Download it with:
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
git checkout tags/v0.6.5 -b v0.6.9
and then follow the Step-by-step instructions.
Bleeding-Edge Installation (recommended)
Install the latest, bleeding-edge, development version of Theano with:
<sudo> pip install <--user> <--no-deps> git+https://github.com/Theano/Theano.git#egg=Theano
Any argument between <…> is optional. Use sudo for a root installation. Use user for a user installation without admin rights. It will install Theano in your local site-packages. Use no-deps when you don’t want the dependencies of Theano to be installed through pip. This is important when they have already been installed as system packages.
If you encountered any trouble, head to the Troubleshooting page.
libgpuarray
Install the latest, development version of libgpuarray following the Step-by-step instructions.
Note
Currently, you need libgpuarray
version 0.7.1
that is not in conda default channel. But you can install it with our own channel mila-udem
(that support only Python 2.7 and 3.5):
conda install -c mila-udem pygpu
Developer Installation
Install the developer version of Theano with:
git clone git://github.com/Theano/Theano.git
cd Theano
<sudo> pip install <--user> <--no-deps> -e .
Any argument between <…> is optional. Use sudo for a root installation. Use user for a user installation without admin rights. It will install Theano in your local site-packages. Use no-deps when you don’t want the dependencies of Theano to be installed through pip. This is important when they have already been installed as system packages. -e makes your installation editable, i.e., it links it to your source directory.
If you encountered any trouble, head to the Troubleshooting page.
libgpuarray
See instructions for bleeding-edge installation about libgpuarray
.
Instructions for other Python distributions (not recommended)
If you plan to use Theano with other Python distributions, these are generic guidelines to get a working environment:
Look for the mandatory requirements in the package manager’s repositories of your distribution. Many distributions come with pip
package manager which use PyPI repository. The required modules are Python (of course), NumPy, SciPy and a BLAS implementation (MKL or OpenBLAS). Use the versions recommended at the top of this documentation. If the package manager provide a GCC compiler with the recommended version (see at top), install it. If not, you could use the build TDM GCC which is provided for both 32- and 64-bit platforms. A few caveats to watch for during installation:
Install to a directory without spaces (we have placed it in C:\SciSoft\TDM-GCC-64
)If you don’t want to clutter your system PATH un-check add to path
option. Enable OpenMP support by checking the option openmp support option
.
Install CUDA with the same instructions as above. Install the latest, development version of libgpuarray following the Step-by-step instructions.