Changes between Version 1 and Version 2 of cypress/Python


Ignore:
Timestamp:
Aug 19, 2015 1:03:54 PM (6 years ago)
Author:
cmaggio
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • cypress/Python

    v1 v2  
    11= Running Python on Cypress =
    22
     3== Python Modules ==
     4As of August 18th, 2015 there are three (3) versions of Python available on Cypress
     5* Python 2.6.6 is loaded by default for al users
     6* Python 2.7.8 is available as part of the Anaconda module
     7* Python 2.7.10 is available as a stand alone module
     8
     9We currently do not have Python 3 installed on Cypress as we have had no requests for Python 3.
     10
     11=== Anaconda ===
     12As the name implies, Anaconda is a larger version of Python. In addition to Python 2.7.8, Anaconda includes over 300 of the most requested Python packages. This includes
     13* !NumPy
     14* Pandas
     15* !SciPy
     16* Matplotlib
     17* IPython.
     18
     19A complete list of packages available though Anaconda can be found [http://docs.continuum.io/anaconda/pkg-docs here].
     20
     21== Installing Packages ==
     22One 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.
     23
     24There 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.
     25
     26As 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].
     27
     28When you have the packages tar file in the desired directory, you can unpack it with the '''tar''' command
     29
     30{{{
     31[tulaneID@cypress1 ~]$ tar -xvf pp-1.6.4.tar.gz
     32pp-1.6.4/
     33pp-1.6.4/doc/
     34pp-1.6.4/doc/ppserver.1
     35pp-1.6.4/doc/example.config
     36pp-1.6.4/doc/ppdoc.html
     37pp-1.6.4/pp.py
     38pp-1.6.4/README
     39pp-1.6.4/pptransport.py
     40pp-1.6.4/PKG-INFO
     41pp-1.6.4/ppcommon.py
     42pp-1.6.4/ppserver.py
     43pp-1.6.4/ppworker.py
     44pp-1.6.4/CHANGELOG
     45pp-1.6.4/MANIFEST.in
     46pp-1.6.4/AUTHORS
     47pp-1.6.4/ppauto.py
     48pp-1.6.4/setup.py
     49pp-1.6.4/examples/
     50pp-1.6.4/examples/reverse_md5.py
     51pp-1.6.4/examples/sum_primes_functor.py
     52pp-1.6.4/examples/auto_diff.py
     53pp-1.6.4/examples/callback.py
     54pp-1.6.4/examples/quicksort.py
     55pp-1.6.4/examples/dynamic_ncpus.py
     56pp-1.6.4/examples/sum_primes.py
     57pp-1.6.4/COPYING
     58[tulaneID@cypress1 ~]$
     59}}}
     60
     61Now move into the package directory and examine the README file
     62
     63{{{
     64[tulaneID@cypress1 ~]$ cd pp-1.6.4
     65[tulaneID@cypress1 pp-1.6.4]$ ls
     66AUTHORS    COPYING  examples     PKG-INFO   ppcommon.py  ppserver.py     ppworker.py  setup.py
     67CHANGELOG  doc      MANIFEST.in  ppauto.py  pp.py        pptransport.py  README
     68[tulaneID@cypress1 pp-1.6.4]$ cat README
     69Visit http://www.parallelpython.com for up-to-date documentation, examples and support forums
     70
     71INSTALATION:
     72    python setup.py install
     73
     74LOCAL DOCUMENTATION:
     75    <htmlviewer> pydoc.html
     76}}}
     77
     78After using idev to launch and interactive session,let's try their instructions
     79
     80{{{
     81[tulaneID@cypress01-035 pp-1.6.4]$ python setup.py install
     82running install
     83running build
     84running build_py
     85creating build
     86creating build/lib
     87copying pp.py -> build/lib
     88copying ppauto.py -> build/lib
     89copying ppcommon.py -> build/lib
     90copying pptransport.py -> build/lib
     91copying ppworker.py -> build/lib
     92running build_scripts
     93creating build/scripts-2.7
     94copying and adjusting ppserver.py -> build/scripts-2.7
     95changing mode of build/scripts-2.7/ppserver.py from 644 to 755
     96running install_lib
     97copying build/lib/pptransport.py -> /share/apps/anaconda/2.1.0/lib/python2.7/site-packages
     98error: [Errno 13] Permission denied: '/share/apps/anaconda/2.1.0/lib/python2.7/site-packages/pptransport.py'
     99[tulaneID@cypress01-035 pp-1.6.4]$
     100}}}
     101
     102Our 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.
     103
     104{{{
     105[tulaneID@cypress01-035 pp-1.6.4]$ python setup.py install --prefix=$HOME
     106running install
     107running build
     108running build_py
     109running build_scripts
     110running install_lib
     111creating /home/tulaneID/lib
     112creating /home/tulaneID/lib/python2.7
     113creating /home/tulaneID/lib/python2.7/site-packages
     114copying build/lib/pptransport.py -> /home/tulaneID/lib/python2.7/site-packages
     115copying build/lib/pp.py -> /home/tulaneID/lib/python2.7/site-packages
     116copying build/lib/ppworker.py -> /home/tulaneID/lib/python2.7/site-packages
     117copying build/lib/ppcommon.py -> /home/tulaneID/lib/python2.7/site-packages
     118copying build/lib/ppauto.py -> /home/tulaneID/lib/python2.7/site-packages
     119byte-compiling /home/tulaneID/lib/python2.7/site-packages/pptransport.py to pptransport.pyc
     120byte-compiling /home/tulaneID/lib/python2.7/site-packages/pp.py to pp.pyc
     121byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppworker.py to ppworker.pyc
     122byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppcommon.py to ppcommon.pyc
     123byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppauto.py to ppauto.pyc
     124running install_scripts
     125copying build/scripts-2.7/ppserver.py -> /home/tulaneID/bin
     126changing mode of /home/tulaneID/bin/ppserver.py to 755
     127running install_egg_info
     128Writing /home/tulaneID/lib/python2.7/site-packages/pp-1.6.4-py2.7.egg-info
     129}}}
     130
     131We now have our own personal build of parallel python.
     132
     133{{{
     134[tulaneID@cypress01-035 pp-1.6.4]$ python
     135Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21)
     136[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
     137Type "help", "copyright", "credits" or "license" for more information.
     138Anaconda is brought to you by Continuum Analytics.
     139Please check out: http://continuum.io/thanks and https://binstar.org
     140>>> import pp
     141>>> pp.version
     142'1.6.4'
     143>>>
     144
     145}}}
     146
    3147[[cypress/IntoToHpcWorkshop2015|Return to Workshop Homepage]]