How to install/update pysam with python version 2.7

# request an interactive session:

# when the prompt returns cd to the root directory where you want the installed package to reside (for example $HOME):
cd $HOME

# download xz (containing the missing library) & install (in this example in $HOME/xy/5.2.3 change as needed):
tar xvf xz-5.2.3.tar.gz
cd xz-5.2.3
./configure --prefix=$HOME/xz/5.2.3 2>&1 | tee IDRE_conf.log
make 2>&1 | tee IDRE_make.log
make check 2>&1 | tee IDRE_make-check.log
make install 2>&1 | tee IDRE_make-install.log

# if not already loaded load the python module:
module load python/2.7.3

# download pysam:
cd $HOME
git clone
cd pysam
export CFLAGS=-I/u/scratch2/d/dauria/xz/5.2.3/include/
export CPPFLAGS=-I/u/scratch2/d/dauria/xz/5.2.3/include/
export LDFLAGS=-L/u/scratch2/d/dauria/xz/5.2.3/lib
python build 2>&1 | tee IDRE_python-setup-build.log
python install --user 2>&1 | tee IDRE_python-setup-install-user.log

# to use is add to the bottom of your $HOME/.bashrc file the lines:
module load python/2.7.3
export PATH=$HOME/.local/bin:$PATH

Please notice that I have tried this procedure with gcc version 4.9.3, should any of the steps above fail consider adding:

module load gcc/4.9.3

to the bottom of your $HOME/.bashrc and perform the steps above again.

Please notice that you can also create a pysam module as follows:

mkdir mymodulefiles

add at the bottom of you $HOME/.bashrc file the line:

module use $HOME/mymodulefiles

cd mymodulefiles

and create there the pysam modulefile as follows:

set name "pysam"

proc ModulesHelp { } {
global name
puts stderr ""
module-whatis "Adds the $name to user's environment"
module-whatis "Name : $name"

module load python/2.7.3
set home [ set env(HOME)]

prepend-path PATH $home/.local/bin
prepend-path LD_LIBRARY_PATH $home/xz/5.2.3/lib

Notice replace:

with the actual location of your xy installation (if different than $HOME/xz/5.2.3).

You can now invoke:

module load pysam

to load pysam into your environment.
Creation date: 6/30/2017 3:13 PM      Updated: 10/28/2019 9:57 AM