Dockerizing Trame Application with vtk-osmesa wheel

Hello and thanks in advance for your help.

I’m in the process of dockerizing my trame app with the goal of deploying it on a headless, gpu-less VM. I want to use vtk-osmesa for rendering on the cpu.

Briefly, I am unable to install vtk-osmesa. I’ll try to be thorough, but the TLDR is: The vtk documentation says the 9.4 has the vtk-osmesa by default. I don’t see a stable version of vtk 9.4 released. When I try to follow the recommendations to get the vtk-osmesa library from wheels.vtk.org, I’m unable to install it (ERROR: Could not find a version that satisfies the requirement vtk-osmesa (from versions: none)). I’m not sure if this is an issue due to vtk-osmesa being removed in preparation for vtk 9.4, or if I’m referencing it wrong from wheels.vtk.org. All the details of my applications are to follow.

Following relevant documentation, I built my requirements.txt file:

–extra-index-url https://wheels.vtk.org
wheel
trame
trame-vtk
trame-vuetify
vtk-osmesa

Along with my other dependencies. I’m able to build my image from the base image kitware/trame:py3.10, with my /setup folder (containing apps.yml and requirements.txt), and my application files copied to /deploy. Running the docker build command:

docker build --rm -t dockerize_trame .

Succeeds and I can see the image in my docker desktop. Here is my dockerfile:

FROM kitware/trame:py3.10

RUN apt-get update && apt-get install -y
libosmesa6
libosmesa6-dev
mesa-utils
&& apt-get clean

ENV LIBGL_ALWAYS_SOFTWARE=1

COPY --chown=trame-user:trame-user . /deploy
RUN /opt/trame/entrypoint.sh build launcher venv www

However, running the image (docker run -it --rm --p 8080:80 dockerize_trame ) does not start the server successfully:

Starting server…
Starting the wslink launcher at
/deploy/server/venv/bin/python: Error while finding module specification for ‘wslink.launcher’ (ModuleNotFoundError: No module named ‘wslink’)

When I open an interactive terminal in the container, I see that the deploy directory has the necessary folders (apps, data, setup, server). The deploy/server folder has a venv. I activate the venv and try to manually pip install the requirements.txt to see where it fails, lo and behold:

Collecting trame-vuetify (from -r requirements.txt (line 8))
Downloading trame_vuetify-2.7.1-py3-none-any.whl.metadata (5.0 kB)
ERROR: Could not find a version that satisfies the requirement vtk-osmesa (from versions: none)
ERROR: No matching distribution found for vtk-osmesa

I’ve referenced the cookie-cutter repo, trame-app-cone repo, the kitware/trame/docker Readme and kitware/trame/examples/deploy/docker/vtkRendering folder. I’ve also referenced the vtk docs (Additional Python Wheels - VTK documentation) and this discourse update on the vtk-osmesa wheel from 2023 Status Update: VTK Python Wheels. Any clarification on oversights, errors, misunderstandings on my end are deeply appreciated. Thank you!

As you found in the documentation, vtk-osmesa is gone and osmesa is now part of vtk wheel. We are still in the process of publishing stable wheels for 9.4 on pypi. You can get release candidates from wheels.vtk.org.

pip install vtk==9.4.0rc2 --extra-index https://wheels.vtk.org

About this,

It indicates that the trame docker setup needs to update their dependencies to replace vtk-osmesa with vtk. I think this is the file - trame/examples/deploy/docker/VtkRendering/setup/requirements.txt at master · Kitware/trame · GitHub. I would guess someone will get to it after VTK 9.4 is published on pypi. @Sebastien_Jourdain

A more recent update about osmesa and EGL in vtk wheels is here Status Update: Runtime OpenGL render window selection in VTK

1 Like

Thanks for your response. I updated my requirements.txt with the release candidate version, and am still facing the same message for vtk:

ERROR: Could not find a version that satisfies the requirement vtk==9.4.0rc2 (from versions: none)
ERROR: No matching distribution found for vtk==9.4.0rc2

In the interactive terminal, I again activated the venv and tried pip install vtk and received the same message:

(venv) root@04e3cb1b897d:/deploy/server# pip install vtk
ERROR: Could not find a version that satisfies the requirement vtk (from versions: none)
ERROR: No matching distribution found for vtk

I changed the base image from kitware/trame:py3.10 to kitware/trame:py3.9, and still receive the same message.

Edit: This was because I am on an M1 and the container architecture was arm64. Is the best way to approach this to build vtk? Right now I’m emulating amd64 to solve any other latent problems before tackling this.

This was because I am on an M1 and the container architecture was arm64. Is the best way to approach this to build vtk? Right now I’m emulating amd64 to solve any other latent problems before tackling this.

Ah, yea that’d do it. We don’t provide wheels for linux-arm64.

You can still build and run x86 docker image on mac. That will be the way to go.