wiki:ChimeraPyPackages

Version 4 (modified by Darren Weber, 15 years ago) ( diff )

--

Installing Chimera and Python Packages for Chimera Development

This page contains an example of a user installation of Chimera and additional configuration options to create a virtual python environment for development with Chimera. The Chimera distribution currently ships with a custom build of python2.7 (as of Aug, 2010). This custom python installation may not be compatible with any other installations of python on the system (including any site-packages in other python installations). The following examples provide a tidy way to access and add new packages in a virtual environment derived from the Chimera python installation. Also, see additional tips on Chimera development with virtualenv, eclipse-PyDev, and spyder.

Installing Chimera

Get a stable release or a daily build of Chimera. In the examples below, it was a daily build for a linux 64-bit system (dated 2010-08-24). To run the installation, without superuser privileges:

cd ~/Downloads/
chmod +x chimera-alpha-linux_x86_64.exe
mkdir -p $HOME/src
./chimera-alpha-linux_x86_64.exe

Here's an example of the interactive prompts and replies:

UnZipSFX 5.41 of 16 April 2000, by Info-ZIP (Zip-Bugs@lists.wku.edu).
Original path: '/home/dweber/Downloads'
  inflating: chimera_install_35bPbx/installer  
  inflating: chimera_install_35bPbx/chimera.exe  

Enter install location: $HOME/src/Chimera64-daily 
Extracting files.  This may take a few minutes.
Executing command: './chimera.exe -q -d /home/dweber/src/Chimera64-daily'
UnZipSFX 5.52 of 28 February 2005, by Info-ZIP (http://www.info-zip.org).

Install desktop menu and icon? yes

To install desktop menu and icon, run:

    $HOME/src/Chimera64-daily/bin/xdg-setup install

If run as root, then it installs for all users,
otherwise it installs just for the current user.

Install symbolic link to chimera for command line use in which directory?
    0 -- no link
    1 -- /usr/local/sbin
    2 -- /usr/local/bin
    3 -- /usr/sbin
    4 -- /usr/bin
    5 -- /sbin
    6 -- /bin
    7 -- /usr/games
[hit Enter for default (0)]: 

This installation did not use sudo privileges, so the install path was changed from /opt/UCSF/Chimera64-2010-08-05 to $HOME/src/Chimera64-daily. To install the desktop menu and icons:

$HOME/src/Chimera64-daily/bin/xdg-setup install

Lastly, a few environment variables are set to simplify executing the new installation programs. If your installation path is different, you will need to set the CHIMERA environment variable to your path. The CHIMERA path must point to a hard-link, not a sym-link, in the directory tree. Warning: do not set these environment variables for daily work with Chimera, they are to be set for a shell session that is only required during installation of additional python packages into the Chimera distribution of python.

# For a daily build, use:
export CHIMERA=$($HOME/src/Chimera64-daily/bin/chimera --root)
# For an svn-build, use: 
#export CHIMERA=$($HOME/src/Chimera64-svn/bin/chimera --root)
export PATH=${CHIMERA}/bin:${PATH} 
export LD_LIBRARY_PATH=${CHIMERA}/lib

Adding python distribution tools to the Chimera installation

Now get the distribute or the setuptools package installed into the Chimera python installation. Note the following has some version specific details that need attention for any current installation. At the time of writing (Aug, 2010), this installation used a specific daily-build of Chimera (2010-08-24) and a specific version of setuptools for the version of python that was built for Chimera (python2.7).

Option A: to use distribute, try the following:

cd ~/Downloads
curl -O http://python-distribute.org/distribute_setup.py
${CHIMERA}/bin/python2.7 distribute_setup.py

Option B: to use setuptools, try the following:

cd ~/Downloads
curl -O http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=$CHIMERA

Now it's easy to use these tools for installation of any additional python packages into the Chimera python distribution. For example,

export CHIMERA=$($HOME/src/Chimera64-daily/bin/chimera --root)
export PATH=${CHIMERA}/bin/:${PATH} 
export LD_LIBRARY_PATH=${CHIMERA}/lib
${CHIMERA}/bin/easy_install pylint
${CHIMERA}/bin/easy_install pyflakes

A bash script to install setup tools and virtualenv

Save this bash script into a location on your path (e.g., ${HOME}/bin) and it can be called to install the distribute and virtualenv packages into the Chimera installation of your choice. There is one command line argument, the full path to your Chimera installation.

#!/bin/bash

# Default Chimera install path
CHIMERA="${HOME}/src/Chimera64-daily"
# Optional input parameter for Chimera install path
if [ $1 ]; then
	CHIMERA=$1
fi
# Test the existence of the $CHIMERA install path
if [ -d $CHIMERA ]; then
	echo "Chimera install path: ${CHIMERA}"
else
	echo "Invalid Chimera install path: ${CHIMERA}"
	exit 1
fi
export LD_LIBRARY_PATH=${CHIMERA}/lib
export PATH=${CHIMERA}/bin:${PATH}
mkdir -p ~/Downloads/
cd ~/Downloads/
rm -rf distribute*
curl -O http://python-distribute.org/distribute_setup.py
${CHIMERA}/bin/python2.7 distribute_setup.py 
${CHIMERA}/bin/easy_install pip
# Install optional packages
# readline requires libncurses
#sudo apt-get install ncurses-base ncurses-bin
#sudo apt-get install libncurses5-dev libncurses5-dbg 
#sudo apt-get install libncursesw5-dev libncursesw5-dbg 
# the ipython-readline support might not work with pip
${CHIMERA}/bin/easy_install readline ipython
${CHIMERA}/bin/pip install --upgrade bpython
${CHIMERA}/bin/pip install --upgrade pylint
${CHIMERA}/bin/pip install --upgrade pyflakes
${CHIMERA}/bin/pip install --upgrade rpyc
# Add Biopython
#${CHIMERA}/bin/pip install --upgrade biopython
${CHIMERA}/bin/easy_install -f http://biopython.org/DIST/ biopython
# Create a virtualenv 
${CHIMERA}/bin/easy_install virtualenv
${CHIMERA}/bin/virtualenv --clear --distribute "${CHIMERA}-virtualenv"
exit
Note: See TracWiki for help on using the wiki.