Setup and Installation (Python)

From ALPS
Jump to: navigation, search

This page explains how to install python, cmake, wxPython, and VTK, which are required to build ALPS GUI (e.g. lattice-preview).

Python

Python 2.5 or later is required.

Mac OS X Snow Leopard

is shipped with python 2.6.1 and wxPython 2.8.8.1. Note that wxPython works only in 32-bit mode. Use:

 defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

or

 export VERSIONER_PYTHON_PREFER_32_BIT=yes

to make 32-bit the default. See '64-BIT SUPPORT' section in 'man python' for more detail.

Linux CentOS 5

sudo yum install tk-devel tcl-devel
cd $HOME/build
rm -rf Python-2.6.4
curl http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz | tar zxf -
cd Python-2.6.4
./configure
make
sudo make install

Cmake

Cmake is required to compile the VTK library below.

Mac OS X Snow Leopard, Linux CentOS 5

curl http://www.cmake.org/files/v2.6/cmake-2.6.4.tar.gz | tar zxf -
cd cmake-2.6.4
./bootstrap --prefix=/usr/local
make
sudo make install

WxPython

WxPython is a python binding of the cross-platform GUI toolkit wxWidgets.

Mac OS X Snow Leopard

is shipped with wxPython 2.8.8.1. Note that wxPython works only in 32-bit mode.

Linux CentOS 5

 curl http://jaist.dl.sourceforge.net/project/wxpython/wxPython/2.8.10.1/wxPython-src-2.8.10.1.tar.bz2 | tar jxf -
 cd wxPython-src-2.8.10.1
 curl http://devide.googlecode.com/svn/trunk/johannes/patches/wxpython28101_gdiwrap.diff | patch -p0
 ./configure --enable-unicode --with-opengl
 make && sudo make install
 make -C contrib/src/gizmos && sudo make -C contrib/src/gizmos install
 make -C contrib/src/stc && sudo make -C contrib/src/stc install
 cd wxPython
 python setup.py build
 sudo python setup.py install

VTK

Mac OS X Snow Leopard

VTK should be compile in 32-bit mode, so that it can be used together with wxPython

 curl http://www.vtk.org/files/release/5.4/vtk-5.4.2.tar.gz | tar zxf -
 mkdir VTK-build && cd VTK-build
 cmake -DCMAKE_C_FLAGS:STRING="-arch i386" -DCMAKE_CXX_FLAGS:STRING="-arch i386" \
   -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_USE_CARBON:BOOL=ON -DVTK_USE_COCOA:BOOL=OFF \
   -DVTK_USE_TK:BOOL=OFF -DVTK_WRAP_PYTHON:BOOL=ON -DVTK_PYTHON_SETUP_ARGS:STRING= \
   ../VTK
 make
 sudo make install

Do not forget to append /usr/local/lib/vtk-5.4 to your environment variable DYLD_FALLBACK_LIBRARY_PATH

Linux CentOS 5

 curl http://www.vtk.org/files/release/5.4/vtk-5.4.2.tar.gz | tar zxf -
 mkdir VTK-build && cd VTK-build
 cmake -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_WRAP_PYTHON:BOOL=ON \
   -DPYTHON_EXECUTABLE:FILEPATH=/usr/local/bin/python \
   -DPYTHON_INCLUDE_PATH:PATH=/usr/local/include/python2.6 \
   ../VTK
 make
 sudo make install

Do not forget to append /usr/local/lib/vtk-5.4 to your environment variable LD_LIBRARY_PATH

Test your installation

python -c 'import wx; print wx.__version__'
python -c 'from vtk.wx.wxVTKRenderWindowInteractor import *; wxVTKRenderWindowInteractorConeExample()'