The easiest way to install Blocks is using the Python package manager
pip. Blocks isn’t listed yet on the Python Package Index (PyPI), so
you will have to grab it directly from GitHub.
$ pip install git+git://github.com/mila-udem/blocks.git \ -r https://raw.githubusercontent.com/mila-udem/blocks/master/requirements.txt
This will give you the cutting-edge development version. The latest stable
release is in the
stable branch and can be installed as follows.
$ pip install git+git://github.com/mila-udem/blocks.git@stable \ -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt
Blocks relies on several packages, such as Theano and picklable_itertools,
to be installed directly from GitHub. The only way of doing so reliably is
requirements.txt file, which is why this installation command
might look slightly different from what you’re used to.
Installing requirements from GitHub requires pip 1.5 or higher; you can
pip update pip.
If you don’t have administrative rights, add the
--user switch to the
install commands to install the packages in your home folder. If you want to
update Blocks, simply repeat the first command with the
added to pull the latest version from GitHub.
Pip may try to install or update NumPy and SciPy if they are not present or
outdated. However, pip’s versions might not be linked to an optimized BLAS
implementation. To prevent this from happening make sure you update NumPy
and SciPy using your system’s package manager (e.g.
yum), or use a Python distribution like Anaconda, before installing
Blocks. You can also pass the
--no-deps switch and install all the
If the installation crashes with
ImportError: No module named
numpy.distutils.core, install NumPy and try again again.
Blocks’ requirements are
- Theano, for pretty much everything
- PyYAML, to parse the configuration file
- six, to support both Python 2 and 3 with a single codebase
- Toolz, to add a bit of functional programming where it is needed
Bokeh is an optional requirement for if you want to use live plotting of your
training progress (part of
nose2 is an optional requirement, used to run the tests.
We develop using the bleeding-edge version of Theano, so be sure to follow the relevant installation instructions to make sure that your Theano version is up to date if you didn’t install it through Blocks.
If you want to work on Blocks’ development, your first step is to fork Blocks
on GitHub. You will now want to install your fork of Blocks in editable mode.
To install in your home directory, use the following command, replacing
with your own GitHub user name:
$ pip install -e firstname.lastname@example.org:USER/blocks.git#egg=blocks[test,docs] --src=$HOME \ -r https://raw.githubusercontent.com/mila-udem/blocks/master/requirements.txt
As with the usual installation, you can use
--no-deps if you
need to. You can now make changes in the
blocks directory created by pip,
push to your repository and make a pull request.
If you had already cloned the GitHub repository, you can use the following command from the folder you cloned Blocks to:
$ pip install -e file:.#egg=blocks[test,docs] -r requirements.txt