Kategoriarkiv: Python

A scripting language with ugly syntax: http://www.python.org

Add Numpy to python install

install Numpy numpy-1.8.1.tar.gz download from http://sourceforge.net/projects/numpy
module load python/2.7.6  # build python
use gfortran
python setup.py build –fcompiler=gnu95
checkinstall python setup.py install

Python 3.4

python setup.py clean
module unload python/2.7.6
module load python/3.4.1
python3 setup.py build –fcompiler=gnu95
checkinstall python3 setup.py install

Cantera installation

Download cantera from http://code.google.com/p/cantera

module load scons/2.3.1  # build scons
module load python/2.7.6  # build python
scons build prefix=/opt/cantera/2.0-python-2.7.6
scons test
scons install

module file /etc/modulefiles/cantera/2.0-python-2.7.6

#%Module1.0####################################################################
##
## Discretizer AB modulefile
##
##
## Add directory to the path
prepend-path PATH /opt/cantera/2.0-python-2.7.6/bin
prepend-path PYTHONPATH /opt/cantera/2.0-python-2.7.6/lib/python2.7/site-packages

module load python/2.7.6

PythonQT 2.1 standalone install on CentOS

Download PythonQt2.1_Qt4.8.zip from http://sourceforge.net/projects/pythonqt
module load cmake/2.8.12.2 qt/4.8.6  # check cmake and qt installations (also python should be loaded?)
cmake . -DCMAKE_INSTALL_PREFIX=/opt/pyqt/2.1
make -j4
make install

module file /etc/modulefiles/pyqt/2.1

#%Module1.0#########################################
##
##  Discretizer AB modulefile
##
##
## Set environment variables
setenv          PYQT4_ROOT_DIR     ”/opt/pyqt/2.1”
prepend-path    LD_LIBRARY_PATH    /opt/pyqt/2.1/lib

Standalone install of python 2.7 and 3.4 on CentOS

Download Python-2.7.6.tgz and Python-3.4.1.tar.xz. Unpack the xz-file with tar -xJvf Python-3.4.1.tar.xz. We use the standalone tcltk-installation we’ve made already… (here)

Python 2.7.6
./configure –prefix=/opt/python/2.7.6 –exec-prefix=/opt/python/2.7.6 –oldincludedir=/opt/python/2.7.6/include –datadir=/opt/python/2.7.6 –docdir=/opt/python/2.7.6/doc –with-system-ffi –with-tcltk-includes=”-I/opt/tcltk/8.5.13/include” –with-tcltk-libs=”-L/opt/tcltk/8.5.13/lib -ltcl8.5 -ltk8.5″ –with-pth

make -j4
make install

Module file /etc/modulefiles/python/2.7.6:

#%Module1.0##################################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr ”\tAdd environment.”
}

## Create a whatis file.
module-whatis ”Add program links, aliases and paths”

setenv PYTHON_ROOT_DIR ”/opt/python/2.7.6”
setenv PYTHONHOME ”/opt/python/2.7.6”
setenv PYTHON_VERSION ”2.7”
setenv PYTHON_INCLUDE /opt/python/2.7.6/include/python2.7
prepend-path PATH /opt/python/2.7.6/bin
prepend-path LD_LIBRARY_PATH /opt/python/2.7.6/lib
prepend-path PYTHONPATH /opt/python/2.7.6/lib/python2.7

Python 3.4.1
./configure –prefix=/opt/python/3.4.1 –exec-prefix=/opt/python/3.4.1 –oldincludedir=/opt/python/3.4.1/include –datadir=/opt/python/3.4.1 –docdir=/opt/python/3.4.1/doc –with-system-ffi –with-tcltk-includes=”-I/opt/tcltk/8.5.13/include” –with-tcltk-libs=”-L/opt/tcltk/8.5.13/lib -ltcl8.5 -ltk8.5″

make -j4
make install

module file /etc/modulefiles/python/3.4.1

#%Module1.0#########################################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr ”\tAdd environment.”
}

## Create a whatis file.
module-whatis ”Add program links, aliases and paths”

set-alias ”xmlwf” ”xmlwf21”
set-alias ”python” ”python3”
set-alias ”idle” ”idle3”
set-alias ”pip” ”pip3”
set-alias ”pydoc” ”pydoc3”
set-alias ”python-config” ”python3-config”
set-alias ”f2py” ”f2py3”

setenv PYTHON_ROOT_DIR ”/opt/python/3.4.1”
setenv PYTHONHOME ”/opt/python/3.4.1”
setenv PYTHON_VERSION ”3.4”
setenv PYTHON_INCLUDE /opt/python/3.4.1/include/python3.4
prepend-path PATH /opt/python/3.4.1/bin
prepend-path LD_LIBRARY_PATH /opt/python/3.4.1/lib
prepend-path PYTHONPATH /opt/python/3.4.1/lib/python3.4