Changes between Initial Version and Version 1 of cypress/PytonInstallPackage


Ignore:
Timestamp:
08/23/16 10:23:18 (8 years ago)
Author:
fuji
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • cypress/PytonInstallPackage

    v1 v1  
     1== Installing Packages ==
     2One of the best things about Python is the number of packages provided by the user community. On a personal machine, the most popular method today for managing these packages is the use of a package manager, like pip. Unfortunately, these require root access and are not a viable solution on Cypress.
     3
     4There is an easy solution. Any well written Python package will allow the user to perform a "user only installation." This typically only requires the addition of a single flag when installing the package.
     5
     6As an example, let's install the package Parallel Python (pp). If you wish to follow along, the package can be downloaded [http://www.parallelpython.com/content/view/18/32/ here].
     7
     8When you have the packages tar file in the desired directory, you can unpack it with the '''tar''' command
     9
     10{{{
     11[tulaneID@cypress1 ~]$ tar -xvf pp-1.6.4.tar.gz
     12pp-1.6.4/
     13pp-1.6.4/doc/
     14pp-1.6.4/doc/ppserver.1
     15pp-1.6.4/doc/example.config
     16pp-1.6.4/doc/ppdoc.html
     17pp-1.6.4/pp.py
     18pp-1.6.4/README
     19pp-1.6.4/pptransport.py
     20pp-1.6.4/PKG-INFO
     21pp-1.6.4/ppcommon.py
     22pp-1.6.4/ppserver.py
     23pp-1.6.4/ppworker.py
     24pp-1.6.4/CHANGELOG
     25pp-1.6.4/MANIFEST.in
     26pp-1.6.4/AUTHORS
     27pp-1.6.4/ppauto.py
     28pp-1.6.4/setup.py
     29pp-1.6.4/examples/
     30pp-1.6.4/examples/reverse_md5.py
     31pp-1.6.4/examples/sum_primes_functor.py
     32pp-1.6.4/examples/auto_diff.py
     33pp-1.6.4/examples/callback.py
     34pp-1.6.4/examples/quicksort.py
     35pp-1.6.4/examples/dynamic_ncpus.py
     36pp-1.6.4/examples/sum_primes.py
     37pp-1.6.4/COPYING
     38[tulaneID@cypress1 ~]$
     39}}}
     40
     41Now move into the package directory and examine the README file
     42
     43{{{
     44[tulaneID@cypress1 ~]$ cd pp-1.6.4
     45[tulaneID@cypress1 pp-1.6.4]$ ls
     46AUTHORS    COPYING  examples     PKG-INFO   ppcommon.py  ppserver.py     ppworker.py  setup.py
     47CHANGELOG  doc      MANIFEST.in  ppauto.py  pp.py        pptransport.py  README
     48[tulaneID@cypress1 pp-1.6.4]$ cat README
     49Visit http://www.parallelpython.com for up-to-date documentation, examples and support forums
     50
     51INSTALATION:
     52    python setup.py install
     53
     54LOCAL DOCUMENTATION:
     55    <htmlviewer> pydoc.html
     56}}}
     57
     58After using idev to launch and interactive session,let's try their instructions
     59
     60{{{
     61[tulaneID@cypress01-035 pp-1.6.4]$ python setup.py install
     62running install
     63running build
     64running build_py
     65creating build
     66creating build/lib
     67copying pp.py -> build/lib
     68copying ppauto.py -> build/lib
     69copying ppcommon.py -> build/lib
     70copying pptransport.py -> build/lib
     71copying ppworker.py -> build/lib
     72running build_scripts
     73creating build/scripts-2.7
     74copying and adjusting ppserver.py -> build/scripts-2.7
     75changing mode of build/scripts-2.7/ppserver.py from 644 to 755
     76running install_lib
     77copying build/lib/pptransport.py -> /share/apps/anaconda/2.1.0/lib/python2.7/site-packages
     78error: [Errno 13] Permission denied: '/share/apps/anaconda/2.1.0/lib/python2.7/site-packages/pptransport.py'
     79[tulaneID@cypress01-035 pp-1.6.4]$
     80}}}
     81
     82Our installation failed because we lack the permissions to add files to the system wide Python installation. But that's not what we want anyway, we just want to install the package for our personal use. We need to add the flag '''- -prefix=$HOME''' to tell the installer where to place the package.
     83
     84{{{
     85[tulaneID@cypress01-035 pp-1.6.4]$ python setup.py install --prefix=$HOME
     86running install
     87running build
     88running build_py
     89running build_scripts
     90running install_lib
     91creating /home/tulaneID/lib
     92creating /home/tulaneID/lib/python2.7
     93creating /home/tulaneID/lib/python2.7/site-packages
     94copying build/lib/pptransport.py -> /home/tulaneID/lib/python2.7/site-packages
     95copying build/lib/pp.py -> /home/tulaneID/lib/python2.7/site-packages
     96copying build/lib/ppworker.py -> /home/tulaneID/lib/python2.7/site-packages
     97copying build/lib/ppcommon.py -> /home/tulaneID/lib/python2.7/site-packages
     98copying build/lib/ppauto.py -> /home/tulaneID/lib/python2.7/site-packages
     99byte-compiling /home/tulaneID/lib/python2.7/site-packages/pptransport.py to pptransport.pyc
     100byte-compiling /home/tulaneID/lib/python2.7/site-packages/pp.py to pp.pyc
     101byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppworker.py to ppworker.pyc
     102byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppcommon.py to ppcommon.pyc
     103byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppauto.py to ppauto.pyc
     104running install_scripts
     105copying build/scripts-2.7/ppserver.py -> /home/tulaneID/bin
     106changing mode of /home/tulaneID/bin/ppserver.py to 755
     107running install_egg_info
     108Writing /home/tulaneID/lib/python2.7/site-packages/pp-1.6.4-py2.7.egg-info
     109}}}
     110
     111We now have our own personal build of parallel python.
     112
     113{{{
     114[tulaneID@cypress01-035 pp-1.6.4]$ python
     115Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21)
     116[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
     117Type "help", "copyright", "credits" or "license" for more information.
     118Anaconda is brought to you by Continuum Analytics.
     119Please check out: http://continuum.io/thanks and https://binstar.org
     120>>> import pp
     121>>> pp.version
     122'1.6.4'
     123>>>
     124
     125}}}