Here you will find how to set up PyTom on your system

Get the PyTom release

Learn here how you can obtain the source code.

A zipped release

You can download a zipped release file from sourceforge.

Get a direct link into the GIT repository

You can directly hook up into the release repository. This bears the great advantage that you will be able to immediatly install the latest release without having to change your environment. Open a terminal and change into a folder of your choice an run the following command:
git clone http://git.code.sf.net/p/pytom/gitrepo pytom
The above line will download the latest stabe (master) branch into the pytom folder. You must not use another folder-name for PyTom assumes it is installed into a "pytom" folder and will not work otherwise.

Dependencies

You will need few other toolboxes installed on your system.

GCCThe Gnu C Compiler
Pythonv2.6 or newer, including development includes and libraries
LXMLPython XML library
libxml2Standard installation with dynamic libs
libxstlStandard installation with dynamic libs
fftw3with float and dynamic library support
boost1.46 - only few headers
swigGlue interface between Python and C/C++
Numpy/SciPyPython scientific library
openmpifor parallel processing
or
lamfor parallel processing
OPTIONALbut recomended
IPythonInteractive Python
PILPython Image Library
MatPlotLibPython plot library
EpydocPython documentation library

OS specific packages will be listed at OS specific details below.

Tested system setups

Kubuntu Linux

GCC4.4.3 or lower that supports C++ 98 the standard
Pythonv2.6.5
LXMLPython XML library
libxml22.7.6
libxstl1.1.26
fftw3.2.4
boost1.46
swig1.3.40
openmpi1.5.4_0
IPython0.1
PIL1.1.7_3
Epydoc3.0.1

OSX

GCC4.4.3 or lower that supports C++ 98 the standard
Pythonv2.6.7
LXML2.3
libxml22.7.8
libxstl1.1.26
fftw3.3
boost1.47.0
swig2.0.4
openmpi1.5.4_0
IPython0.11
PIL1.1.7_3
Epydoc3.0.1

 

Compiling

Obtain a PyTom copy and rename the downloaded folder to pytom. Next, change into the pytom/pytomc folder. Know where all your libraries are locate. In case dynamic libraries and include files for the packages mentioned above were not installed into the system specific folder like /usr/include or /lib, you must specify them to the compile.py tool. Type

./compile.py
and a help will print all properties you can assign. Specify all paths as parameters to compile.py and run it with
--target all
Compilation should succeed ( :) ). Binaries named pytom and ipytom will be written into
PATH/pytom/bin

You can excecute these files from within this folder or you adjust your shell startup (e.g. ~/.bashrc) to find it automatically for you.

Compile scripts

Kubuntu Linux
./compile.py
--includeDir /usr/include/python2.6 /usr/local/apps/openmpi-1.2.9/include /usr/include/boost/
/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/
--libDir /usr/local/apps/openmpi-1.2.9/lib /usr/lib
--dirPath /usr/local/apps/openmpi-1.2.9/bin
--pythonVersion 2.6
--target all


Debian 6
./compile.py --libDir /lib /usr/lib --includeDir /include /usr/include/openmpi/
/usr/include/python2.6 /usr/include/python2.6/numpy/ /usr/include/boost/
--pythonVersion 2.6 --target all


OSX
./compile.py
--libDir /opt/local/lib/
--includeDir /opt/local/include/
/opt/local/include/openmpi/ /opt/local/include/boost
/opt/local/Library/Frameworks/Python.framework/Versions/Current/include/python2.6/
/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/numpy/core/include/numpy/
--target all


Please note for the Python library and include paths: the path provided here are dependent on the current used Python vesion 2.6.
If you use another version you will have to adjust the version number accordingly.

Setup your environment

Once you successfully compiled PyTom, extend your ~/.bashrc or ~/.cshrc with the path to the PyTom excecuteables:

~/.bashrc

export PATH '<PathToPyTom>/bin':$PATH

~/.cshrc

setenv PATH='<PathToPyTom>/bin':$PATH

Check system setup

In order to determine if your system is set up correctly, you can run pytom/pytomc/check.py. A correct PyTom set up should give something like:

swigModules/_pytom_volume.so:
swigModules/_pytom_volume.so (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/Users/hrabe/develop/PyTomGIT/master/pytom/pytomc/libs/libtomc/libs/libtomc.so (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/libfftw3.3.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/local/lib/libfftw3f.3.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current version 2.6.0)
/opt/local/lib/libmpi.1.dylib (compatibility version 2.0.0, current version 2.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)


Test the installation by running ipytom (in pytom/bin) and type
import pytom # should not fail
from pytom_volume import read
read('')
#should give:
#RuntimeError: : Wrong file format or file doesn't exist!

Congratulations, PyTom is fully installed on your machines!

Packages for OSX

OSX is a unix derivation and PyTom thus runs on these systems. However, you have to install more libraries manually as it is not shipped with the regular Linux tools.

1. Install XCode to get all developer tools like GCC compiler...

2. Install MacPorts to retrieve all these nitty Linux tools (Tested with 2.0.3 and working). You can alternatively use Fink to get these tools (Untested though).

3. Once MacPort is setup, open a terminal and run these scripts:

sudo port selfupdate
sudo port install fftw-3 fftw-3-single
sudo port install libxml2 libxslt
sudo port install python26
sudo port install swig-python
sudo port install py26-lxml
sudo port install openmpi
sudo port install boost
sudo port install py26-pil
sudo port install py26-ipython
sudo port install py26-matplotlib
sudo port install py26-scipy
sudo port install py26-epydoc
After compilation is done (may take some time depending on your machine), you can specify the excecuteable name for python and ipython with
sudo port select --set python python26
sudo port select --set ipython ipython26

because MacPorts does not generate these links automatically.

4.Get PyTom and compile as described above.

 

Packages for CentOS 6.1 final

Use these commands below to install all required packages for CentOS 6.1 (final release).
sudo yum install fftw-devel.x86_64
sudo yum install boost.x86_64
sudo yum install openmpi.x86_64
sudo yum install openmpi-devel.x86_64
sudo yum install boost.x86_64
sudo yum install boost-devel.x86_64
sudo yum install openmpi-devel.x86_6
sudo yum install openmpi-devel.x86_64
sudo yum install python-devel.x86_64
sudo yum install scipy.x86_64


./compile.py --pythonVersion 2.6 --target all --libDir /usr/lib64/ /usr/lib64/openmpi/lib
--includeDir /usr/include/ /usr/include/python2.6 /usr/include/boost/ /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ /usr/include/openmpi-x86_64/
--exeDir /usr/lib64/openmpi/bin

Note for compilation of SH Alignment since version 0.95

We are excited to integrate SH Alignment library into PyTom since version 0.95! Now FFTW3 is the only prerequisite. (Migration from FFTW2 to FFTW3 is done.) Once you have it, the compile command stays the same as stated above and SH Alignment will get compiled together with PyTom. After the compilation is finished, you can check if SH Alignment is successfully installed by:

pytom
>>> from sh_alignment.frm import frm_align

Core dump error?

After a successful installation you want to use PyTom. However, you still get some core dump errors time to time? Like:

*** glibc detected *** python: free(): invalid pointer: 0x00007f04ffcd64c0 ***
...
Aborted (core dumped)
Even though, this has nothing to do with PyTom itself. The exception raised from Python is not catched properly and the true error is hidden behind. We suspect this happends due to the Python version. Only 2.6.x has this issue. To avoid this, try to use Python 2.5 or 2.7.

 

For errors, check our FAQ for known issues.