# VTK9.2.2 Python Cylinder example will not run on Ubuntu from fresh conda (or pip) install

**URL:** https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085
**Category:** Support
**Created:** [December 6, 2022, 11:02am UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085 "2022-12-06T11:02:39Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![connorferster](https://discourse.vtk.org/user_avatar/discourse.vtk.org/connorferster/32/6183_2.png) [@connorferster](https://discourse.vtk.org/u/connorferster)
#### Post date: [December 6, 2022, 11:02am UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/1 "2022-12-06T11:02:39Z")

</div>

Hi there!

I am trying to get vtk to run and I am getting the following error on the Python Cylinder (“hello world”) example.

```auto
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
2022-12-05 22:21:59.998 ( 0.034s) [2CF0D740]vtkXOpenGLRenderWindow.:651 ERR| vtkXOpenGLRenderWindow (0x119e300): Cannot create GLX context. Aborting.
[1] 13124 IOT instruction (core dumped) python -m hello_world

```

**To Reproduce**

```auto
$ conda create -n vtk_env python=3.9 vtk
$ conda activate vtk_env
$ python -m hello_world # Where hello_world contains the copy/pasted Cylinder code

```

Are `iris` and `swrast` dependencies that are supposed to be installed with vtk? How can I ensure that these get installed on my students’ machine and they do not encounter this?

Many thanks!

---

<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: [December 6, 2022, 2:55pm UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/2 "2022-12-06T14:55:34Z")

</div>

Those modules are provided by the [libgl1-mesa-dri](https://packages.ubuntu.com/jammy/amd64/libgl1-mesa-dri/filelist) package, so please verify it is installed:

```nohighlight
dpkg -l libgl1-mesa-dri

```

What version of ubuntu are you using? And what version of the conda “mesalib” package?

---

<div class="post-metadata">

### Author: ![connorferster](https://discourse.vtk.org/user_avatar/discourse.vtk.org/connorferster/32/6183_2.png) [@connorferster](https://discourse.vtk.org/u/connorferster)
#### Post date: [December 12, 2022, 10:46am UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/3 "2022-12-12T10:46:01Z")

</div>

Hi David,

Thank you for the response. I needed to check to see if this problem exists on Windows and Mac OSX too. Vtk installed on those platforms easily with only a pip install vtk.

I did an apt install of the libgl1-mesa-dri library and also did a conda install mesalib but the problem was not solved. Do they need to be installed in a particular way? I did not see this dependency listed on the install page. Can you tell me more about how to install this dependency?

Many thanks,

Connor

---

<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: [December 12, 2022, 1:10pm UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/4 "2022-12-12T13:10:59Z")

</div>

The VTK pypi package for pip and the VTK conda package are different things. The pypi package is released by Kitware, while the conda package is maintained by a different group: [https://github.com/conda-forge/vtk-feedstock](https://github.com/conda-forge/vtk-feedstock)

I’ve installed VTK on linux via pip (no conda) without needing to install any dependencies. I don’t use conda, so I don’t know much about its VTK package.

---

<div class="post-metadata">

### Author: ![connorferster](https://discourse.vtk.org/user_avatar/discourse.vtk.org/connorferster/32/6183_2.png) [@connorferster](https://discourse.vtk.org/u/connorferster)
#### Post date: [December 12, 2022, 3:58pm UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/5 "2022-12-12T15:58:10Z")

</div>

Ah! Ok! Good to know. I tried installing with pip first, then went to conda thinking that it was the same or more comprehensive of an installation process.

That being the case, I started a fresh environment (Python 3.9) and installed vtk (9.2.2) with `pip install vtk`.

However, I am still getting the same error:

```auto
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
2022-12-12 07:41:34.443 ( 0.032s) [5FD7D740]vtkXOpenGLRenderWindow.:651 ERR| vtkXOpenGLRenderWindow (0x156de40): Cannot create GLX context. Aborting.
[1] 9946 IOT instruction (core dumped) python -m hello_world

```

Are these dependencies expected to be in the OS already? Is there documentation for these dependencies and their installation?

---

<div class="post-metadata">

### Author: ![connorferster](https://discourse.vtk.org/user_avatar/discourse.vtk.org/connorferster/32/6183_2.png) [@connorferster](https://discourse.vtk.org/u/connorferster)
#### Post date: [December 12, 2022, 4:05pm UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/6 "2022-12-12T16:05:26Z")

</div>

Also here is the output of `dpkg ...`

```auto
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-=====================================-============-====================================================
ii libgl1-mesa-dri:amd64 22.2.0-1pop0~1664294850~22.04~4e1b64f amd64 free implementation of the OpenGL API -- DRI modules

```

---

<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: [December 12, 2022, 5:31pm UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/7 "2022-12-12T17:31:34Z")

</div>

If you use the pip package, then make sure that your environment doesn’t have any conda-specific paths or environment variables (type `env` in your shell to check what vars are set).

Since you’re seeing dependency errors for libs and you’ve verified that those libs are installed on your system, I suspect that conda-installed libraries are somehow interfering with your system libraries. You can use `ldd` to see what’s linked, for example:

```bash
ldd lib/python3.9/site-packages/vtkmodules/libvtkRenderingOpenGL2-9.2.so

```

---

<div class="post-metadata">

### Author: ![connorferster](https://discourse.vtk.org/user_avatar/discourse.vtk.org/connorferster/32/6183_2.png) [@connorferster](https://discourse.vtk.org/u/connorferster)
#### Post date: [December 13, 2022, 12:52am UTC](https://discourse.vtk.org/t/vtk9-2-2-python-cylinder-example-will-not-run-on-ubuntu-from-fresh-conda-or-pip-install/10085/8 "2022-12-13T00:52:58Z")

</div>

Problem is caused with an interaction with conda in Linux. Solution was to execute:

```auto
conda install -c conda-forge libstdcxx-ng

```

as per:

> <https://stackoverflow.com/questions/71010343/cannot-load-swrast-and-iris-drivers-in-fedora-35/72200748#72200748>

Now, everything works!
