[vtkusers] Python and VTK

David Gobbi david.gobbi at gmail.com
Wed Sep 27 11:52:03 EDT 2017


Hi Nick,

Also check CMAKE_BUILD_TYPE.  If it is set like the following, then your
compile was done with no optimization and the resulting VTK will be rather
slow:

  CMAKE_BUILD_TYPE:STRING=

You should make sure that this is set to "Release" or "RelWithDebInfo"
(unless you specifically want a debug build, in which case you should set
it to "Debug").


Building VTK with the Python wrappers requires BUILD_SHARED_LIBS=ON in the
general case.  This is known by everyone who builds the VTK Python wrappers
on a regular basis, but perhaps it isn't documented as well as it should be.

However, cmake does not force shared libraries when VTK_WRAP_PYTHON is on
because there are some situations where static libraries make sense with
Python, e.g. when someone wants to build their very own Python executable
with all the libraries built-in.

 - David


On Wed, Sep 27, 2017 at 9:03 AM, Nick Torenvliet <natorenvliet at gmail.com>
wrote:

> Hey Dan,
>
> It looks like it worked.
>
> On my second last pass, I was compiling "without shared libraries" and got
> some error in the make output indicating something like "I don't want to do
> that because it requires shared libraries."  I had "shared libraries" as
> negative in the config step.
>
> On my last ccmake I configured for "with shared libraries" and my last
> compile just finished with no errors.
>
> It looks like somewhere in the ccmake process, a dependency on "shared
> libraries" exists,  and config passes with no errors even if "shared
> libraries" is off - this leads to a fail at compile time.
>
> Seems like a hard to reproduce error, let me know if you want any of my
> local files to document a possible bug in the compile process.
>
> Regards,
>
> Nick
>
> On Wed, Sep 27, 2017 at 10:36 AM, Dan Lipsa <dan.lipsa at kitware.com> wrote:
>
>> Indeed, that's what you probably need to do. Look at the symbols not
>> found and search on the web to see what packages they are part of.
>>
>> On Wed, Sep 27, 2017 at 10:04 AM, Nick Torenvliet <natorenvliet at gmail.com
>> > wrote:
>>
>>> Ooops!
>>>
>>> Hey Dan, thanks!  It is now working fine - guess I need to bone up on my
>>> ccmake skills.
>>>
>>> Another question then,
>>>
>>> A couple of the examples are coughing with:
>>>
>>> _tkinter.TclError: couldn't load file "libvtkRenderingPythonTkWidget
>>> s-8.0.so": libvtkRenderingPythonTkWidgets-8.0.so: cannot open shared
>>> object file: No such file or directory
>>>
>>> So to address this I am attempting to rebuild with GROUP_TK set on.
>>>
>>> Now I get the following compile error:
>>> [ 87%] Linking CXX executable ../../../../bin/vtkInteraction
>>> WidgetsCxxTests
>>> [ 87%] Built target vtkInteractionWidgetsCxxTests
>>> Makefile:138: recipe for target 'all' failed
>>> make: *** [all] Error 2
>>>
>>> I'm going to hunt around and probably install twenty or so random
>>> packages that look anything like what I find @ 138 but if anyone knows what
>>> I need to do, please let me know.
>>>
>>> Thanks,
>>>
>>> Nick
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Wed, Sep 27, 2017 at 9:26 AM, Dan Lipsa <dan.lipsa at kitware.com>
>>> wrote:
>>>
>>>> Nick,
>>>>
>>>> You should have VTK_PYTHON_VERSION=3 and VTK_WRAP_PYTHON=ON
>>>> You should use vtkpython. This has all the right paths to see the VTK
>>>> library.
>>>>
>>>> Take a look in your CMakeCache.txt and search for python to see your
>>>> python related variables. If some point to python2 paths delete them and
>>>> reconfigure and rebuild your VTK.
>>>>
>>>> Hope this helps,
>>>> Dan
>>>>
>>>>
>>>> On Tue, Sep 26, 2017 at 9:32 PM, Nick Torenvliet <
>>>> natorenvliet at gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm running ubuntu 16.04 with python3.
>>>>>
>>>>> After compiling and installing vtk8 the following occurs.
>>>>>
>>>>> 1- I have an issue with doxygen / docs during vtk make install
>>>>>
>>>>> After make install
>>>>>
>>>>> 1- I fire up a python 3 window and can import vtk, but cannot call any
>>>>> of the vtk functions except for those beginning with __
>>>>> 2- I fire up my python2 window and cannot import vtk at all
>>>>> 3- I fire up vtkpython, which looks to be p3.5 and cannot import vtk
>>>>> at all
>>>>>
>>>>> I feel like I'm missing a major step hooking the wrappers up into the
>>>>> python environment.
>>>>>
>>>>> My desired functionality is to have vtk in python 3.5, optimally in a
>>>>> venv if possible.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> Nick
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170927/cbb1818f/attachment.html>


More information about the vtkusers mailing list