# Status Update: VTK Python Wheels

**URL:** https://discourse.vtk.org/t/status-update-vtk-python-wheels/11212
**Category:** Announcements
**Tags:** python
**Created:** [April 14, 2023, 3:53pm UTC](https://discourse.vtk.org/t/status-update-vtk-python-wheels/11212 "2023-04-14T15:53:17Z")
**Posts on this page:** 4
**Page:** 1

<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 14, 2023, 3:53pm UTC](https://discourse.vtk.org/t/status-update-vtk-python-wheels/11212/1 "2023-04-14T15:53:17Z")

</div>

There has been a concerted effort to improve the generation, delivery, and variability of Python wheels for VTK, all published on the VTK GitLab repository’s package registry (thank you, @ben.boeckel!!): [https://gitlab.kitware.com/vtk/vtk/-/packages](https://gitlab.kitware.com/vtk/vtk/-/packages)

As of this post, VTK wheels are regularly generated for all OS/arch:

- Release builds on tags (has the official version tag, e.g.: `9.2.6`)
- Weekly builds on `master` (has a tag like `9.2.20230401.dev0`)

Latest release wheel: [https://gitlab.kitware.com/vtk/vtk/-/packages/101](https://gitlab.kitware.com/vtk/vtk/-/packages/101)

### Additional Wheel Variants: OSMesa

On these schedules, different wheel variants can be published, which are differentiated by [the package distribution name](https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#name). Right now, one variant is produced: `vtk-osmesa`.

The OSMesa wheel variant has VTK built to leverage offscreen rendering with OSMesa. This wheel is being built for _ **both Linux and Windows** _ at this time and bundles all of the necessary libraries into the wheel. These wheels are intended to be used by downstream projects in headless, CI-like environments or cloud application deployments, preventing the need to install any addition system packages.

Latest release OSMesa wheel: [https://gitlab.kitware.com/vtk/vtk/-/packages/102](https://gitlab.kitware.com/vtk/vtk/-/packages/102)

### Making these wheels accessible

You’ll notice on any [release page](https://gitlab.kitware.com/vtk/vtk/-/packages/101) that the install command is currently given as:

```bash
pip install vtk --index-url https://gitlab.kitware.com/api/v4/projects/13/packages/pypi/simple

```

At Kitware, we’ve set up [https://wheels.vtk.org](https://wheels.vtk.org) to forward to the GitLab package index [https://gitlab.kitware.com/api/v4/projects/13/packages/pypi/simple](https://gitlab.kitware.com/api/v4/projects/13/packages/pypi/simple)

This means that downstream packages can install from the Kitware-hosted package index by simply adding `--extra-index-url https://wheels.vtk.org` to their `pip install` command or `requirements.txt`

```bash
pip install --extra-index-url https://wheels.vtk.org vtk

```

or in `requirements.txt`:

```txt
--extra-index-url https://wheels.vtk.org
vtk
numpy
# ... other packages

```

### Example installation commands

Install the latest release wheel:

```bash
pip install --extra-index-url https://wheels.vtk.org vtk

```

Install the latest wheel from `master` (use `--pre` and `--no-cache` to grab the most recenet wheel)

```bash
pip install --extra-index-url https://wheels.vtk.org vtk --pre --no-cache

```

Install the OSMesa variant from the latest release

```bash
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa

```

I believe you can also set the environment variable `PIP_EXTRA_INDEX_URL` to have this enabled always:

```bash
PIP_EXTRA_INDEX_URL='https://wheels.vtk.org'

```

Note that there are differences in pip’s `--extra-index-url`, `--index-url`, and `--find-links` and you may want to use one over the other for your use case.

### Caveats

When using the OSMesa wheel variant, you need to make sure none of the packages in your application require `vtk` as `pip` thinks `vtk` and `vtk-osmesa` are different packages (because they are), yet, they’re both under the `vtk` namespace and will conflict if installed in the same environment.

One example of where this can be a problem is when wanting the OSMesa wheel with PyVista. PyVista has `vtk` in its core requirements, so you either have to tell pip not to install PyVista’s dependencies or uninstall `vtk` before installing `vtk-osmesa`. This has the potential to be improved once [Add ability to specify "default" extras\_require · Issue #1139 · pypa/setuptools · GitHub](https://github.com/pypa/setuptools/issues/1139) is addressed.

For example:

```bash
pip install pyvista
pip uninstall vtk -y
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa

```

or explicitly install PyVista’s dependencies:

```py
pip install pyvista --no-deps
pip install numpy pillow scooby pooch imageio matplotlib
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa

```

A better option for custom projects is to not have `vtk` be in the core requirements of a package but instead place `vtk` and `vtk-osmesa` in their own `extra_requires`/`optional-dependencies` sections:

For `setup.py`, this looks like:

```py
setup(
    ...
    extras_require={
        'onscreen': ['vtk'],
        'offscreen': ['vtk-osmesa'],
    }
)

```

For `pyproject.toml`, this looks like:

```toml
[project.optional-dependencies]
onscreen = [
    'vtk',
]
offscreen = [
    'vtk-osmesa',
]

```

Then install with the extra option:

```bash
pip install --extra-index-url https://wheels.vtk.org package[offscreen]

```

---

<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 14, 2023, 3:56pm UTC](https://discourse.vtk.org/t/status-update-vtk-python-wheels/11212/2 "2023-04-14T15:56:58Z")

</div>

TLDR; more/latest VTK wheels are available from [https://wheels.vtk.org](https://wheels.vtk.org)

```bash
pip install --extra-index-url https://wheels.vtk.org vtk

```

---

<div class="post-metadata">

### Author: ![namheegordonkim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/namheegordonkim/32/8650_2.png) [@namheegordonkim](https://discourse.vtk.org/u/namheegordonkim)
#### Post date: [March 20, 2024, 12:45pm UTC](https://discourse.vtk.org/t/status-update-vtk-python-wheels/11212/3 "2024-03-20T12:45:46Z")

</div>

Pretty late to the game, but thank you so much for setting this up. The EGL variant will be so useful for GPU-accelerated headless render in HPC compute situations.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 19, 2024, 12:59am UTC](https://discourse.vtk.org/t/status-update-vtk-python-wheels/11212/4 "2024-11-19T00:59:38Z")

</div>

If anyone is reading this, I want to mention that quite a lot has changed now since both osmesa and EGL are readily available from the `vtk` package. See [Status Update: Runtime OpenGL render window selection in VTK](https://discourse.vtk.org/t/status-update-runtime-opengl-render-window-selection-in-vtk/14583)
