Python

From DISI
Revision as of 20:02, 16 August 2019 by Benrwong (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Python is probably the single most useful programming language you can learn today. Most of our new code is written in Python. The interface to many programs we use such as PyMol, Chimera, Omega and rdkit are in python. There are times to swim upstream and go against the crowd, but with Python in 2014, this is not one of those times.

There are two version streams, 2.7.x and 3.7.x. As of February 2014, our software uses exclusively 2.7.x and will not work with 3.x.x nor with 2.5.x or earlier versions.

Modules required: numpy, scipy, biopython, psycopg2, MySQL-python, sh, matplotlib

Python 2.7.6 is currently installed in nfs-soft:/mnt/nfs/python/python-2.7.6 Python 3.7.0 is currently installed in nfs:soft:/mnt/nfs/python/python-3.7.0

Installing a new version of Python onto nfs-soft for general cluster usage

The below commands were used to install the latest version of Python onto nfs-soft.

Note #1: in command 5, the --prefix option notes that which directory to install the Python files. This is necessary because otherwise, Python will get installed in /usr/local/bin and not in an nfs export directory where it can be accessed by other hosts in the cluster.
Note #2: In command 6, use 'make altinstall' instead of 'make install'. This prevents the new installation from overwriting the system installation of Python which is crucial for basic processes (the package manager, yum, needs the original installation of Python to be unchanged)

1) [s_bwong1@bet ~]$ cd /export/soft/python/build
2) [s_bwong1@bet build]$ sudo wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
3) [s_bwong1@bet build]$ sudo unxz Python-3.7.0.tar.xz
4) [s_bwong1@bet build]$ sudo tar -xvf Python-3.7.0.tar
5) [s_bwong1@bet build]$ #sudo ./configure --prefix=/export/soft/python/python-3.7.0 --enable-optimizations --with-ensurepip=install
6) [s_bwong1@bet build]$ sudo make && sudo make altinstall

Environment Variables for using Python3.7

.bash_profile

 export PATH="/nfs/soft/python/python-3.7.0/bin:$PATH"
 export LD_LIBRARY_PATH=/mnt/nfs/soft/openssl/openssl-1.1.1a/lib/