[Pythonmac-SIG] VTK+Python build instructions

Robert Kern rkern at ucsd.edu
Sun Oct 10 15:34:32 CEST 2004


I rebuilt VTK and its Python wrappers so I could run Mayavi 
<URL:http://mayavi.sf.net> and wrote up the process that I used for 
everyone's edification. I am using Panther and the standard Python 2.3.


Building VTK+Python on Panther
------------------------------

Download VTK 4.4 from
http://public.kitware.com/VTK/get-software.php

Download CMake binary installer from
http://www.cmake.org/HTML/Download.html

Attach the CMake disk image and install the package. You will now have, 
among other things, programs cmake and ccmake in /usr/local/bin . Make 
sure /usr/local/bin is in your PATH.

Unpack the VTK source somewhere.

     $ cd ~/src
     $ tar zxf ~/downloads/VTK-4.4-LatestRelease.tar.gz
     $ cd VTK

Make a subdirectory named "build".

     $ mkdir build
     $ cd build

Run ccmake with the main VTK directory as its argument.

     $ ccmake ..

You should now be in a curses-based text interface. With my Terminal 
color settings, I can't see if the options are highlighted as one moves 
the cursor, so just look at the bar near the bottom to see which option 
is currently highlighted. There is also a wxWidgets GUI interface, but I 
can't get it to run properly.

Press [c] to start configuring.

Toggle BUILD_SHARED_LIBS on.

Keep VTK_USE_CARBON on. Do not use VTK_USE_COCOA (The Cocoa 
implementation is not compatible with Python, yet).

Toggle VTK_USE_HYBRID on (Mayavi uses the vtkHybrid kit).

Toggle VTK_WRAP_PYTHON on.

Toggle VTK_WRAP_TCL on (Mayavi needs it).

Press [c] to configure. It should have found your framework Python. If 
you have installed TclTkAqua, it should also have found the appropriate 
frameworks.

If there are no errors, press [g] to generate the makefiles and exit. If 
nothing happens press [c] again and try pressing [g] once more. You may 
have to go back and forth pressing [c] and [g] until all information is 
found. Intuitive, yes?

Execute make and wait until it finishes. This takes a long time. Make 
some coffee. In fact, go to Colombia, harvest the beans, roast them, 
grind them, and brew your cup of coffee. When you get back, the build 
might be finished.

"make install" will install VTK into /usr/local (or whatever directory 
you told it to install to).

Change to the Python wrapper directory and install the Python wrappers.

     $ cd Wrapping/Python
     $ sudo python setup.py install

Add /usr/local/lib/vtk to your DYLD_LIBRARY_PATH. You will want to do 
this in your ~/.bashrc as well.

     $ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib/vtk

You're done!

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter


More information about the Pythonmac-SIG mailing list