[vtkusers] no module named vtk
David Feng
dfeng at cs.unc.edu
Wed Mar 10 21:57:42 EST 2010
Well, you could always build it yourself instead of using the macport.
This isn't the right answer, though. I would first make sure that
the python wrappings are getting built, since vtkpython gets built
with them. Wherever the shared libraries are getting built, you
should find python versions (i.e. vtkGraphicsPython.dylib). If those
are there then the following from VTK/Wrapping/Python/README.txt
probably applies:
Using the package from the source build without installing it
system wide and without using `vtkpython`. This is most
useful when you build VTK off a CVS checkout and do not want
to install it system wide and still want to use the vanilla
Python interpreter. This is also useful if you are not the
administrator of the machine you are using/building VTK on.
Unix/Linux
Under Unix the way to do this is to set the `LD_LIBRARY_PATH`
(or equivalent) to the directory that contains the libvtk*.so
libraries. You must also set your `PYTHONPATH` to *both* the
directory that contains all the `libvtk*Python.so` files *and*
the `Wrapping/Python` directory. Under bash/sh something like
so needs to be done::
$ export LD_LIBRARY_PATH=$LIBRARY_OUTPUT_PATH
$ export PYTHONPATH=$VTK_ROOT/Wrapping/Python:${LIBRARY_OUTPUT_PATH}
and under csh::
$ setenv LD_LIBRARY_PATH ${LIBRARY_OUTPUT_PATH}
$ setenv PYTHONPATH ${VTK_ROOT}/Wrapping/Python:${LIBRARY_OUTPUT_PATH}
where VTK_ROOT is the directory where VTK is being built
(`VTK_BINARY_DIR`) and `LIBRARY_OUTPUT_PATH` (this variable is
set in `CMakeCache.txt`) is where the libraries are built.
Change this to suit your configuration.
David
On Wed, Mar 10, 2010 at 9:18 AM, Aron Wahlberg <aron at simula.no> wrote:
> Thanks for answering.
>
> Well, I don't seem to have vtkpython either :S
>
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from vtkpython import *
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named vtkpython
>>>>
> Aron-Wahlbergs-MacBook-Pro:~ aron$ which vtkpython
> Aron-Wahlbergs-MacBook-Pro:~ aron$ locate vtkpython
> Aron-Wahlbergs-MacBook-Pro:~ aron$ vtkpython
> -bash: vtkpython: command not found
> Aron-Wahlbergs-MacBook-Pro:~ aron$
>
> Aron
>
> On 4 Mar, 2010, at 17:36, David Feng wrote:
>
>> You have to put the vtk libraries on the python path. I can never
>> remember how to do this, but if you run your script with vtkpython
>> instead of python, 'import vtk' should work. vtkpython sets up your
>> python path for you, I believe. A quick scan of the vtk-devel macport
>> indicates that vtkpython is getting installed, so you should be fine.
>>
>> David
>>
>> On Wed, Mar 3, 2010 at 6:56 AM, Aron Wahlberg <aron at simula.no> wrote:
>>> I get the following error when I try to import vtk
>>>
>>> Aron-Wahlbergs-MacBook-Pro:vtk-5.4 aron$ python -c 'import vtk'
>>> Traceback (most recent call last):
>>> File "<string>", line 1, in <module>
>>> ImportError: No module named vtk
>>>
>>>
>>> I have installed vtk via macports and have the following version:
>>>
>>> port installed vtk-devel
>>> The following ports are currently installed:
>>> vtk-devel @5.4.2_1+cocoa+data+doc+examples+shared+testing (active)
>>>
>>> I'm somewhat of a newbie on those things and would appreciate any help to track down the problem.
>>>
>>> Aron
>>> _______________________________________________
>>> 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
>>>
>>
>>
>>
>> --
>> http://www.cs.unc.edu/~dfeng
>
>
--
http://www.cs.unc.edu/~dfeng
More information about the vtkusers
mailing list