# Building and publishing Nightly Python Wheel

**URL:** https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771
**Category:** Support
**Created:** [February 4, 2022, 10:33am UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771 "2022-02-04T10:33:59Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [February 4, 2022, 10:33am UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/1 "2022-02-04T10:33:59Z")

</div>

Are there any plans to implement Python 3.10/3.9 nightly wheels based on the latest VTK master?

---

<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: [February 4, 2022, 3:12pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/2 "2022-02-04T15:12:53Z")

</div>

The wheels are already built nightly during testing, for Python 3.6 through 3.10. They’re just hard to find.

Go to the [scheduled pipelines](https://gitlab.kitware.com/vtk/vtk/-/pipeline_schedules), select the last nightly pipeline, and from there you can find the wheel jobs. Then download the build artifacts to get the wheel. For example, [yesterday’s Windows wheel for Python 3.9](https://gitlab.kitware.com/vtk/vtk/-/jobs/6577098/artifacts/browse/build/dist/) (link will only be valid for one day).

The hard part is generating persistent links. I don’t know how that would be done.

---

<div class="post-metadata">

### Author: ![jcfr](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jcfr/32/466_2.png) [@jcfr](https://discourse.vtk.org/u/jcfr)
#### Post date: [February 4, 2022, 9:59pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/3 "2022-02-04T21:59:02Z")

</div>

> The hard part is generating persistent links. I don’t know how that would be done.

Uploading the wheels as GitHub release artifact associated with the project [kitware/VTK](https://github.com/kitware/VTK) and a tag called `nightly-python-wheels` would allow to have a stable link.

Such link would also allow pip installing using the [find-links](https://pip.pypa.io/en/stable/cli/pip_install/#install-find-links) feature of pip.

To avoid bumping this tag daily, the associated GitHub VTK release could be associated with an orphan branch also called `nightly-python-wheels` including a `README.md`.

To avoid the number of assets to grow indefinitely, a scheduled job would clear up the assets older than N days.

And the tool for uploading assets would be this one: [GitHub - github-release/github-release: Commandline app to create and edit releases on Github (and upload artifacts)](https://github.com/github-release/github-release#readme)

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [February 4, 2022, 10:50pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/4 "2022-02-04T22:50:10Z")

</div>

You would only need the nightly and possibly the previous nightly.

This has just arisen for me because at present I cannot build python wrapping properly in Windows. So I thought that this might be an alternative.

In Linux, wrapping is Ok using Python 3.10 although vtk-python doesn’t work (can’t find numpy) but using Python is OK.

---

<div class="post-metadata">

### Author: ![jcfr](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jcfr/32/466_2.png) [@jcfr](https://discourse.vtk.org/u/jcfr)
#### Post date: [February 7, 2022, 4:32pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/5 "2022-02-07T16:32:17Z")

</div>

4 posts were split to a new topic: [Setting PATH environment variables for VTK build tree on Windows](https://discourse.vtk.org/t/setting-path-environment-variables-for-vtk-build-tree-on-windows/7788)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [February 6, 2022, 4:40pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/6 "2022-02-06T16:40:42Z")

</div>

> [@amaclean](#):
>
> Are there any plans to implement Python 3.10/3.9 nightly wheels based on the latest VTK master?

We had them going to PyPI, but we maxed out our quota there pretty fast.

> [@jcfr](#):
>
> To avoid the number of assets to grow indefinitely, a scheduled job would clear up the assets older than N days.

AFAIK, there are no quotas on GitHub for releases. If not why clean them up? They can help bisect issues down.

> [@jcfr](#):
>
> And the tool for uploading assets would be this one: [GitHub - github-release/github-release: Commandline app to create and edit releases on Github (and upload artifacts)](https://github.com/github-release/github-release#readme)

There are already CI jobs which upload the wheels to places; this can be another one (see `.gitlab/rules.yml` for which one runs on the weekly schedule and we’ll need a token to perform the upload).

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [February 13, 2022, 10:47pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/7 "2022-02-13T22:47:03Z")

</div>

I have expanded on the comments by @dgobbi (Thanks David). These instructions are for getting the Windows Wheels, but are easily modified for other operating systems. I hope they are useful for others.

## Kitware Wheels

The wheels are already built nightly during testing, for Python 3.6 through 3.10. They’re just hard to find.

Go to the [scheduled pipelines](https://gitlab.kitware.com/vtk/vtk/-/pipeline_schedules), select the last nightly pipeline and from there you can find the wheel jobs. Then download the build artifacts to get the wheel. To do this click on the link and edit it adding `/artifacts/browse/build/dist/` to the end of the link. This will take you to a page allowing you to download the wheel.

Then download it to a folder.

Note:

- The nightly wheel builds will generally be finished by UTC 06:00

- These links are only valid for one day and will look something like this: `https://gitlab.kitware.com/vtk/vtk/-/jobs/6603303/artifacts/browse/build/dist/`, where the the number `6603303` will change daily.

### Setup a virtual environment

We are assuming that the latest python release from [Python](https://www.python.org/) is already installed, Python 3.10 in this case. Also we are working in Windows 10/11.

If you haven’t already done this, set up a new virtual environment e.g. `VTK-310-Wheel`.

```cmd

   deactivate

   py -m venv %USERPROFILE%\venv\VTK-310-Wheel

   %USERPROFILE%\venv\VTK-310-Wheel\scripts\activate

   python -m pip install --upgrade pip

   pip install Sphinx numpy matplotlib pyOpenSSL

   pip install wheel

```

### Installing the wheel

Do this whenever you need a new nightly wheel.

```cmd

   %USERPROFILE%\venv\VTK-310-Wheel\scripts\activate

   python -m pip install --upgrade pip

   pip install <path to the wheel>

```

e.g. `pip install D:/Users/<username>/Downloads/vtk-9.1.20220213.dev0-cp310-cp310-win_amd64.whl`

Note:

- You don’t necessarily have to upgrade pip every time.

### Using an IDE

In the case of Pycharm, after you have set up your project:

- Go to File|Settings|Python Interpreter

- Click on the wheel symbol, select `Add` and then `Virtualenv Environment`

- Select `Existing Environment` and find your interpreter. Its path will be `%USERPROFILE%\venv\VTK-310-Wheel\Scripts\Python.exe`.

- You’re done!

---

<div class="post-metadata">

### Author: ![aborsic](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/ed655f/32.png) [@aborsic](https://discourse.vtk.org/u/aborsic)
#### Post date: [March 26, 2022, 4:09pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/8 "2022-03-26T16:09:22Z")

</div>

Hello All,

I would like to be able to build a VTK Python wheel myself. I have seen that on GitLab there are jobs named for example wheel-windows-python310-x86\_64:build I am not familiar with GitLab does anyone have any tip on how to dig into the job files which would serve as an example? Are they available in some form in a git repository?

Thanks for any advise,

Best Regards,

Andrea

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [March 27, 2022, 2:45pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/9 "2022-03-27T14:45:30Z")

</div>

> [@aborsic](#):
>
> I am not familiar with GitLab does anyone have any tip on how to dig into the job files which would serve as an example? Are they available in some form in a git repository?

General guidance is in `Documentation/dev/build.md`, but specific instructions and configure flags are in `.gitlab/os-*.yml` and `.gitlab/ci/configure_*.cmake`.

---

<div class="post-metadata">

### Author: ![aborsic](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/ed655f/32.png) [@aborsic](https://discourse.vtk.org/u/aborsic)
#### Post date: [March 28, 2022, 8:00am UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/10 "2022-03-28T08:00:44Z")

</div>

Thank you! I have found the information I needed.

Best Regards,

Andrea

---

<div class="post-metadata">

### Author: ![djsftree](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@djsftree](https://discourse.vtk.org/u/djsftree)
#### Post date: [May 23, 2022, 3:07am UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/11 "2022-05-23T03:07:28Z")

</div>

Hi! Please can you add “linux arm64” to nightly / weekly builds?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [May 23, 2022, 2:52pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/12 "2022-05-23T14:52:33Z")

</div>

It’d be nice, but there’s a lack of resources for it right now. I’d have to check if we had the hardware to do any testing before I’d be comfortable releasing official wheels at least.

---

<div class="post-metadata">

### Author: ![djsftree](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@djsftree](https://discourse.vtk.org/u/djsftree)
#### Post date: [May 23, 2022, 3:18pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/13 "2022-05-23T15:18:56Z")

</div>

Thanks! I have compile deb packages for rpi like so. I pushed the the wheel build var though to debuild with --set-envvar=“VTK\_WHEEL\_BUILD=ON” as it doesn’t look like Debian enable that

[https://salsa.debian.org/science-team/vtk9/-/raw/master/debian/rules](https://salsa.debian.org/science-team/vtk9/-/raw/master/debian/rules)

```auto
apt install -y chrpath cmake debhelper-compat default-jdk default-libmysqlclient-dev dh-sequence-python3 doxygen-latex \
    ghostscript gnuplot-nox graphviz hdf5-tools dh-sequence-javahelper libalglib-dev javahelper libavcodec-dev \
    libavformat-dev libavutil-dev libdigest-md5-perl libdouble-conversion-dev libeigen3-dev libexpat-dev \
    libfontconfig1-dev libfreetype6-dev libftgl-dev libgdal-dev libgl1-mesa-dev libgl-dev libgl2ps-dev \
    libglew-dev libglu1-mesa-dev libglu-dev libhdf5-openmpi-dev libhpdf-dev libjpeg-dev libjs-mathjax \
    libjsoncpp-dev liblz4-dev libmrmpi-dev libnetcdf-cxx-legacy-dev libnetcdf-dev libogg-dev libosmesa6-dev \
    libpng-dev libpq-dev libproj-dev libsqlite3-dev libswscale-dev libtbb-dev libtheora-dev \
    libtiff-dev libutfcpp-dev libx11-dev libxdmf-dev libxml2-dev libxpm-dev libxt-dev lzma mpi-default-dev \
    pkg-config python3-dev python3-matplotlib python3-mpi4py qtbase5-dev libqt5opengl5 \
    r-base-core r-base-dev r-base xauth xvfb

  git clone https://salsa.debian.org/science-team/vtk9.git
  cd vtk9
  dch -a "compiled by djsftree"
  debuild -i -us -uc -b --set-envvar="VTK_WHEEL_BUILD=ON"
  /usr/lib/python3 -m pip install wheel
  /usr/lib/python3 setup.py bdist_wheel
  /usr/lib/python3 -m pip install dist/vtk-*.whl

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [May 23, 2022, 4:25pm UTC](https://discourse.vtk.org/t/building-and-publishing-nightly-python-wheel/7771/14 "2022-05-23T16:25:56Z")

</div>

An envvar does nothing to VTK; it needs to be passed to the CMake command that builds VTK. Also, I don’t think `debbuild` of the stock vtk9 package is likely to accept the layout the wheel build ends up making.
