Installing Python and IPython

Note

As of April 2013, this version of the documentation is no longer maintained; however, it is consistent with the last (now retired) version of CODAS processing that used Matlab. We no longer update or fix the Matlab processing code, but we will maintain the Matlab code that reads CODAS Matlab output. Although the notes refer to both Python and Matlab processing, none of the code here will be maintained. This (now retired) documentation and code will remain available for awhile longer.

Python processing code is actively maintained and developed, and CODAS Python processing is documented here.

Python runs the program quick_adcp.py, which drives all the processing steps. We strongly recommend you also install IPython, in case you want to run or test anything on a Python command line. IPython provides an interactive shell with tab completion, Python help, and (if you have matplotlib installed) allows loading and plotting of data.

Python

We recommend that you get Python from www.python.org if that is possible for your operating system. If you plan to install everything up through matplotlib, please take a look at this section and see how your operating system affects which Python you install. If you install the wrong one, you have to start over.

Version 2.6.x or 2.7.x should work fine. We will not be able to use 3.x for another year or two.

Python notes for various systems:

  • Linux : you probably already have it; typical Linux distributions install it by default, and most that do not install it automatically at least include it as an option. Check the version to see if it will work with CODAS programs; install something compatible if needed.

  • Solaris or Irix, then it may be up to your sysadmin to install Python.

  • OSX: Leopard, Snow Leopard, Lion... There are alot of variables. We don’t have a sufficient number of new Macs to test from-scratch installations, so these instructions are based on the experience we do have. Please read before proceeding.

  • Windows:

    You need to do three things:

    1. You need the basic Python installation.
    1. Check your PATH:

      (Control Panel : System: Advanced : Environment Variables)

      Make sure “python.exe” is on your PATH, e.g. if installation was in C:\Python26 you should add the following element to your PATH:

      ;C:\Python26

      You should also add ;C:\Python26\scripts (these entries are separated by ; (semicolon))

    2. You need pywin32 to enable our python code to be able to start the Matlab engine. If you are going to skip Matlab processing, you may skip this also.

    • Go to http://sourceforge.net/projects/pywin32
    • click “Browse all files”
    • click “pywin32”
    • click the top build folder (eg. Build216”)
    • click on the EXE file that matches your Python, eg pywin32-216.win32-py2.6.exe

An alternative way to install Python, IPython, etc. is via EPD, the Enthought Python Distribution. We have tested this lightly, only on Windows 7, and only with the 32-bit version. Some of the following instructions are Windows-specific:

  • You need access to the Full version, which you can get for a modest subscription charge, or at no cost if if you meet the criteria for an academic license.
  • In addition to Python itself, you should use it to install numpy, matplotlib, ipython, basemap, scons, pywin32, and any other packages that it offers that you would like to use, such as scipy.
  • On Windows, you need to use it to install its mingw and libpython packages. Both of these are essential for compiling our Python extension code. They take the place of the gcc compiler installation for Windows described in Part 2: Compiling CODAS.

IPython

IPython is an extremely useful–no, essential–python shell providing interactive plotting with matplotlib and many other features. You can get it here. This will allow you to (for instance) get Python help on commands, examine CODAS variables, plot data, save figures... For Windows and OSX users, iPython has additional instructions for installing “readline”, which greatly improves the iPython experience (eg. tab completion). Version 0.11 or later is strongly preferred.