Skip to content

SetupTasks

Sebastian Schmieschek edited this page Aug 12, 2015 · 9 revisions

Organised by component.

For particular platforms see:

h2. General

h3. Python

We use Python for all the support tools etc. Python 2.7 is required.

Correctly installing all the required packages can be difficult but Enthought Canopy makes this easier. Go to https://enthought.com/products/canopy/academic/ and register with an academic email address. Then download the installer.

Note that you may prefer to do a system-wide install rather than in your home directory only. See: http://docs.enthought.com/canopy/configure/canopy-cli.html

Some users have had success using Ubuntu's packages rather than Canopy.

h3. Mercurial

This is used for version control. For an introduction, see http://hginit.com/. See also MercurialConventions

h3. CMake

We use [wiki:CMake] for configuration of HemeLB.

h3. Fabric

Used for (remote) deployment. See [wiki:Fabric].

h2. Tools

Required Python package (that aren't in the standard library):

  • numpy
  • VTK
  • Cython
  • quantities These are all included in Canopy (quantities must be installed through the Canopy package manager)

If you are going to develop HemeLB or follow the tip of development, we suggest that you DO NOT INSTALL the tools. Instead, add the source directory to your PYTHONPATH environment variable and run


cd $HEMELB/Tools
python setup.py build_ext --inplace

h2. SetupTool

If you are using Canopy, I recommend that you create a separate virtual environment for the setup tool

  1. Set up a new virtual environment and activate it

SETUPTOOL_ROOT=~/sw/setuptool
/Applications/Canopy.app/Contents/MacOS/Canopy_cli venv -s $SETUPTOOL_ROOT
source $SETUPTOOL_ROOT/bin/activate
  1. Install necessary packages that aren't included in the default environment

enpkg wxPython readline swig Cython
  1. Add an alias to your bashrc to make using it easy

export SETUPTOOL_ROOT=~/sw/setuptool
alias setuptool-venv='source $SETUPTOOL_ROOT/bin/activate'

If you are going to develop HemeLB or follow the tip of development, we suggest that you DO NOT INSTALL the setuptool. Instead, add $HEMELB/Tools/setuptool to your PYTHONPATH and $HEMELB/Tools/setuptool/scripts to your PATH (in your venv activation script if you're using it). Then run


cd $HEMELB/Tools/setuptool
python setup.py build_ext --inplace

Direct dependencies:

  • the tools as above
  • wx, including python interface
  • VTK, including python interface
  • Swig
  • CGAL
  • VMTK

wx, VTK and swig are included in Canopy.

h3. VTK/wx bugs

There are two bugs in the VTK/wx interface that may be triggered by the setuptool.

Run


python -m vtk.wx.wxVTK[[RenderWindowInteractor]]

This should show a window with a cone that you can rotate.

If instead you get a segmentation fault, edit the file /path/to/canopy/lib/python2.7/site-packages/vtk/wx/wxVTK[[RenderWindowInteractor]].py and change line 350 from


d = '_%s_%s' % (d[2:], 'void_p')

to


d = '_%s_%s\0' % (d[2:], 'void_p')

If it gives the error:


Traceback (most recent call last):
  File "/usr/local/Canopy_64bit/User/lib/python2.7/site-packages/vtk/wx/wxVTK[[RenderWindowInteractor]].py", line 379, in [[OnPaint]]
    self._Iren.[[GetRenderWindow]]().[[SetSize]](self.[[GetSizeTuple]]())
[[TypeError]]: function takes exactly 2 arguments (1 given)

then edit the file go to the line with the exception and add an asterisk to


    self._Iren.[[GetRenderWindow]]().[[SetSize]](*self.[[GetSizeTuple]]())

h3. CGAL

See http://www.cgal.org and platform-specific guides (should work either apt or brew).

h3. VMTK

On wiki:[[SetupTasksUbuntu | Ubuntu]], using apt without Canopy //may// work. Unfortunately the binary installer for VMTK will not work for our purposes, so we have to build it.

VMTK depends on VTK and ITK. These must all have their Python interfaces built too. Further, they must all three be compiled against the same Python interpreter.


Python <---- VTK <---\
  ^  ^------ ITK <--- VMTK
   \-----------------/

If you have installed Canopy, then you have a suitable Python and VTK already.

Install ITK. You need ITK version 3.20.1. Do the usual CMake configure, build, install process, ensuring that BUILD_SHARED_LIBS is ON.

Download the VMTK tarball from the website (http://www.vmtk.org/) and prepare to configure it


tar -xzf vmtk-1.0.1.tar.gz
mkdir vmtk-1.0.1-build
ccmake ../vmtk-1.0.1

VMTK comes with the "feature" of a so-called SuperBuild. It almost works and almost makes everything easy. Sadly it's not quite right.

  • First turn VMTK_USE_SUPERBUILD OFF and configure.
  • Then turn USE_SYSTEM_ITK and USE_SYSTEM_VTK to ON and configure
  • CMake should pick up the ITK_DIR and VTK_DIR correctly (I have $HOME/sw/lib/InsightToolkit and /usr/local/Canopy_64bit/User/lib/vtk-5.6 respectively). If not you will have to point it at them by hand.
  • Add the Canopy Python headers to the search path by setting CMAKE_CXX_FLAGS to -I/path/to/canopy/include/python2.7 - this will have a platform-specific value.
  • Probably set your CMAKE_INSTALL_PREFIX to where you install hand-built stuff (e.g. I use $HOME/sw)
  • Check again that VMTK_USE_SUPERBUILD is off!
  • Generate the Makefiles

Now you should be able to make install.

Add CMAKE_INSTALL_PREFIX/lib/vmtk to your PYTHONPATH environment variable.

Test by running e.g. vmtksurfaceviewer -ifile some_random_surface.stl. It should show the surface. (Press 'q' to quit)

You may need to fix the linking of VMTK (OS X) or set LD_LIBRARY_PATH (Linux) to include CMAKE_INSTALL_PREFIX/lib/vmtk

h2. HemeLB

The HemeLB master CMake file is able to download, build and install these but it may be easier to do them yourself.

Clone this wiki locally