Error importing vtkTkRenderWindowInteractor in vtk 8.2.0

Hi, David

The result of “otool -l” is as below.

And the related cmake config is as below:

Since I want to use the virtual environment(…/anaconda2/envs/vtk-8.2.1) in anaconda, how should I set these parameters?

Thank you sooooooo much.

Best,

Julie

You have to give “otool -l” the path to a library or executable:

otool -l <object file>

See “man otool” for more information.

Hi, David

I just read the description of otool command. But I am really newbie on this kind of thing. I am still feel lost. Could you give me some hints of which library (or executable) should I check? “ libvtkRenderingPythonTkWidgets-8.2.dylib ”? And what information should I find in the result?

By the way, “ _tkinter.cpython-36m-darwin.so ” is under “ ../anaconda2/envs/vtk-8.2.1/lib/python3.6/lib-dyload ” .

Thanks.

Check _tkinter.cpython-36m-darwin.so and libvtkRenderingPythonTkWidgets-8.2.dylib to see what tcl and tk libraries they link to at runtime.

Hi, David,

They do link to different Tcl and Tk. Then how should I configure cmake?

The result is as below:

  1. libvtkRenderingPythonTkWidgets-8.2.dylib :

  1. _tkinter.cpython-36m-darwin.so :

Thanks

Change the cmake settings so that VTK uses the same libtcl and libtk that _tkinter links to (of course, make sure that VTK uses the tcl/tk include directories that match those same libraries!)

The output from otool shows that _tkinter links to @rpath/libtk8.6.dylib, and it will also show what LC_RPATH is set to, so that will give you the full path to libtk8.6.dylib and libtcl8.6.dylib.

After rebuilding, you might also have to set the LC_RPATH in libvtkRenderingPythonTkWidgets-8.2.dylib so that it matches the LC_RPATH used by the anaconda _tkinter. On OS X, the program install_name_tool can be used to manipulate paths that are embedded within libraries and executables.

Do a google of “dylib rpath” for an introduction to the wonderful world of rpaths and how they can be used.

Hi David,

The problem is solved, like magic!
I don’t know how to express my gratitude! Thank you soooooooooo much.
:kissing_heart::kissing_heart::kissing_heart::kissing_heart::kissing_heart::kissing_heart::partying_face::partying_face::partying_face::partying_face:
Best regards,
Julie

Nice! Let me breathe a little sigh of relief…