Python Installation Instructions

From Course 6.867

Jump to: navigation, search
  • We will be supporting the Enthought Python Distribution (EPD), more specifically EPDFree 7.1, their lightweight and gratis distribution. EPDFree comes with Python 2.7.2, as well as packages that you will be using frequently, including NumPy, SciPy, and Matplotlib.
  • You will also need to get CVXOPT, a convex optimization package for Python.
  • The Windows and Mac OS X installers for EPDFree are designed for 32-bit architectures, although they should run fine on 64-bit systems. If you encounter problems using it, you can consider getting the full EPD distribution for your system. Academic downloads for EPD are also gratis.
  • On all systems, to check whether the installation ran correctly:
    • Execute the Python interpreter from the command line. There should be some header info that displays before you can issue any commands. If the header contains anything related to "Enthought Python Distribution" then you have installed EPD correctly.
    • In the EPD interpreter, try the command:
      import cvxopt
      If it executes without error, then CVXOPT is installed correctly on EPD. Congratulations!


Windows

  • Uninstall all previously installed Python versions (optional but will make things much easier)
  • Download and install EPD Free 7.1 EPD Download
  • Download and install CVXOPT CVXOPT Download (This toolkit will automatically locate your Python path in the registry)


Mac OS X

  • This instruction applies to Mac OS X 10.6 or above.
  • Download and install EPD: EPD Download
  • CVXOPT needs Xcode (of version above 3.2) to build and install. If you have not had Xcode of appropriate version in your system, do the following
    • If you are using Mac OS X 10.6 (Snow Leopard): Download Xcode 3.2.x from Mac Developer Center, and then install it.
      • To make sure you have upgraded to the latest version of Xcode, check the version of gcc, and it should be 4.2.x.
    • If you are using Mac OS X 10.7 (Lion): Download and install Xcode 4.x from Mac AppStore.
      • you will need to manually install gcc. Open Xcode 4.4 >> Xcode menu >> Preferences >> Downloads >> Command line tool >> click Install
  • Download the CVXOPT source code (for Python 2.5+) CVXOPT Download
  • Unpack the download file, and navigate to the src folder. Enter the following command in your terminal:
    sudo python setup.py install

Linux (Ubuntu & CSAIL Debian; other distros similar)

  • Download and install EPD: EPD Download
    • Note that there are different versions for 32-bit and 64-bit systems.
    • Remember to
      chmod +x
      the file, and execute it (with sufficient permissions, e.g., may need sudo) to install EPDFree.
    • You may want to prepend the path to the bin folder where you installed EPDFree to your $PATH variable so that calling "python" executes the EPDFree version (instead of other existing versions).
  • CVXOPT needs the BLAS/LAPACK libraries to build and install.
    • See if you can find the libraries libblas.so, liblapack.so in your libraries directory (e.g., /usr/lib). If so, you may be able to skip this step.
    • Acquire BLAS and LAPACK:
      sudo apt-get install liblapack-dev
  • Download the CVXOPT source code (for Python 2.5+) CVXOPT Download
  • Unpack the download file, and navigate to the src folder within. Execute:
    sudo python setup.py install
    You may need to substitute "python" with the full path to the EPDFree Python executable. Note that this command will only install CVXOPT for the distribution corresponding to the specified Python executable.
Personal tools