# libvtkRenderingTk-9.2.so : No such file or directory

**URL:** https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994
**Category:** Support
**Created:** [March 16, 2023, 8:49pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994 "2023-03-16T20:49:47Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 16, 2023, 8:49pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/1 "2023-03-16T20:49:47Z")

</div>

Dear VTK developers,

I am encountering an issue with the [libvtkRenderingTk-9.2.so](http://libvtkrenderingtk-9.2.so/) library file when using VTK with Python. Specifically, I am receiving the following error message:

[libvtkRenderingTk-9.2.so](http://libvtkrenderingtk-9.2.so/): cannot open shared object file: No such file or directory

I have followed the installation instructions provided in the VTK documentation. However, I am still encountering this error.

I would appreciate any assistance or guidance you can provide in resolving this issue. Please let me know if you require any additional information from me.

Thank you for your time and attention.

Sincerely

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 17, 2023, 12:45am UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/2 "2023-03-17T00:45:05Z")

</div>

That library isn’t included in any of the VTK binary packages. VTK’s RenderingTk module is only available if it’s configured when VTK is built from source code.

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 17, 2023, 1:40pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/3 "2023-03-17T13:40:33Z")

</div>

I don’t understand; I am on ubuntu 20.04 and trying to build a GUI with Python 3.8.10, VTK 9.0.1, and Tkinter. Using VTK and Tkinter separately works well, but I struggle to combine them.

I have tried it with a vtkTkRenderWindowInteractor and a vtkTkRenderWidget so far, but I always obtain the error:

\_tkinter.TclError: couldn’t load file “libvtkRenderingTk-9.0.so”: libvtkRenderingTk-9.0.so: cannot open shared object file: No such file or directory

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 17, 2023, 1:59pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/4 "2023-03-17T13:59:10Z")

</div>

That library, ` libvtkRenderingTk-9.2.so`, is not included with the VTK binary packages. How did you install VTK 9.0.1? Was it pip, conda, or a .deb with apt-get? Or did you build VTK 9.0.1 from source code?

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 18, 2023, 9:32pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/5 "2023-03-18T21:32:20Z")

</div>

I tried installing VTK 9.0.1 with pip, and apt-get, but none of these methods seemed to include the libvtkRenderingTk-9.2.so library. Then, I tried to compile VTK 9.0.1 from source code, but I couldn’t resolve the issue of the missing library.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 18, 2023, 10:45pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/6 "2023-03-18T22:45:07Z")

</div>

The pip package definitely doesn’t include `libvtkRenderingTk-9.2.so`, and I don’t think the deb does either.

For building from source, Tk must be enabled with `VTK_USE_TK=ON`. I recommend these options for VTK 9.0.1, it that’s the version of VTK that you need:

```plaintext
cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++-9 -DCMAKE_C_COMPILER=/usr/bin/gcc-9 \
 -DBUILD_SHARED_LIBS=ON -DVTK_BUILD_TESTING=OFF -DVTK_PYTHON_VERSION=3 \
 -DCMAKE_BUILD_TYPE=Release -DVTK_WRAP_PYTHON=ON -DVTK_USE_TK=ON \
 ../VTK-9.0.1

```

It will also be necessary to use apt-get to install the `tk-dev` and `tcl-dev` packages before running cmake.

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 21, 2023, 5:57pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/7 "2023-03-21T17:57:28Z")

</div>

I am writing to provide an update on the issue I am encountering with the installation of vtk python.  
As you recommended, I have installed the tk-dev and tcl-dev packages using the following commands:  
sudo apt-get install tk-dev  
sudo apt-get install tcl-dev

I then cloned the vtk repository and built VTK from source code using the options you provided:

git clone --recursive [https://gitlab.kitware.com/vtk/vtk.git](https://gitlab.kitware.com/vtk/vtk.git)  
cd vtk  
mkdir build

cmake -DCMAKE\_CXX\_COMPILER=/usr/bin/g+±9 -DCMAKE\_C\_COMPILER=/usr/bin/gcc-9 -DBUILD\_SHARED\_LIBS=ON -DVTK\_BUILD\_TESTING=OFF -DVTK\_PYTHON\_VERSION=3 -DCMAKE\_BUILD\_TYPE=Release -DVTK\_WRAP\_PYTHON=ON -DVTK\_USE\_TK=ON …/vtk

Unfortunately, I am still encountering the error message “[libvtkRenderingTk-9.0.so](http://libvtkRenderingTk-9.0.so): cannot open shared object file: No such file or directory” when I try to install vtk python.

I wanted to inform you that I have already tried these steps and ask if you have any additional suggestions or recommendations for resolving this issue.

Thank you for your time and assistance.

Best regards,

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 21, 2023, 7:23pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/8 "2023-03-21T19:23:00Z")

</div>

In order to help me to resolve this for you, please to the following:

1. Search your build tree for `libvtkRenderingTk-9.0.so`. It should be somewhere in the `lib` directory or one of the `lib` subdirectories. If it isn’t there, then we can see if other options must be added to ‘CMake’. The instructions that I provided were for VTK 9.0, I can’t remember if VTK master branch needs different options.
2. If you can find `libvtkRenderingTk-9.0.so`, then the problem is that Python isn’t able to load it, you might be able to fix it by putting it somewhere in Tcl’s load path.

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 22, 2023, 5:22pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/9 "2023-03-22T17:22:18Z")

</div>

Thank you for your response. I have searched the build directory for the file [libvtkRenderingTk-9.0.so](http://libvtkRenderingTk-9.0.so), but I could not find it.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 22, 2023, 6:41pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/10 "2023-03-22T18:41:38Z")

</div>

You can try adding this when you run cmake:

```plaintext
-DVTK_MODULE_ENABLE_VTK_RenderingTk=YES

```

Also, you can try to specifically build the library target when you run make:

```plaintext
 make RenderingTk

```

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 22, 2023, 11:16pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/11 "2023-03-22T23:16:59Z")

</div>

This creates [libvtkRenderingTk-9.2.so](http://libvtkRenderingTk-9.2.so), the error is about [libvtkRenderingTk-9.0.so](http://libvtkRenderingTk-9.0.so): cannot open shared object file: No such file or directory

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 23, 2023, 12:27am UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/12 "2023-03-23T00:27:18Z")

</div>

Are you running a different VTK than the one you built?

Please show me the exact command-line that you run when you get the error.

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 23, 2023, 9:59pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/13 "2023-03-23T21:59:44Z")

</div>

Dear [David Gobbi](https://discourse.vtk.org/u/dgobbi)

I apologize for the confusion, the vtk is now correctly installed

I have attempted to use VTK to render the WRL file in a Tkinter frame, but I encountered some issues with the vtkTkRenderWindowInteractor widget.  
Specifically, I received a “vtkTkRenderWindowInteractor object has no attribute ‘pack’” error message when I attempted to pack the widget in the frame.

Would you happen to know if there is a way to display a WRL file in a Tkinter frame using VTK or any other library? Any guidance or resources you could provide would be greatly appreciated.  
Thank you for your time and assistance.

I look forward to hearing from you soon.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 24, 2023, 1:40am UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/14 "2023-03-24T01:40:41Z")

</div>

I don’t have a simple example for vtkTkRenderWindowInteractor, but I have one for vtkTkRenderWidget. This works on my linux system:

```python
import tkinter
from vtkmodules.tk.vtkTkRenderWidget import vtkTkRenderWidget

from vtkmodules.vtkFiltersSources import vtkConeSource
from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper, vtkRenderer
# load implementations for rendering and interaction factory classes
import vtkmodules.vtkRenderingOpenGL2
import vtkmodules.vtkInteractionStyle

def vtkRenderWidgetConeExample():
    """Just a simple example.
    """
    # create root window
    root = tkinter.Tk()

    # create vtkTkRenderWidget
    pane = vtkTkRenderWidget(root,width=300,height=300)
    pane.bind('<Configure>', lambda e,pane=pane: pane.Expose())

    ren = vtkRenderer()
    pane.GetRenderWindow().AddRenderer(ren)

    cone = vtkConeSource()
    cone.SetResolution(8)

    coneMapper = vtkPolyDataMapper()
    coneMapper.SetInputConnection(cone.GetOutputPort())

    coneActor = vtkActor()
    coneActor.SetMapper(coneMapper)

    ren.SetBackground(0.0,0.3,0.1)
    ren.AddActor(coneActor)

    # pack the pane into the tk root
    pane.pack(expand='true', fill='both')

    # start the tk mainloop
    root.mainloop()

if __name__ == " __main__":
    vtkRenderWidgetConeExample()

```

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 24, 2023, 1:55am UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/15 "2023-03-24T01:55:14Z")

</div>

In my linux system, I get the error:

_2023-03-24 01:52:14.474 ( 0.079s) [9433D740] vtkTkRenderWidget.cxx:601 WARN| A TkRenderWidget is being destroyed before it associated vtkRenderWindow is destroyed.This is very bad and usually due to the order in which objects are being destroyed.Always destroy the vtkRenderWindow before destroying the user interface components._  
_Traceback (most recent call last):_  
_File “wrl.py”, line 83, in_   
_vtkRenderWidgetConeExample()_  
_File “wrl.py”, line 33, in vtkRenderWidgetConeExample_  
_pane = vtkTkRenderWidget(root,width=300,height=300)_  
_File “/home/dell/.local/lib/python3.8/site-packages/vtkmodules/tk/vtkTkRenderWidget.py”, line 108, in **init** _  
_tkinter.Widget. **init** (self, master, ‘vtkTkRenderWidget’, cnf, kw)_  
_File “/usr/lib/python3.8/tkinter/ **init**.py”, line 2572, in **init** _  
_self.tk.call(_  
_\_tkinter.TclError_

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 24, 2023, 2:06am UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/16 "2023-03-24T02:06:36Z")

</div>

I need more information. Does it do this when you start the program, or does it do this when you quit the program?

It doesn’t happen when I run that program.

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 24, 2023, 9:57pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/17 "2023-03-24T21:57:34Z")

</div>

I am running the program on a Ubuntu 20.04 machine with Python 3.8. When I run the program using the command ‘python wrl.py’, I encounter the error message at the startup

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 24, 2023, 10:33pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/18 "2023-03-24T22:33:14Z")

</div>

That’s strange! Many years ago, I saw that error (_TkRenderWidget is being destroyed before it associated vtkRenderWindow is destroyed._) but only when the program quit, never when the program started.

Are your running the VTK that you build from source? In the error message, it says _File “/home/dell/.local/lib/python3.8/site-packages/vtkmodules/tk/vtkTkRenderWidget.py”, line 108_, which looks like a directory for pip. If you are mixing parts of the VTK you build from source with a VTK that you installed with pip, then maybe that’s why you are getting an error.

---

<div class="post-metadata">

### Author: ![Assia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Assia](https://discourse.vtk.org/u/Assia)
#### Post date: [March 25, 2023, 3:15pm UTC](https://discourse.vtk.org/t/libvtkrenderingtk-9-2-so-no-such-file-or-directory/10994/19 "2023-03-25T15:15:16Z")

</div>

Yes, you are right - I have successfully reinstalled VTK from the source code and it is now working perfectly.  
Thank you for your previous guidance and support in helping me with this issue.  
I am particularly grateful for how you took the time to answer all my questions and explain the technical details of the installation.
