Docker error when trying to run on a mac

Hi!
I am trying to a run a simple docker container for a trame app on mac and I am met with this error:
2.855 ERROR: Could not find a version that satisfies the requirement vtk-egl (from versions: none)
3.784 ERROR: No matching distribution found for vtk-egl

It is strange because the container works perfectly fine on a Linux machine. Switching out vtk for vtk-egl in the requirements did not change anything.
Here is the Dockerfile:

# Use Python runtime as the base image
FROM python:3.11-bookworm

# Set the working directory
WORKDIR /app
RUN apt-get update && apt-get -y install libglfw3-dev libgles2-mesa-dev
COPY requirements.txt .

# Install dependencies
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copy everything in current directory to container
COPY . .

# Expose the port
EXPOSE 1234

# Run the application
CMD ["python", "src/main.py", "--server","--port", "1234", "--host", "0.0.0.0"]

here is the requirements.txt:

trame>3
trame-vuetify 
trame-vtk
vtk>=9.1

Are you running an x86 version of the image ?
You can check this by replacing the CMD command with
CMD [ "uname", "-m"]

if it outputs aarch64 it means you built an arm-based docker image and vtk does not currently offer python wheels for arm on linux hence the error you are getting.

To use an x86 image on macos you need to pass --platform=linux/amd64 to the docker build/run command.

By the way, there is ongoing work for linux aarch64 python wheels for vtk https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11895

1 Like

vtk>=9.4 does provide egl and osmesa automatically.

Also, like Christos mentioned, we are in the process to generate an arm wheel for linux.

On mac, the EGL implementation will not be accelerated (no nvidia gpu) and will be provided by the mesa implementation of the OS inside the image (if available).

Side note, Iā€™m guessing your docker is for a single user? Also it will automatically exit after 5 minutes if no one connect.

Thank you! This worked. I did not realize that the underlying architecture for the docker image uses the hosts architecture, I just assumed it virtualized everything to one common architecture.

I see, thank you for the tip! It is only for a single user use so it exiting after 5 minutes is fine.