| 1 | == Installing Packages == |
| 2 | One 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 | |
| 4 | There 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 | |
| 6 | As 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 | |
| 8 | When 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 |
| 12 | pp-1.6.4/ |
| 13 | pp-1.6.4/doc/ |
| 14 | pp-1.6.4/doc/ppserver.1 |
| 15 | pp-1.6.4/doc/example.config |
| 16 | pp-1.6.4/doc/ppdoc.html |
| 17 | pp-1.6.4/pp.py |
| 18 | pp-1.6.4/README |
| 19 | pp-1.6.4/pptransport.py |
| 20 | pp-1.6.4/PKG-INFO |
| 21 | pp-1.6.4/ppcommon.py |
| 22 | pp-1.6.4/ppserver.py |
| 23 | pp-1.6.4/ppworker.py |
| 24 | pp-1.6.4/CHANGELOG |
| 25 | pp-1.6.4/MANIFEST.in |
| 26 | pp-1.6.4/AUTHORS |
| 27 | pp-1.6.4/ppauto.py |
| 28 | pp-1.6.4/setup.py |
| 29 | pp-1.6.4/examples/ |
| 30 | pp-1.6.4/examples/reverse_md5.py |
| 31 | pp-1.6.4/examples/sum_primes_functor.py |
| 32 | pp-1.6.4/examples/auto_diff.py |
| 33 | pp-1.6.4/examples/callback.py |
| 34 | pp-1.6.4/examples/quicksort.py |
| 35 | pp-1.6.4/examples/dynamic_ncpus.py |
| 36 | pp-1.6.4/examples/sum_primes.py |
| 37 | pp-1.6.4/COPYING |
| 38 | [tulaneID@cypress1 ~]$ |
| 39 | }}} |
| 40 | |
| 41 | Now 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 |
| 46 | AUTHORS COPYING examples PKG-INFO ppcommon.py ppserver.py ppworker.py setup.py |
| 47 | CHANGELOG doc MANIFEST.in ppauto.py pp.py pptransport.py README |
| 48 | [tulaneID@cypress1 pp-1.6.4]$ cat README |
| 49 | Visit http://www.parallelpython.com for up-to-date documentation, examples and support forums |
| 50 | |
| 51 | INSTALATION: |
| 52 | python setup.py install |
| 53 | |
| 54 | LOCAL DOCUMENTATION: |
| 55 | <htmlviewer> pydoc.html |
| 56 | }}} |
| 57 | |
| 58 | After 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 |
| 62 | running install |
| 63 | running build |
| 64 | running build_py |
| 65 | creating build |
| 66 | creating build/lib |
| 67 | copying pp.py -> build/lib |
| 68 | copying ppauto.py -> build/lib |
| 69 | copying ppcommon.py -> build/lib |
| 70 | copying pptransport.py -> build/lib |
| 71 | copying ppworker.py -> build/lib |
| 72 | running build_scripts |
| 73 | creating build/scripts-2.7 |
| 74 | copying and adjusting ppserver.py -> build/scripts-2.7 |
| 75 | changing mode of build/scripts-2.7/ppserver.py from 644 to 755 |
| 76 | running install_lib |
| 77 | copying build/lib/pptransport.py -> /share/apps/anaconda/2.1.0/lib/python2.7/site-packages |
| 78 | error: [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 | |
| 82 | Our 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 |
| 86 | running install |
| 87 | running build |
| 88 | running build_py |
| 89 | running build_scripts |
| 90 | running install_lib |
| 91 | creating /home/tulaneID/lib |
| 92 | creating /home/tulaneID/lib/python2.7 |
| 93 | creating /home/tulaneID/lib/python2.7/site-packages |
| 94 | copying build/lib/pptransport.py -> /home/tulaneID/lib/python2.7/site-packages |
| 95 | copying build/lib/pp.py -> /home/tulaneID/lib/python2.7/site-packages |
| 96 | copying build/lib/ppworker.py -> /home/tulaneID/lib/python2.7/site-packages |
| 97 | copying build/lib/ppcommon.py -> /home/tulaneID/lib/python2.7/site-packages |
| 98 | copying build/lib/ppauto.py -> /home/tulaneID/lib/python2.7/site-packages |
| 99 | byte-compiling /home/tulaneID/lib/python2.7/site-packages/pptransport.py to pptransport.pyc |
| 100 | byte-compiling /home/tulaneID/lib/python2.7/site-packages/pp.py to pp.pyc |
| 101 | byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppworker.py to ppworker.pyc |
| 102 | byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppcommon.py to ppcommon.pyc |
| 103 | byte-compiling /home/tulaneID/lib/python2.7/site-packages/ppauto.py to ppauto.pyc |
| 104 | running install_scripts |
| 105 | copying build/scripts-2.7/ppserver.py -> /home/tulaneID/bin |
| 106 | changing mode of /home/tulaneID/bin/ppserver.py to 755 |
| 107 | running install_egg_info |
| 108 | Writing /home/tulaneID/lib/python2.7/site-packages/pp-1.6.4-py2.7.egg-info |
| 109 | }}} |
| 110 | |
| 111 | We now have our own personal build of parallel python. |
| 112 | |
| 113 | {{{ |
| 114 | [tulaneID@cypress01-035 pp-1.6.4]$ python |
| 115 | Python 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 |
| 117 | Type "help", "copyright", "credits" or "license" for more information. |
| 118 | Anaconda is brought to you by Continuum Analytics. |
| 119 | Please check out: http://continuum.io/thanks and https://binstar.org |
| 120 | >>> import pp |
| 121 | >>> pp.version |
| 122 | '1.6.4' |
| 123 | >>> |
| 124 | |
| 125 | }}} |