[vtkusers] Fatal Python error: PyThreadState_Get: no current thread

Jayson Kempinger jkempinger at decisionvis.com
Mon Apr 10 10:11:15 EDT 2017


Hi Isaiah, 

Thanks for the response!

I've pasted below the output from running python3, vtkpython, and both of those commands under lldb.  I've never used vmmap before, so I'm not sure how to attach to the process after it crashes, and running vmmap on a running vtkpython, before importing vtk, doesn't show anything that seems out of the ordinary (see output at https://pastebin.com/j5ANwNpv).

I'm not sure where to go from here as I get different results under lldb and different lldb output for running python3 and vtkpython.  I've also tried vtk-7.0.0 but I get the same results, just with "-7.0.0.dylib".

All of the image files that weren't found do exist on the system:

> find /Users/jkempinger/build -iname "libvtkCommonCorePython35D-7.1.1.dylib" -exec ls -l '{}' \;
-rwxr-xr-x  1 jkempinger  staff  2964960 Apr 10 09:46 /Users/jkempinger/build/lib/libvtkCommonCorePython35D-7.1.1.dylib
> find /Users/jkempinger/build -iname "libvtkWrappingPython35Core-7.1.1.dylib" -exec ls -l '{}' \;
-rwxr-xr-x  1 jkempinger  staff  3052644 Apr 10 09:46 /Users/jkempinger/build/lib/libvtkWrappingPython35Core-7.1.1.dylib

and I believe my environment is set correctly:

> echo $DYLD_LIBRARY_PATH
/Users/jkempinger/build/lib:/Users/jkempinger/build/Qt5.7.0/5.7/clang_64/lib
> echo $LD_LIBRARY_PATH
/Users/jkempinger/build/lib:/Users/jkempinger/build/Qt5.7.0/5.7/clang_64/lib
> echo $PYTHONPATH
/Users/jkempinger/build/lib/python3.5/site-packages


When running python3:

Python 3.5.2 (default, Apr  7 2017, 11:18:59)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Fatal Python error: PyThreadState_Get: no current thread
zsh: abort      /Users/jkempinger/build/bin/python3


When running vtkpython:

vtk version 7.1.1
Python 3.5.2 (default, Apr  7 2017, 11:18:59)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Fatal Python error: PyThreadState_Get: no current thread
zsh: abort      /Users/jkempinger/build/bin/vtkpython


When running python3 under lldb and importing vtk:

(lldb) target create "/Users/jkempinger/build/bin/python3"
Current executable set to '/Users/jkempinger/build/bin/python3' (x86_64).
(lldb) run
Process 48987 launched: '/Users/jkempinger/build/bin/python3' (x86_64)
Python 3.5.2 (default, Apr  7 2017, 11:18:59)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
  File "/Users/jkempinger/build/lib/python3.5/site-packages/vtk/vtkCommonCore.py", line 5, in <module>
    from .vtkCommonCorePython import *
ImportError: dlopen(/Users/jkempinger/build/lib/python3.5/site-packages/vtk/vtkCommonCorePython.so, 2): Library not loaded: libvtkCommonCorePython35D-7.1.1.dylib
  Referenced from: /Users/jkempinger/build/lib/python3.5/site-packages/vtk/vtkCommonCorePython.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jkempinger/build/lib/python3.5/site-packages/vtk/__init__.py", line 41, in <module>
    from .vtkCommonCore import *
  File "/Users/jkempinger/build/lib/python3.5/site-packages/vtk/vtkCommonCore.py", line 9, in <module>
    from vtkCommonCorePython import *
ImportError: No module named 'vtkCommonCorePython'
>>>


When running vtkpython in lldb:

(lldb) target create "/Users/jkempinger/build/bin/vtkpython"
Current executable set to '/Users/jkempinger/build/bin/vtkpython' (x86_64).
(lldb) run
Process 49021 launched: '/Users/jkempinger/build/bin/vtkpython' (x86_64)
dyld: Library not loaded: libvtkWrappingPython35Core-7.1.1.dylib
  Referenced from: /Users/jkempinger/build/bin/vtkpython
  Reason: image not found
Process 49021 stopped
* thread #1, stop reason = signal SIGABRT
    frame #0: 0x00000001000359ee dyld`__abort_with_payload + 10
dyld`__abort_with_payload:
->  0x1000359ee <+10>: jae    0x1000359f8               ; <+20>
    0x1000359f0 <+12>: movq   %rax, %rdi
    0x1000359f3 <+15>: jmp    0x100035300               ; cerror_nocancel
    0x1000359f8 <+20>: retq
(lldb) image list
[  0] 08649D04-B82E-328E-AD4C-CA3C421293E5 0x0000000100000000 /Users/jkempinger/build/bin/vtkpython
[  1] 8239D0D7-66F6-3C44-A77F-586F74525DA3 0x000000010000c000 /usr/lib/dyld
(lldb)


Any suggestions on what to try next?

Thanks!
Jayson

> On Apr 7, 2017, at 10:45 PM, Isaiah Norton <isaiah.norton at gmail.com> wrote:
> 
> You could debug with vmmap, to see which shared libraries are loaded in the process.
> Or start under lldb and look at output of `image list` when it aborts.
> 
> Isaiah
> 
> On Fri, Apr 7, 2017 at 4:26 PM, Jayson Kempinger <jkempinger at decisionvis.com <mailto:jkempinger at decisionvis.com>> wrote:
> Hi, I’m trying to install VTK on an iMac running 10.12.  I’m using python 3.5.2, compiled from source, and am compiling VTK-7.1.1 from source.
> 
> When I run python3 (with -v and -d) and try to import vtk python crashes with the following error:
> 
> >>> import vtk
> # /Users/username/build/lib/python3.5/site-packages/vtk/__pycache__/__init__.cpython-35.pyc matches /Users/username/build/lib/python3.5/site-packages/vtk/__init__.py
> # code object from '/Users/username/build/lib/python3.5/site-packages/vtk/__pycache__/__init__.cpython-35.pyc'
> # /Users/username/build/lib/python3.5/__pycache__/__future__.cpython-35.pyc matches /Users/username/build/lib/python3.5/__future__.py
> # code object from '/Users/username/build/lib/python3.5/__pycache__/__future__.cpython-35.pyc'
> import '__future__' # <_frozen_importlib_external.SourceFileLoader object at 0x1073032e8>
> # /Users/username/build/lib/python3.5/site-packages/vtk/__pycache__/vtkCommonCore.cpython-35.pyc matches /Users/username/build/lib/python3.5/site-packages/vtk/vtkCommonCore.py
> # code object from '/Users/username/build/lib/python3.5/site-packages/vtk/__pycache__/vtkCommonCore.cpython-35.pyc'
> Fatal Python error: PyThreadState_Get: no current thread
> zsh: abort      python3 -v -d
> 
> From what I’ve read online it sounds like this is due to a python mismatch, i.e. building VTK against a different python version than the version it is run under.  I’ve searched through the advanced cmake configuration and can’t find any reference to the system built-in python2 interpreter.
> 
> Any suggestions on what might be going wrong?
> 
> Thanks!
> Jayson
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com/>
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <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 <http://www.vtk.org/Wiki/VTK_FAQ>
> 
> Search the list archives at: http://markmail.org/search/?q=vtkusers <http://markmail.org/search/?q=vtkusers>
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers <http://public.kitware.com/mailman/listinfo/vtkusers>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170410/f7b04b50/attachment.html>


More information about the vtkusers mailing list