| 2 | | == Installing a Python Virtual Environment for Chimera == |
| 3 | | |
| 4 | | Get a [http://www.cgl.ucsf.edu/chimera/download.html#daily daily build of Chimera]. In the examples below, it was a linux 64-bit build from 2010-08-05. To run the installation (accept all the defaults in the prompts): |
| 5 | | |
| 6 | | {{{ |
| 7 | | $ cd ~/Downloads/ |
| 8 | | $ chmod +x chimera-alpha-linux_x86_64.exe |
| 9 | | $ sudo chimera-alpha-linux_x86_64.exe |
| 10 | | }}} |
| 11 | | |
| 12 | | This installation used sudo privileges to install into the default path, {{{/opt/UCSF/Chimera64-2010-08-05}}}. If you don't have sudo priviledges, install to an alternative path where you have write permissions. I like to have it install symlinks into |
| 13 | | {{{ |
| 14 | | $ ls -al /usr/local/bin/chimera* |
| 15 | | lrwxrwxrwx 2 root root 42 2010-08-24 14:45 /usr/local/bin/chimera -> /opt/UCSF/Chimera64-2010-08-05/bin/chimera |
| 16 | | lrwxrwxrwx 1 root root 42 2010-08-05 14:53 /usr/local/bin/chimera-2010-08-05 -> /opt/UCSF/Chimera64-2010-08-05/bin/chimera |
| 17 | | }}} |
| 18 | | |
| 19 | | In the following notes, 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. |
| 20 | | {{{ |
| 21 | | $ export CHIMERA=/opt/UCSF/Chimera64-2010-08-05 |
| 22 | | $ export PATH=$PATH:$CHIMERA/bin/ |
| 23 | | $ export LD_LIBRARY_PATH=$CHIMERA/lib |
| 24 | | }}} |
| 25 | | |
| 26 | | Now get the setuptools package installed into the python system that was specifically built and installed for Chimera. Note the following has some version specific details that need attention for any current installation. At the time of writing, this installation used a specific daily-build of Chimera (2010-08-05) and a specific version of setuptools for the version of python that was built for Chimera (python2.7). |
| 27 | | |
| 28 | | {{{ |
| 29 | | $ sudo -i |
| 30 | | # export CHIMERA=/opt/UCSF/Chimera64-2010-08-05 |
| 31 | | # export PATH=$PATH:$CHIMERA/bin/ |
| 32 | | # export LD_LIBRARY_PATH=$CHIMERA/lib |
| 33 | | # wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg |
| 34 | | # sh setuptools-0.6c11-py2.7.egg --prefix=$CHIMERA |
| 35 | | }}} |
| 36 | | |
| 37 | | If you prefer to use distribute instead of setuptools, try the following: |
| 38 | | {{{ |
| 39 | | $ sudo -i |
| 40 | | # export CHIMERA=/opt/UCSF/Chimera64-2010-08-05 |
| 41 | | # export PATH=$PATH:$CHIMERA/bin/ |
| 42 | | # export LD_LIBRARY_PATH=$CHIMERA/lib |
| 43 | | # curl -O http://python-distribute.org/distribute_setup.py |
| 44 | | # $CHIMERA/bin/python2.7 distribute_setup.py |
| 45 | | ... |
| 46 | | Processing distribute-0.6.14-py2.7.egg |
| 47 | | creating /opt/UCSF/Chimera64-2010-08-05/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg |
| 48 | | Extracting distribute-0.6.14-py2.7.egg to /opt/UCSF/Chimera64-2010-08-05/lib/python2.7/site-packages |
| 49 | | Adding distribute 0.6.14 to easy-install.pth file |
| 50 | | Installing easy_install script to /opt/UCSF/Chimera64-2010-08-05/bin |
| 51 | | Installing easy_install-2.7 script to /opt/UCSF/Chimera64-2010-08-05/bin |
| 52 | | |
| 53 | | Installed /opt/UCSF/Chimera64-2010-08-05/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg |
| 54 | | Processing dependencies for distribute==0.6.14 |
| 55 | | Finished processing dependencies for distribute==0.6.14 |
| 56 | | After install bootstrap. |
| 57 | | Creating /opt/UCSF/Chimera64-2010-08-05/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info |
| 58 | | Creating /opt/UCSF/Chimera64-2010-08-05/lib/python2.7/site-packages/setuptools.pth |
| | 2 | == Installing Chimera and a Python Virtual Environment for Chimera Development == |
| | 3 | |
| | 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. |
| | 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-2010-08-24 |
| | 25 | Extracting files. This may take a few minutes. |
| | 26 | Executing command: './chimera.exe -q -d /home/dweber/src/Chimera64-2010-08-24' |
| | 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-2010-08-24/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-2010-08-24}}}. To install the desktop menu and icons: |
| | 51 | {{{ |
| | 52 | $HOME/src/Chimera64-2010-08-24/bin/xdg-setup install |
| | 53 | }}} |
| | 54 | |
| | 55 | In addition, I like to setup a few symlinks, like so: |
| | 56 | {{{ |
| | 57 | cd ~/src |
| | 58 | ln -s Chimera64-2010-08-24 Chimera64-daily |
| | 59 | sudo ln -s $HOME/src/Chimera64-daily/bin/chimera /usr/local/bin/chimera |
| | 60 | }}} |
| | 61 | |
| | 62 | 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. |
| | 63 | {{{ |
| | 64 | export CHIMERA=$HOME/src/Chimera64-daily |
| | 65 | export PATH=$PATH:$CHIMERA/bin/ |
| | 66 | export LD_LIBRARY_PATH=$CHIMERA/lib |
| | 67 | }}} |
| | 68 | |
| | 69 | === Adding python distribution tools to the Chimera installation === |
| | 70 | |
| | 71 | 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). |
| | 72 | |
| | 73 | Option A: to use [http://pypi.python.org/pypi/distribute distribute], try the following: |
| | 74 | {{{ |
| | 75 | cd ~/Downloads |
| | 76 | curl -O http://python-distribute.org/distribute_setup.py |
| | 77 | $CHIMERA/bin/python2.7 distribute_setup.py |
| | 78 | }}} |
| | 79 | |
| | 80 | Option B: to use [http://pypi.python.org/pypi/setuptools setuptools], try the following: |
| | 81 | {{{ |
| | 82 | cd ~/Downloads |
| | 83 | curl -O http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg |
| | 84 | sh setuptools-0.6c11-py2.7.egg --prefix=$CHIMERA |
| 65 | | 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?%3Aaction=search&term=virtualenv&submit=search virtualenv]. First, add the {{{virtualenv}}} package into the Chimera python installation, like so: |
| 66 | | |
| 67 | | {{{ |
| 68 | | $ sudo -i |
| 69 | | # export CHIMERA=/opt/UCSF/Chimera64-2010-08-05 |
| 70 | | # export PATH=$PATH:$CHIMERA/bin/ |
| 71 | | # export LD_LIBRARY_PATH=$CHIMERA/lib |
| 72 | | # $CHIMERA/bin/easy_install-2.7 virtualenv |
| 73 | | Searching for virtualenv |
| 74 | | Reading http://pypi.python.org/simple/virtualenv/ |
| 75 | | Reading http://virtualenv.openplans.org |
| 76 | | Best match: virtualenv 1.4.9 |
| 77 | | Downloading http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.4.9.tar.gz#md5=c49067cab242b5ff8c7b681a5a99533a |
| 78 | | Processing virtualenv-1.4.9.tar.gz |
| 79 | | Running virtualenv-1.4.9/setup.py -q bdist_egg --dist-dir /tmp/easy_install-eNIuwN/virtualenv-1.4.9/egg-dist-tmp-blYuR8 |
| 80 | | warning: no previously-included files matching '*.*' found under directory 'docs/_templates' |
| 81 | | Adding virtualenv 1.4.9 to easy-install.pth file |
| 82 | | Installing virtualenv script to /opt/UCSF/Chimera64-2010-08-05/bin |
| 83 | | |
| 84 | | Installed /opt/UCSF/Chimera64-2010-08-05/lib/python2.7/site-packages/virtualenv-1.4.9-py2.7.egg |
| 85 | | Processing dependencies for virtualenv |
| 86 | | Finished processing dependencies for virtualenv |
| 87 | | }}} |
| 88 | | |
| 89 | | |
| 90 | | Now that virtualenv is installed in the Chimera python distribution, we can setup any additional custom virtual environments to add python packages into the development environment. As a regular user, the following will create a Chimera-specific development environment in ~/src/chimera-virtualenv: |
| 91 | | |
| 92 | | {{{ |
| 93 | | $ export CHIMERA=/opt/UCSF/Chimera64-2010-08-05 |
| 94 | | $ export PATH=$PATH:$CHIMERA/bin/ |
| 95 | | $ export LD_LIBRARY_PATH=$CHIMERA/lib |
| 96 | | $ mkdir -p ~/src |
| 97 | | $ cd ~/src |
| 98 | | $ $CHIMERA/bin/virtualenv chimera-virtualenv |
| 99 | | New python executable in chimera-virtualenv/bin/python2.7 |
| 100 | | Also creating executable in chimera-virtualenv/bin/python |
| 101 | | Installing setuptools.................done. |
| 102 | | $ ls -al chimera-virtualenv/ |
| 103 | | total 20 |
| 104 | | drwxr-xr-x 5 dweber dweber 4096 2010-08-24 14:05 ./ |
| 105 | | drwxr-xr-x 45 dweber dweber 4096 2010-08-24 14:05 ../ |
| 106 | | drwxr-xr-x 2 dweber dweber 4096 2010-08-24 14:05 bin/ |
| 107 | | drwxr-xr-x 2 dweber dweber 4096 2010-08-24 14:05 include/ |
| 108 | | drwxr-xr-x 3 dweber dweber 4096 2010-08-24 14:05 lib/ |
| | 92 | 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: |
| | 93 | |
| | 94 | {{{ |
| | 95 | $CHIMERA/bin/easy_install virtualenv |
| | 96 | $CHIMERA/bin/virtualenv --help |
| | 97 | }}} |
| | 98 | |
| | 99 | Now that {{{virtualenv}}} is installed in the Chimera python distribution, we can setup any additional custom virtual environments to add python packages into our custom development environment. As a regular user, the following will create a Chimera-specific development environment in ~/src/chimera-virtualenv: |
| | 100 | |
| | 101 | {{{ |
| | 102 | mkdir -p ~/src |
| | 103 | cd ~/src |
| | 104 | $CHIMERA/bin/virtualenv --distribute $HOME/src/chimera-virtualenv |
| | 105 | ls -al $HOME/src/chimera-virtualenv/ |
| 205 | | Now for something adventurous, installing the [http://packages.python.org/spyder/ spyder]. First, we need to install some dependencies, sip and [http://www.riverbankcomputing.co.uk/software/pyqt/intro PyQt]. (In the example below, sip and !PyQt are installed with sudo privileges only because Chimera was installed with those privileges. If you install Chimera without sudo privileges, try to run {{{make install}}} commands instead of {{{sudo make install}}}.) |
| 206 | | |
| 207 | | This example is based on an Ubuntu linux system that had packages installed for Qt4, PyQt4, and QScintilla2, which are [http://packages.python.org/spyder/installation.html#dependencies dependencies for spyder]. Your system may need these installed, along with their development libraries and headers. Although those packages were installed on the system, they were not directly accessible to the Chimera python build. In my case, a solution was to download and build !PyQt4 within the Chimera virtual environment. |
| 208 | | {{{ |
| 209 | | $ source ~/src/chimera-virtualenv/bin/activate |
| 210 | | (chimera-virtualenv)$ cd ~/Downloads |
| 211 | | (chimera-virtualenv)$ wget http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.10.5.tar.gz |
| 212 | | (chimera-virtualenv)$ tar zxvf sip-4.10.5.tar.gz |
| 213 | | (chimera-virtualenv)$ cd sip-4.10.5 |
| 214 | | (chimera-virtualenv)$ python configure.py |
| 215 | | (chimera-virtualenv)$ make |
| 216 | | (chimera-virtualenv)$ sudo make install |
| 217 | | (chimera-virtualenv)$ cd .. |
| 218 | | (chimera-virtualenv)$ wget http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-4.7.4.tar.gz |
| 219 | | (chimera-virtualenv)$ tar zxvf PyQt-x11-gpl-4.7.4.tar.gz |
| 220 | | (chimera-virtualenv)$ cd PyQt-x11-gpl-4.7.4 |
| 221 | | (chimera-virtualenv)$ python configure.py --no-designer-plugin --qmake=/usr/bin/qmake-qt4 |
| 222 | | (chimera-virtualenv)$ make |
| 223 | | (chimera-virtualenv)$ sudo make install |
| 224 | | (chimera-virtualenv)$ wget http://212.219.56.133/sites/www.ibiblio.org/gentoo/distfiles/QScintilla-gpl-2.4.3.tar.gz |
| 225 | | (chimera-virtualenv)$ tar zxvf QScintilla-gpl-2.4.3.tar.gz |
| 226 | | (chimera-virtualenv)$ cd QScintilla-gpl-2.4.3 |
| 227 | | (chimera-virtualenv)$ cd Python |
| 228 | | (chimera-virtualenv)$ python configure.py |
| 229 | | (chimera-virtualenv)$ make |
| 230 | | (chimera-virtualenv)$ sudo make install |
| 231 | | }}} |
| 232 | | |
| 233 | | That should satisfy the [http://packages.python.org/spyder/installation.html#dependencies dependencies for spyder]. Now try to install spyder using pip. |
| | 214 | [http://www.youtube.com/watch?v=TRU6tQdyYqQ And now for something completely different]! How about installing the [http://packages.python.org/spyder/ spyder]. First, we need to install some [http://packages.python.org/spyder/installation.html#dependencies spyder dependencies], [http://www.riverbankcomputing.com/software/sip/intro sip] and [http://www.riverbankcomputing.co.uk/software/pyqt/intro PyQt]. |
| | 215 | |
| | 216 | |
| | 217 | (In the example below, sip and !PyQt are installed with sudo privileges only because Chimera was installed with those privileges. If you install Chimera without sudo privileges, try to run {{{make install}}} commands instead of {{{sudo make install}}}.) |
| | 218 | |
| | 219 | |
| | 220 | This example is based on an Ubuntu linux system that had packages installed for Qt4, PyQt4, and QScintilla2, which are [http://packages.python.org/spyder/installation.html#dependencies spyder dependencies]. Your system may need these installed, along with their development libraries and headers. Although those packages were installed on the system, they were not directly accessible to the Chimera python build. In my case, a solution was to download and build !PyQt4 within the Chimera virtual environment. |
| | 221 | |
| | 222 | {{{ |
| | 223 | source ~/src/chimera-virtualenv/bin/activate |
| | 224 | cd ~/Downloads |
| | 225 | curl -O http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.10.5.tar.gz |
| | 226 | tar zxvf sip-4.10.5.tar.gz |
| | 227 | cd sip-4.10.5 |
| | 228 | python configure.py |
| | 229 | make |
| | 230 | make install |
| | 231 | deactivate |
| | 232 | }}} |
| | 233 | |
| | 234 | {{{ |
| | 235 | source ~/src/chimera-virtualenv/bin/activate |
| | 236 | cd ~/Downloads |
| | 237 | curl -O http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-4.7.4.tar.gz |
| | 238 | tar zxvf PyQt-x11-gpl-4.7.4.tar.gz |
| | 239 | cd PyQt-x11-gpl-4.7.4 |
| | 240 | |
| | 241 | # configure without installing designer plugin or QScintilla API, as these |
| | 242 | # should be installed already by a prior installation of Qt4 or PyQt into the |
| | 243 | # system paths |
| | 244 | |
| | 245 | python configure.py --qmake=/usr/bin/qmake-qt4 --no-qsci-api --no-designer-plugin |
| | 246 | make |
| | 247 | make install |
| | 248 | deactivate |
| | 249 | }}} |
| | 250 | |
| | 251 | {{{ |
| | 252 | source ~/src/chimera-virtualenv/bin/activate |
| | 253 | cd ~/Downloads |
| | 254 | |
| | 255 | curl -O http://212.219.56.133/sites/www.ibiblio.org/gentoo/distfiles/QScintilla-gpl-2.4.3.tar.gz |
| | 256 | tar zxvf QScintilla-gpl-2.4.3.tar.gz |
| | 257 | cd QScintilla-gpl-2.4.3/Python |
| | 258 | python configure.py |
| | 259 | make |
| | 260 | make install |
| | 261 | deactivate |
| | 262 | }}} |
| | 263 | |
| | 264 | |
| | 265 | |
| | 266 | ADD PYTHON MODULES FOR SPYDER: pylint, numpy, scipy, matplotlib? |
| | 267 | |
| | 268 | |
| | 269 | That should satisfy the [http://packages.python.org/spyder/installation.html#dependencies spyder dependencies]. Now try to install spyder using pip. |
| | 270 | |