[vtkusers] Building/installing VTK 5.4.2 on Ubuntu 9.10 (was: Python compass widget example)

David Gobbi david.gobbi at gmail.com
Sat Jan 30 13:27:31 EST 2010


Hi Anders,

I'm sure there used to be something about this one the website, but it
seems to be gone.  So here is a brief run-through.

The easiest way to get things working is to set environment variables.
 If your VTK was built in /home/user/VTKbin you would do the
following:

In a bash shell (the default for most linux systems):

export VTK_DIR=/home/user/VTKbin
export LD_LIBRARY_PATH=${VTK_DIR}/bin
export PYTHONPATH=${VTK_DIR}/bin;${VTK_DIR}/Wrapping/Python

You can put these in your ~/.bashrc in order to set these variable
automatically whenever you start a terminal.  On the Mac, you would
use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH but everything else
is the same.

The other approach is to do a "make install", since /usr/local/lib
should already be part of the runtime library path, and all the python
modules should automatically go somewhere in Python's load path. But
generally, setting environment variables is the easiest way to set
things up for a single person.

   David




On Sat, Jan 30, 2010 at 10:50 AM, Anders Wallin
<anders.e.e.wallin at gmail.com> wrote:
> Thanks! This now allows me to run both ccmake and make without errors.
>
> Then we come to the install part...
> I navigate to my build dir and there: VTK/VTK-linux/Wrapping/Python
> and run:
> sudo python setup.py install
>
> well now what?, I start a python shell and type
> import vtk
> which results in:
>>>> import vtk
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "vtk/__init__.py", line 41, in <module>
>    from common import *
>  File "vtk/common.py", line 7, in <module>
>    from libvtkCommonPython import *
> ImportError: No module named libvtkCommonPython
>
>
>
> Anders
> (wishing someone had "step-by-step, For Dummies" build/installation
> instructions)
>
>
>
>> You really should not confgure (run cmake or ccmake) in the source
>> tree. This will cause you many headaches down the road.
>>
>> To recover from this, you should delete the entire vtk source tree.
>> Checkout vtk again
>>
>> Make a binary (build) directory. I always make by build directory at
>> the same level as my source tree e.g.
>>
>> mkdir VTK-linux
>> cd VTK-linux
>> ccmake ../VTK
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list