# Python VTK for visualization in a jupyter notebook running on docker

**URL:** https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622
**Category:** Support
**Created:** [March 27, 2019, 8:02pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622 "2019-03-27T20:02:53Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![harp](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/h/ecd19e/32.png) [@harp](https://discourse.vtk.org/u/harp)
#### Post date: [March 27, 2019, 8:02pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/1 "2019-03-27T20:02:53Z")

</div>

Hi - I’d like to use python vtk to visualize objects in a jupyter notebook. I am able to run the notebook locally on my machine and it works. However, I am unable to run it when the jupyter notebook is running in docker (ubuntu 16.04). Has anybody got this working ?

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [March 31, 2019, 11:44pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/2 "2019-03-31T23:44:59Z")

</div>

I’ve been successful with MyBinder! You’ll have to install `libgl1-mesa-dev` and `xvfb` to your docker then run a start script similar to the following to initialize the display when the session starts:

```bash
#!/bin/bash
export DISPLAY=:99.0
which Xvfb
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
exec "$@"

```

You can try to follow what I’ve done for this repository: [https://github.com/OpenGeoVis/PVGeo-Examples](https://github.com/OpenGeoVis/PVGeo-Examples)

_Note that I’m am currently working on that repo and its contents are subject to change_

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [April 7, 2019, 6:04pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/3 "2019-04-07T18:04:51Z")

</div>

**Update:** I’ve created a cookie cutter to quickly make a MyBinder project: [https://github.com/vtkiorg/cookiecutter-vtki-binder](https://github.com/vtkiorg/cookiecutter-vtki-binder)

And here is a sample project created using that template: [![Binder](https://discourse.vtk.org/uploads/default/original/1X/bba1607c35600f69d7e25a6151f52976c781c6e6.svg)](https://mybinder.org/v2/gh/vtkiorg/test-vtki-binder/master)

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [July 29, 2019, 5:20pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/4 "2019-07-29T17:20:49Z")

</div>

It looks like people are still using the examples I shared here - which have been updated:

- Cookie-cutter: [https://github.com/pyvista/cookiecutter-pyvista-binder](https://github.com/pyvista/cookiecutter-pyvista-binder)
- Example binder repo that my CI robot army deploys automatically: [https://github.com/pyvista/pyvista-examples](https://github.com/pyvista/pyvista-examples) and [![binder](https://discourse.vtk.org/uploads/default/original/1X/bba1607c35600f69d7e25a6151f52976c781c6e6.svg)](https://mybinder.org/v2/gh/pyvista/pyvista-examples/master)

---

<div class="post-metadata">

### Author: ![sharmishtaa](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@sharmishtaa](https://discourse.vtk.org/u/sharmishtaa)
#### Post date: [August 2, 2019, 6:03pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/5 "2019-08-02T18:03:49Z")

</div>

Thank you for your help! The mybinder project that you sent on april 7th that uses vtki works well. however laters one you sent with pyvista has an issue. It seems to do 2d plots okay. However 3D visualization has an issues. For example, when I try running examples/00-load/create-point-cloud.ipynb, I just get a grey screen where the plot should be. Any idea what could be causing this?

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 2, 2019, 6:05pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/6 "2019-08-02T18:05:22Z")

</div>

Hey - I’m aware of that issue (seems to have occurred this week) and it has to do with a bug in one of PyVista’s dependencies.

I’m working to fix it!

---

<div class="post-metadata">

### Author: ![sharmishtaa](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@sharmishtaa](https://discourse.vtk.org/u/sharmishtaa)
#### Post date: [August 2, 2019, 6:16pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/7 "2019-08-02T18:16:40Z")

</div>

Ok, great. Thank you!

---

<div class="post-metadata">

### Author: ![sharmishtaa](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@sharmishtaa](https://discourse.vtk.org/u/sharmishtaa)
#### Post date: [August 12, 2019, 10:43pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/8 "2019-08-12T22:43:38Z")

</div>

Any luck with this?

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 12, 2019, 10:45pm UTC](https://discourse.vtk.org/t/python-vtk-for-visualization-in-a-jupyter-notebook-running-on-docker/622/9 "2019-08-12T22:45:04Z")

</div>

Ah yes, we’ve managed to track down the issue but haven’t deployed a fix. adding `auto_close=False` to all `.show()` calls should allow the scene to show in the panel output
