Preparing for the Pylearn2 primer

In preparation for the lecture given on Thursday, January 22, 2015, those who would like to follow along should install Pylearn2 on their machine. Complete installation instructions can be found on Pylearn2’s online documentation.

We will cover how to install Pylearn2 on a machine which already meets the requirements. For information on how to install prerequisites, refer to your platform-specific documentation.


  • Theano (bleeding-edge installation) and its dependencies
  • PyYAML
  • PIL (for some image-related functionalities
  • setuptools or distribute

Installation instructions

These instructions will work on a Linux or Mac OS machine when typed in a bash shell. You may need to adapt the commands to your environment.

  1. Change directory to where you’d like the Pylearn2 codebase to reside (the directory you chose for your Theano installation is not a bad idea).
  2. Run
    git clone git://
  3. Change directory inside the Pylearn2 directory and type
    python develop --user

    This will ensure that the Pylearn2 repository you just checked out will be found by the Python interpreter. Every change in the Pylearn2 repository is now automatically present when you import the pylearn2 module without you needing to reinstall anything. The command “installs” Pylearn2 locally; if you’d prefer to have a global installation, remove the –user flag (some sudo’ing legwork may be required in that case).

  4. To confirm that everything works fine, make sure you’re outside of the Pylearn2 directory, launch a Python interpreter and type
    import pylearn2

    If you see no error, the installation was successful!

Keeping things up to date

Pylearn2 is regularly updated. In order to get the latest changes, simply run

git pull origin master

inside the Pylearn2 directory.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s