| 4 | | 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 [wiki:ChimeraEclipse eclipse-PyDev] and [wiki:ChimeraSpyder spyder]. |
| 5 | | |
| 6 | | === Installing Chimera === |
| 7 | | |
| 8 | | Get a stable release or a [http://www.cgl.ucsf.edu/chimera/download.html#daily 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: |
| 9 | | |
| 10 | | {{{ |
| 11 | | cd ~/Downloads/ |
| 12 | | chmod +x chimera-alpha-linux_x86_64.exe |
| 13 | | mkdir -p $HOME/src |
| 14 | | ./chimera-alpha-linux_x86_64.exe |
| 15 | | }}} |
| 16 | | |
| 17 | | Here's an example of the interactive prompts and replies: |
| 18 | | {{{ |
| 19 | | UnZipSFX 5.41 of 16 April 2000, by Info-ZIP (Zip-Bugs@lists.wku.edu). |
| 20 | | Original path: '/home/dweber/Downloads' |
| 21 | | inflating: chimera_install_35bPbx/installer |
| 22 | | inflating: chimera_install_35bPbx/chimera.exe |
| 23 | | |
| 24 | | Enter install location: $HOME/src/Chimera64-daily |
| 25 | | Extracting files. This may take a few minutes. |
| 26 | | Executing command: './chimera.exe -q -d /home/dweber/src/Chimera64-daily' |
| 27 | | UnZipSFX 5.52 of 28 February 2005, by Info-ZIP (http://www.info-zip.org). |
| 28 | | |
| 29 | | Install desktop menu and icon? yes |
| 30 | | |
| 31 | | To install desktop menu and icon, run: |
| 32 | | |
| 33 | | $HOME/src/Chimera64-daily/bin/xdg-setup install |
| 34 | | |
| 35 | | If run as root, then it installs for all users, |
| 36 | | otherwise it installs just for the current user. |
| 37 | | |
| 38 | | Install symbolic link to chimera for command line use in which directory? |
| 39 | | 0 -- no link |
| 40 | | 1 -- /usr/local/sbin |
| 41 | | 2 -- /usr/local/bin |
| 42 | | 3 -- /usr/sbin |
| 43 | | 4 -- /usr/bin |
| 44 | | 5 -- /sbin |
| 45 | | 6 -- /bin |
| 46 | | 7 -- /usr/games |
| 47 | | [hit Enter for default (0)]: |
| 48 | | }}} |
| 49 | | |
| 50 | | 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: |
| 51 | | {{{ |
| 52 | | $HOME/src/Chimera64-daily/bin/xdg-setup install |
| 53 | | }}} |
| 54 | | |
| 55 | | 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.''' |
| 56 | | {{{ |
| 57 | | # For a daily build, use: |
| 58 | | export CHIMERA=$($HOME/src/Chimera64-daily/bin/chimera --root) |
| 59 | | # For an svn-build, use: |
| 60 | | #export CHIMERA=$($HOME/src/Chimera64-svn/bin/chimera --root) |
| 61 | | export PATH=${CHIMERA}/bin/${PATH} |
| 62 | | export LD_LIBRARY_PATH=${CHIMERA}/lib |
| 63 | | }}} |
| 64 | | |
| 65 | | === Adding python distribution tools to the Chimera installation === |
| 66 | | |
| 67 | | Now get the [http://pypi.python.org/pypi/distribute distribute] or the [http://pypi.python.org/pypi/setuptools 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). |
| 68 | | |
| 69 | | Option A: to use [http://pypi.python.org/pypi/distribute distribute], try the following: |
| 70 | | {{{ |
| 71 | | cd ~/Downloads |
| 72 | | curl -O http://python-distribute.org/distribute_setup.py |
| 73 | | ${CHIMERA}/bin/python2.7 distribute_setup.py |
| 74 | | }}} |
| 75 | | |
| 76 | | Option B: to use [http://pypi.python.org/pypi/setuptools setuptools], try the following: |
| 77 | | {{{ |
| 78 | | cd ~/Downloads |
| 79 | | curl -O http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg |
| 80 | | sh setuptools-0.6c11-py2.7.egg --prefix=$CHIMERA |
| 81 | | }}} |
| 82 | | |
| 83 | | Now it's easy to use these tools for installation of any additional python packages into the Chimera python distribution. For example, |
| 84 | | {{{ |
| 85 | | export CHIMERA=$($HOME/src/Chimera64-daily/bin/chimera --root) |
| 86 | | export PATH=${CHIMERA}/bin/:${PATH} |
| 87 | | export LD_LIBRARY_PATH=${CHIMERA}/lib |
| 88 | | ${CHIMERA}/bin/easy_install pylint |
| 89 | | ${CHIMERA}/bin/easy_install pyflakes |
| 90 | | }}} |
| 91 | | |
| 92 | | === A bash script to install setup tools and virtualenv === |
| 93 | | |
| 94 | | 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. |
| 95 | | |
| 96 | | {{{ |
| 97 | | #!/bin/bash |
| 98 | | # Default Chimera install path |
| 99 | | CHIMERA="${HOME}/src/Chimera64-daily" |
| 100 | | # Optional input parameter for Chimera install path |
| 101 | | if [ $1 ]; then |
| 102 | | CHIMERA=$1 |
| 103 | | fi |
| 104 | | # Test the existence of the $CHIMERA install path |
| 105 | | if [ -d $CHIMERA ]; then |
| 106 | | echo "Chimera install path: ${CHIMERA}" |
| 107 | | else |
| 108 | | echo "Invalid Chimera install path: ${CHIMERA}" |
| 109 | | exit 1 |
| 110 | | fi |
| 111 | | export LD_LIBRARY_PATH=${CHIMERA}/lib |
| 112 | | export PATH=${CHIMERA}/bin:${PATH} |
| 113 | | mkdir -p ~/Downloads/ |
| 114 | | cd ~/Downloads/ |
| 115 | | rm -rf distribute* |
| 116 | | curl -O http://python-distribute.org/distribute_setup.py |
| 117 | | ${CHIMERA}/bin/python2.7 distribute_setup.py |
| 118 | | ${CHIMERA}/bin/easy_install virtualenv |
| 119 | | }}} |
| 120 | | |
| 121 | | |
| 122 | | === Using virtualenv === |
| 123 | | |
| 124 | | Adding additional packages to the Chimera python distribution is now possible and a great way to do this, while preserving the state of the Chimera distribution, is to use [http://pypi.python.org/pypi/virtualenv virtualenv]. First, add the {{{virtualenv}}} package into the Chimera python installation, like so: |
| | 4 | Adding additional packages to the Chimera python distribution is possible and a great way to do this, while preserving the state of the Chimera distribution, is to use [http://pypi.python.org/pypi/virtualenv virtualenv]. First, add the {{{virtualenv}}} package into the Chimera python installation, like so: |