Python



Usage


module load python/3.6.1

module avail python  (this will list all versions available


python 2.7.1

Download Packages

mkdir /usr/local/src/scipyBuildInstructions
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
pwd
/usr/local/src/scipyBuildInstructions
ls *.gz
AMD-2.2.2.tar.gz  fftw-3.2.2.tar.gz  matplotlib-1.0.1.tar.gz  numpy-1.5.1.tar.gz  scipy-0.9.0.tar.gz  UFconfig-3.6.0.tar.gz  UMFPACK-5.5.1.tar.gz

build python 2.7.1

cd /usr/local/src/scipyBuildInstructions
tar -zxvf Python-2.7.1.tgz
cd Python-2.7.1
./configure --prefix=/usr/local/src/apps/Python-2.7.1 --with-readline=gnu 2>&1 | tee log.configure.Python
make -j8 2>&1 | tee log.makej8
make install 2>&1 | tee log.make_install_python

Test

/usr/local/src/apps/Python-2.7.1/bin/python
Python 2.7.1 (r271:86832, Jun 29 2011, 09:08:45)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Installation on the cluster users

scp -rp /usr/local/src/apps/Python-2.7.1/ admin:/sw/python/2.7.1

Module file for python 2.7.1

#%Module######################################################################
##
##      python modulefile
##
proc ModulesHelp { } {
        puts stderr "Sets up paths for python 2.7.1 "
}

module-whatis   "adds python 2.7.1 directories to PATH etc. "


set base_path           /sw/python
set python_base         $base_path/2.7.1

prepend-path    PATH    $python_base/bin

prepend-path    PYTHONPATH      $python_base/lib/python2.7/site-packages
prepend-path    LD_LIBRARY_PATH $python_base/lib/python2.7
prepend-path    INCLUDE         $python_base/include/python2.7


Module file usage

module load python/2.7.1

python 2.7.1-shared

CC="gcc -m64"
cd //sw/python/2.7.1-shared
cd /sw/python/2.7.1-shared/src
tar -zxvf Python-2.7.1.tgz
(cd Python-2.7.1)
/sw/python/2.7.1-shared/src/Python-2.7.1
./configure --enable-shared --prefix=/sw/python/2.7.1-shared/ 2>&1 | tee log.configure.Python
make -j8 2>&1 | tee log.makej8
make install 2>&1 | tee log.make_install_python

Python 3.1.4

http://www.python.org/

mkdir /tmp/python
cd /tmp/python
cp /tmp/Python-3.1.4.tgz .
tar -zxvf Python-3.1.4.tgz

 module load  intel-cc-11/11.1.072
 module load  intel-fc-11/11.1.072
 module load  intel-cmkl-11/11.1.072
 module load  intel-tools-11/11.1.072
 module load  intel-mpi/4.0.0.027

Test: which ifort
/sw/sdev/intel/Compiler/11.1/072/bin/intel64/ifort

 ./configure --prefix=/tmp/python --enable-zlib
[Python must also be compiled with the zlib module enabled for numpy]
make
make test
sudo make install


mv /tmp/python /sw/python/3.1.4/
cd /sw/python/3.1.4/bin

ln -s idel3 idle
ln -s pydoc3 pydoc
ln -s python3 python


Fixed the module file:
======================

 pwd
/sw/com/modulefiles/python
[root@admin python]# more 3.1.4
#%Module######################################################################
##
##      python modulefile
##
proc ModulesHelp { } {
        puts stderr "Sets up paths for python and biopython"
}

module-whatis   "adds python directories to PATH etc. "


set base_path           /sw/python
set python_base         $base_path/3.1.4

prepend-path    PATH    $python_base/bin

prepend-path    PYTHONPATH      $python_base/lib


 ./configure -help
`configure' configures python 3.1 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/python]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-universalsdk[=SDKDIR]
                          Build against Mac OS X 10.4u SDK (ppc/i386)
  --enable-framework[=INSTALLDIR]
                          Build (MacOSX|Darwin) framework
  --enable-shared         disable/enable building shared python library
  --enable-profiling      enable C-level code profiling
  --enable-ipv6           Enable ipv6 (with ipv4) support
  --disable-ipv6          Disable ipv6 support
  --enable-big-digits[=BITS]
                          use big digits for Python longs [[BITS=30]]

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-universal-archs=ARCH
                          select architectures for universal build ("32-bit",
                          "64-bit", "3-way", "intel" or "all")
  --with-framework-name=FRAMEWORK
                          specify an alternate name of the framework built
                          with --enable-framework
  --without-gcc           never use gcc
  --with-cxx-main=<compiler>
                          compile main() and link python executable with C++
                          compiler
  --with-suffix=.exe      set executable suffix
  --with-pydebug          build with Py_DEBUG defined
  --with-libs='lib1 ...'  link against additional libs
  --with-system-ffi       build _ctypes module using an installed ffi library
  --with-dbmliborder=db1:db2:...
                          order to check db backends for dbm. Valid value is a
                          colon separated string with the backend names
                          `ndbm', `gdbm' and `bdb'.
  --with-signal-module    disable/enable signal module
  --with-dec-threads      use DEC Alpha/OSF1 thread-safe libraries
  --with(out)-threads[=DIRECTORY]
                          disable/enable thread support
  --with(out)-thread[=DIRECTORY]
                          deprecated; use --with(out)-threads
  --with-pth              use GNU pth threading libraries
  --with(out)-doc-strings disable/enable documentation strings
  --with(out)-tsc         enable/disable timestamp counter profile
  --with(out)-pymalloc    disable/enable specialized mallocs
  --with-wctype-functions use wctype.h functions
  --with-fpectl           enable SIGFPE catching
  --with-libm=STRING      math library
  --with-libc=STRING      C library
  --with-wide-unicode     Use 4-byte Unicode characters (default is 2 bytes)
  --with-computed-gotos   Use computed gotos / threaded dispatch in evaluation
                          loop (not available on all compilers)

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <http://bugs.python.org/>.


Python 3.6.1

module purge
module load gcc/4.9.3
module load library/bzip2/1.0.6fpic
module load library/lzma/lzma

cd /sw/python/3.6.1/src/Python-3.6.1
./configure --enable-shared --enable-optimizations --prefix=/sw/python/3.6.1 2>&1 | tee log.configure.Python

make -j8 2>&1 | tee log.makej8

make install 2>&1 | tee log.make_install_python


Get a list of all installed python packages


python -c 'help("modules")'