I'm trying to run pyglet in headless mode in a docker container but even though I use pyglet.options["headless"] = True
I still get this error:
2023-03-12T09:05:13.655921692Z ImportError: Library "GL" not found.
This is the dockerfile:
# syntax=docker/dockerfile:1
FROM docker.io/python:3.11.1-slim-buster AS builder
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential libssl-dev capnproto git freeglut3-dev libosmesa6-dev
WORKDIR /root
COPY pyproject.toml README.rst src ./
RUN pip3 install --user .
ENV ARCADE_HEADLESS=True
FROM docker.io/python:3.11.1-slim-buster
# Install cca-server
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
ENTRYPOINT ["cca-server"]
And this is the full traceback:
Traceback (most recent call last):
2023-03-12T09:05:13.650941060Z File "/root/.local/bin/cca-server", line 5, in <module>
2023-03-12T09:05:13.650961580Z from colossalcyberadventureserver.cca_server import cca_server
2023-03-12T09:05:13.650969388Z File "/root/.local/lib/python3.11/site-packages/colossalcyberadventureserver/cca_server.py", line 14, in <module>
2023-03-12T09:05:13.651047564Z from . import cca_server_protocol
2023-03-12T09:05:13.651076091Z File "/root/.local/lib/python3.11/site-packages/colossalcyberadventureserver/cca_server_protocol.py", line 11, in <module>
2023-03-12T09:05:13.651085701Z from .logic.players import players, Player, player_list
2023-03-12T09:05:13.651137151Z File "/root/.local/lib/python3.11/site-packages/colossalcyberadventureserver/logic/players.py", line 7, in <module>
2023-03-12T09:05:13.651472576Z from arcade import SpriteList
2023-03-12T09:05:13.651526228Z File "/root/.local/lib/python3.11/site-packages/arcade/__init__.py", line 98, in <module>
2023-03-12T09:05:13.651806099Z from .application import MOUSE_BUTTON_LEFT
2023-03-12T09:05:13.651876568Z File "/root/.local/lib/python3.11/site-packages/arcade/application.py", line 12, in <module>
2023-03-12T09:05:13.652156539Z import pyglet.gl as gl
2023-03-12T09:05:13.652291971Z File "/root/.local/lib/python3.11/site-packages/pyglet/gl/__init__.py", line 47, in <module>
2023-03-12T09:05:13.652827590Z from pyglet.gl.gl import *
2023-03-12T09:05:13.653958487Z File "/root/.local/lib/python3.11/site-packages/pyglet/gl/gl.py", line 7, in <module>
2023-03-12T09:05:13.654146370Z from pyglet.gl.lib import link_GL as _link_function
2023-03-12T09:05:13.654179402Z File "/root/.local/lib/python3.11/site-packages/pyglet/gl/lib.py", line 98, in <module>
2023-03-12T09:05:13.654515428Z from pyglet.gl.lib_glx import link_GL, link_GLX
2023-03-12T09:05:13.654566277Z File "/root/.local/lib/python3.11/site-packages/pyglet/gl/lib_glx.py", line 11, in <module>
2023-03-12T09:05:13.655078874Z gl_lib = pyglet.lib.load_library('GL')
2023-03-12T09:05:13.655132126Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-12T09:05:13.655147341Z File "/root/.local/lib/python3.11/site-packages/pyglet/lib.py", line 134, in load_library
2023-03-12T09:05:13.655526709Z raise ImportError(f'Library "{names[0]}" not found.')
2023-03-12T09:05:13.655921692Z ImportError: Library "GL" not found.