Notes on Ubuntu (Linux) computing

Brief notes on installation, setup and other tasks in the Ubuntu world

Python setup

leave a comment »

Ubuntu 12.04 comes with python 2.7.3 already installed by default. You can test your exact version using the following command at the terminal:

python --version

In general, there are many ways to install python packages in Ubuntu. I will mainly consider two: (1) use apt-get to install packages in the Ubuntu repositories and (2) manually install by downloading the code. Usually, I will use repository versions unless I really need a current version of the package. In any case, I will separate package installation instructions, based on the methods I use to install.

Repository installs using apt-get

  • cython
     sudo apt-get install cython
     
  • distutils
     sudo apt-get install python-distutils-extra
     
  • matplotlib — also installs numpy
     sudo apt-get install python-matplotlib
     
  • nose
     sudo apt-get install python-nose
     
  • pydot — also installs graphviz as a dependency
     sudo apt-get install python-pydot
     
  • python-dev
     sudo apt-get install python-dev
     
  • scientific
     sudo apt-get install python-scientific
     
  • scipy
     sudo apt-get install python-scipy
     
  • swig
     sudo apt-get install swig
     

Manual installs (from source)

  • networkx
    • networkx does their version control with git
    • Move to directory where you want to download code. For example,
          cd ~/gitLocal
          
    • Clone the repository
          git clone git://github.com/networkx/networkx.git
          
    • Change to main directory and install
          cd networkx/
          sudo python setup.py install
          
  • pygraphviz
    • Make sure that libgraphviz-dev is installed
          sudo apt-get install libgraphviz-dev
          
    • python-dev and swig are also needed — see above for install information
    • This project does version control with svn
    • Move to directory where you want to download code. For example,
          cd ~/svnLocal
          
    • Checkout the repository
          svn checkout http://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz
          
    • Change to main directory
          cd pygraphviz/
          
    • ** I had to update setup.py file so that library_path and include_path were correct. Look for lines to uncomment (library_path and include_path are commented out by default):
         # Linux, generic UNIX
         library_path='/usr/lib/graphviz'
         include_path='/usr/include/graphviz'
         
    • ** You can check if these are the correct paths by looking at the output of the following command:
         whereis graphviz
         
    • Finally, install:
         sudo python setup.py install
         
  • CMPy
    • CMPy is a python package for Computational Mechanics, as developed in Jim Crutchfield’s group. At this point, access to the code is limited to users with ssh-keys on file.
    • This project uses git for version control.
    • Move to directory where you want to download code. For example,
          cd ~/gitLocal
          
    • Clone the repository (this will only work if you have ssh-key on file — no anonymous)
          git clone git@vcs.cse.ucdavis.edu:cmpy.git
          
    • Change to main directory
          cd cmpy
          
    • Finally, install using cython switch
          sudo python setup.py install --cython
          
  • PyMC — a nice MCMC package for Bayesian inference using python.

This is an active post — I will update as I install/modify my Python setup in Ubuntu 12.04 LTS.

Advertisements

Written by Chris S

October 9, 2012 at 12:07 am

Posted in Python, Ubuntu 12.04

Tagged with , ,

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: