[Paraview] Segfault in Python when importing paraview.servermanager and vtk in the wrong order

Maximilian Albert maximilian.albert at gmail.com
Thu Feb 7 18:15:56 EST 2013


Hi Pat,

many thanks for your reply and further thoughts. I haven't been able to
conduct more in-depth debugging yet, but from what you have said I'm not
even sure that's necessary since you say that incompabilities are to be
expected anyway.

However, does this mean that using Paraview in conjunction with any other
Python-based software that implicitly uses vtk is essentially impossible?
Since our code uses dolfin (which is part of the FEniCS package), which
imports vtk under the hood, there is no way for us to avoid the conflict
between the system-wide vtk module imported by dolfin and Paraview's
internal version. So shouldn't it be Paraview's responsibility to make sure
that it doesn't conflict with any other vtk modules? (Not sure if that's
possible at all though.) Otherwise, is there any clean way to "hide" the
system vtk from Paraview, even if it's only imported implicitly via some
third-party software?

Many thanks for any further comments and ideas!
Max

P.S.: Once I find the time I'm still happy to dig deeper in to the causes
of the segfault, but I'll wait for confirmation whether it's worth it or
not.


2013/2/1 Pat Marion <pat.marion at kitware.com>

> See, if you can "import vtk", then you're probably importing a version of
> the vtk libraries that are different than the ones ParaView uses.  What
> version of ParaView are you using and how did you install ParaView?  Did
> you build from source, install the binaries from paraview.org, or apt-get
> install?  And did you install python via apt-get?  What version of ubuntu?
>
> When you run "import vtk" you are indeed importing the system vtk, which
> is probably v5.8 or v5.10 or something like that.  But ParaView doesn't use
> major release versions of vtk, ParaView uses its own copy of VTK which is
> usually slightly different from the VTK major release versions.
>
> When you run scripts with paraview, most likely you're going to have to
> hide the system vtk so that it doesn't get imported, because most likely it
> is incompatible with your paraview install.
>
> Pat
>
>
>
> On Thu, Jan 31, 2013 at 8:52 PM, Maximilian Albert <
> maximilian.albert at gmail.com> wrote:
>
>> Hi Pat!
>>
>> [Apologies for sending you this twice, I accidentally didn't hit 'reply
>> all'.]
>>
>> Many thanks for the detailed reply! Indeed, I'm suspecting a conflict
>> between different vtk versions, but I don't know which ones could be the
>> culprits. I'm not sure the issue is actually related to the FEniCS package,
>> but will have to find a computer that doesn't have any FEniCS-related
>> packages installed to be sure. The reason why I'm saying that is because
>> the segfault already happens when I say:
>>
>> >>> import vtk
>> >>> import paraview.servermanager
>>
>> and the following indicates that it loads the system-wide vtk module (not
>> one that comes with FEniCS):
>>
>> >>> print vtk.__file__
>> /usr/lib/pymodules/python2.7/
>> vtk/__init__.pyc
>>
>> Out of interest, can you reproduce the segfault on your machine? I
>> presume you don't have FEniCS installed?
>>
>> The hints in your email are very helpful, and based on them I'll try to
>> put some more debugging info together as soon as I can (I won't be able to
>> do it before next week, however). Just to answer your questions about my
>> setup:
>>
>> I run my scripts from a regular python interpreter on the command line
>> (not from ParaView's python console or via pvpython). The output of
>> sys.path is attached below. I'll try the LD_DEBUG=lib approach next week
>> and will report if I can find anything.
>>
>> Many thanks again and kind regards,
>> Max
>>
>> ------------------------------
>> Output of sys.path:
>>
>> ['',
>> '/usr/lib/python2.7',
>> '/usr/lib/python2.7/plat-linux2',
>> '/usr/lib/python2.7/lib-tk',
>> '/usr/lib/python2.7/lib-old',
>> '/usr/lib/python2.7/lib-dynload',
>> '/usr/local/lib/python2.7/dist-packages',
>> '/usr/lib/python2.7/dist-packages',
>> '/usr/lib/python2.7/dist-packages/PIL',
>> '/usr/lib/python2.7/dist-packages/gst-0.10',
>> '/usr/lib/python2.7/dist-packages/gtk-2.0',
>> '/usr/lib/pymodules/python2.7',
>> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>> '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>> '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>> '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>> '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>> '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',
>> '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
>>
>>
>> 2013/1/30 Pat Marion <pat.marion at kitware.com>
>>
>>> Hi,
>>>
>>> It sounds like you probably have multiple versions of the vtk libraries
>>> installed someplace in your path.  Maybe the FEniCS package ships it's own
>>> version of the vtk libraries?  If FEniCS imports a different version of
>>> vtk, then paraview won't be able to import vtk within the same memory
>>> space, or maybe you can build FEniCS and ParaView to use the same version
>>> of vtk.
>>>
>>> Are you running this script in ParaView's python console, or from the
>>> command line?  If command line, what interpreter are you using, pvpython,
>>> or regular python?
>>>
>>> To collect some more debugging info, in the interpreter print out
>>> sys.path and tell us what that says.  Normally, you can't import vtk from
>>> the paraview console, you have to import paraview.vtk.  So if you can
>>> import vtk, it's probably grabbing it from a third party location, not the
>>> vtk installed with paraview.
>>>
>>> Also, try exporting LD_DEBUG=libs and then run paraview, that will print
>>> a lot of information to the terminal, it will tell you which libraries are
>>> being loaded.  See if any vtk libs are loaded from a location that is
>>> different than where paraview is installed.
>>>
>>> Pat
>>>
>>>
>>>
>>> On Wed, Jan 30, 2013 at 10:20 AM, Maximilian Albert <
>>> maximilian.albert at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> apologies for bumping my own message, but looking at the thread view
>>>> [1] of the mailing list archives I just realised that strangely my
>>>> email was filed under a completely unrelated thread (even though I
>>>> hadn't replied to any messages) and maybe this is why it got lost in
>>>> people's inboxes.
>>>>
>>>> So hopefully you won't mind me asking for help again - if anybody has
>>>> any thoughts on the paraview/vtk segfault described below, this would
>>>> be very much appreciated.
>>>>
>>>> Many thanks and kind regards,
>>>> Max
>>>>
>>>> [1] http://www.paraview.org/pipermail/paraview/2013-January/thread.html
>>>>
>>>>
>>>> 2013/1/21 Maximilian Albert <maximilian.albert at gmail.com>:
>>>> > Hi all,
>>>> >
>>>> > since this is my first post here, let me take the opportunity to thank
>>>> > all the developers for their hard work and and for an immensely useful
>>>> > piece of software! :)
>>>> >
>>>> > I'm writing becasue I am having a problem with a very annoying
>>>> > segfault related to Paraview scripting and hope someone can help me.
>>>> > The following two lines when executed in a Python interpreter lead to
>>>> > a segfault:
>>>> >
>>>> >>>> import vtk
>>>> >>>> import paraview.servermanager
>>>> > Segmentation fault (core dumped)
>>>> >
>>>> > However, if I do the imports the other way around then it works fine.
>>>> >
>>>> >>>> import paraview.servermanager
>>>> > paraview version 3.14.1, Date: 2012-02-17
>>>> >>>> import vtk
>>>> >>>>
>>>> >
>>>> > This looks like it should be a very common bug to hit, but I couldn't
>>>> > find anything on the web that looked similar. Does anybody have an
>>>> > idea what could be causing this and how to work around it? It is quite
>>>> > annoying because I'm using the FEniCS package [1] to run simulations
>>>> > that I would like to visualize using Paraview, but FEniCS internally
>>>> > imports vtk, so now all my simulation scripts have stopped working and
>>>> > produce crashes. So any help would be much appreciated.
>>>> >
>>>> > For the record, I am using Ubuntu 12.04.1 LTS with the standard
>>>> > Paraview version 3.14.1 that is shipped with it, but I also tried it
>>>> > on another computer with version 3.98.0 from the PPA [2], and the
>>>> > segfault also happens there. The backtrace from the coredump is
>>>> > attached below in case it can be of any help.
>>>> >
>>>> > Many thanks and best regards,
>>>> > Max
>>>> >
>>>> > [1] http://fenicsproject.org/
>>>> > [2] http://ppa.launchpad.net/gladky-anton/paraview/ubuntu
>>>> >
>>>> >
>>>> > === Gdb session output with backtrace ===
>>>> >
>>>> > $ GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
>>>> > Copyright (C) 2012 Free Software Foundation, Inc.
>>>> > License GPLv3+: GNU GPL version 3 or later <
>>>> http://gnu.org/licenses/gpl.html>
>>>> > This is free software: you are free to change and redistribute it.
>>>> > There is NO WARRANTY, to the extent permitted by law.  Type "show
>>>> copying"
>>>> > and "show warranty" for details.
>>>> > This GDB was configured as "x86_64-linux-gnu".
>>>> > For bug reporting instructions, please see:
>>>> > <http://bugs.launchpad.net/gdb-linaro/>...
>>>> > Reading symbols from /usr/bin/python...Reading symbols from
>>>> > /usr/lib/debug/usr/bin/python2.7...done.
>>>> > done.
>>>> > [New LWP 20514]
>>>> >
>>>> > warning: Can't read pathname for load map: Input/output error.
>>>> > [Thread debugging using libthread_db enabled]
>>>> > Using host libthread_db library
>>>> "/lib/x86_64-linux-gnu/libthread_db.so.1".
>>>> > Core was generated by `python'.
>>>> > Program terminated with signal 11, Segmentation fault.
>>>> > #0  0x0000000000000000 in ?? ()
>>>> > (gdb) bt
>>>> > #0  0x0000000000000000 in ?? ()
>>>> > #1  0x00007f7ad64812ff in
>>>> > vtkTCPNetworkAccessManager::vtkTCPNetworkAccessManager() () from
>>>> > /usr/lib/paraview/libvtkPVClientServerCore.so
>>>> > #2  0x00007f7ad648136d in vtkTCPNetworkAccessManager::New() () from
>>>> > /usr/lib/paraview/libvtkPVClientServerCore.so
>>>> > #3  0x00007f7ad6475a92 in vtkProcessModule::vtkProcessModule() () from
>>>> > /usr/lib/paraview/libvtkPVClientServerCore.so
>>>> > #4  0x00007f7ad6475b6d in vtkProcessModule::New() () from
>>>> > /usr/lib/paraview/libvtkPVClientServerCore.so
>>>> > #5  0x00007f7ad6475e1b in
>>>> > vtkProcessModule::Initialize(vtkProcessModule::ProcessTypes, int&,
>>>> > char**&) () from /usr/lib/paraview/libvtkPVClientServerCore.so
>>>> > #6  0x00007f7acc4e987c in vtkInitializationHelper::Initialize(int,
>>>> > char**, int, vtkPVOptions*) () from
>>>> > /usr/lib/paraview/libvtkPVServerManager.so
>>>> > #7  0x00007f7acc4ea62e in vtkInitializationHelper::Initialize(char
>>>> > const*, int, vtkPVOptions*) () from
>>>> > /usr/lib/paraview/libvtkPVServerManager.so
>>>> > #8  0x00007f7acc8d8b45 in ?? () from
>>>> > /usr/lib/python2.7/dist-packages/vtkPVServerManagerPython.so
>>>> > #9  0x0000000000497ea4 in PyEval_EvalFrameEx ()
>>>> > #10 0x000000000049f1c0 in PyEval_EvalCodeEx ()
>>>> > #11 0x00000000004a7f18 in PyImport_ExecCodeModuleEx ()
>>>> > #12 0x000000000053cde1 in load_source_module.39052 ()
>>>> > #13 0x000000000053d7db in import_submodule.39106 ()
>>>> > #14 0x00000000004fc1a3 in load_next.39111 ()
>>>> > #15 0x000000000053e266 in import_module_level.isra.3.39132 ()
>>>> > #16 0x00000000004c2e6b in builtin___import__.32787 ()
>>>> > #17 0x00000000004e9f36 in PyObject_Call ()
>>>> > #18 0x00000000004ea396 in PyEval_CallObjectWithKeywords ()
>>>> > #19 0x000000000049a4ed in PyEval_EvalFrameEx ()
>>>> > #20 0x000000000049f1c0 in PyEval_EvalCodeEx ()
>>>> > #21 0x00000000004a9d0f in PyRun_InteractiveOneFlags ()
>>>> > #22 0x00000000004aa075 in PyRun_InteractiveLoopFlags ()
>>>> > #23 0x00000000004aa328 in PyRun_AnyFileExFlags ()
>>>> > #24 0x00000000004aa8bd in Py_Main ()
>>>> > #25 0x00007f7af885f76d in __libc_start_main () from
>>>> > /lib/x86_64-linux-gnu/libc.so.6
>>>> > #26 0x000000000041b9b1 in _start ()
>>>> _______________________________________________
>>>> 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 ParaView Wiki at:
>>>> http://paraview.org/Wiki/ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130207/d0b86813/attachment-0001.htm>


More information about the ParaView mailing list