Installing the Enthought Python Distribution with OpenCV and Theano

This post describes how to setup the Enthought Python Distribution (ETD) without the need for root privileges in a Debian-based Linux distribution (tested on Debian unstable and Ubuntu 10.04).
This is an easy way to get a working Python environment without having to deal with dependencies and out-dated packages in the repositories.

Also we’re going to compile OpenCV and add its Python bindings to our ETD environment.

Enthought Python Distribution (EPD)

There is a free release of the Enthought Python Distribution , but since I have access to the academic version (available to “students and staff at degree-granting institutions”), which ships with a lot of additional packages useful for scientific computing, I’ve never tried it and can’t say whether additional steps need to be taken.

After downloading a copy of EPD, you can install it by running the following command from the download directory (adjust the filename for different versions).

$ ./

After accepting the license terms, the installer will ask for the install path, which I’ve set to $HOME/.local/epd-7.3-2-rh5-x86_64. Then it starts some tests and compiles the Python modules.
When it is finished, the following lines need to be added to ~/.bashrc. If you didn’t use $HOME/.local/epd-7.3-2-rh5-x86_64 as install path, you have to adjust the EPDPATH line accordingly.

export EPDPATH=$HOME/.local/epd-7.3-2-rh5-x86_64
# prepend the EPD bin dir to your path to make your shell prefer the EPD python interpreter to the system python interpreter
export PATH=$EPDPATH/bin:$PATH
# also the python packages should be searched in the correct location
export PYTHONPATH=$EPDPATH/lib/python2.7/site-packages

After saving and closing ~/.bashrc type the following command, so the environment variables are set correctly for the OpenCV installation

source ~/.bashrc


Download the latest release of OpenCV from

Extract the downloaded archive:

tar xjfv OpenCV-2.4.3.tar.bz2
cd OpenCV-2.4.3

Now run cmake from a newly created build directory. You have to specify some flags so the Python bindings will later be built and installed for your installation of EPD. (Jan 11th 2013: fixed the cmake command, PYTHON_INCLUDE_DIR:PATH flag should be set to $EPDPATH/include/python2.7 not $EPDPATH/include/python)

mkdir build
cd build

If there are no error messages, you should now be able to run

make install

to build and install OpenCV

If all went well, the following two commands should display the location of the python executable inside your install directory and the OpenCV version and location of the cv2 module

python --version
python -c "import cv2;print 'OpenCV version: {0} (module file: {1})'.format(cv2.__version__, cv2.__file__)"


To add the Theano package to your EPD environment, first install pip, a tool to install packages from the Python Package Index:

easy_install pip

and then run

pip install Theano

One thought on “Installing the Enthought Python Distribution with OpenCV and Theano

  1. cloudlife (@cloudlife)

    do you know how these commands would change if you were to install this on a Mac system instead? I’m trying to install opencv via cmake into enthought python distribution. but I’m getting this error at 95% into the “make” command:
    Total time: 2 seconds
    [ 94%] Built target opencv_test_java
    [ 94%] Generating pyopencv_generated_funcs.h, pyopencv_generated_func_tab.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_const_reg.h
    Note: Class Feature2D has more than 1 base class (not supported by Python C extensions)
    Bases: cv::FeatureDetector, cv::DescriptorExtractor
    Only the first base class will be used
    [ 94%] Generating generated0.i
    Generated 377 functions
    Scanning dependencies of target opencv_python
    [ 95%] Building CXX object modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o
    make[2]: *** No rule to make target `/Library/Frameworks/EPD64.framework/Versions/Current/lib/’, needed by `lib/’. Stop.
    make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
    make: *** [all] Error 2

    Any help would be greatly appreciated and would also help a lot of other people, since installing opencv is a common problem.


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s