# A Dockerfile to build gym from source including optional Mujoco support
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
unzip \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg cmake \
wget \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Download mujoco (this enables MuJoCo environments in gym)
&& mkdir -p /root/.mujoco \
&& cd /root/.mujoco \
&& wget -qO- 'https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz' | tar -xzvf -
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin"
COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
RUN if [ "python:${PYTHON_VERSION}" = "python:3.6.15" ] ; then \
pip install .[box2d,classic_control,toy_text,other] pytest=="7.0.1" --no-cache-dir; \
else \
pip install .[testing] --no-cache-dir; \
fi
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
# A Dockerfile to build gym from source including optional Mujoco support
FROM python:3.8-slim
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
unzip \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg cmake \
wget \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Download mujoco (this enables MuJoCo environments in gym)
&& mkdir -p /root/.mujoco \
&& cd /root/.mujoco \
&& wget -qO- 'https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz' | tar -xzvf -
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin"
COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
RUN if [ "python:3.8-slim" = "python:3.6" ] ; then \
pip install .[box2d,classic_control,toy_text,other] pytest=="7.0.1" --no-cache-dir; \
else \
pip install .[testing] --no-cache-dir; \
fi
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
__pycache__/ *.pyc .git/ .env/ .env.* node_modules/ build/ dist/ *.egg-info/ *.tox/ *.venv/ *.pytest_cache/ *.log *.swp
- Exact error message and exit code
- Swig-related wheel build failure inside box2d-py:
- "unable to execute 'swig': No such file or directory"
- "error: command 'swig' failed with exit status 1"
- Overall Docker build exit:
- The final failure message:
"ERROR: failed to build: failed to solve: process \"/bin/bash -o pipefail -c if [ \\\"python:3.8-slim\\\" = \\\"python:3.6\\\" ] ; then pip install .[box2d,classic_control,toy_text,other] pytest==\\\"7.0.1\\\" --no-cache-dir; else pip install .[testing] --no-cache-dir; fi\" did not complete successfully: exit code: 1"
- Failing command/step
- Step [5/5] RUN command:
"if [ \"python:3.8-slim\" = \"python:3.6\" ] ; then \
pip install .[box2d,classic_control,toy_text,other] pytest==\"7.0.1\" --no-cache-dir; \
else \
pip install .[testing] --no-cache-dir; \
fi"
- Missing packages or files mentioned
- Missing tool: swig (SWIG) not installed in the image, causing the box2d-py wheel build to fail:
- "unable to execute 'swig': No such file or directory"
- Version mismatch info
- Base image used: python:3.8-slim
- Dockerfile contains a conditional check for python:3.8-slim vs python:3.6 to decide which dependencies to install, influencing whether box2d-py is built.
- Note in log about pip version: "A new release of pip is available: 23.0.1 -> 25.0.1" (not an error, just a version notice)# A Dockerfile to build gym from source including optional Mujoco support
FROM python:3.8-slim
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
unzip \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg cmake \
wget \
swig \
build-essential \
pkg-config \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Download mujoco (this enables MuJoCo environments in gym)
&& mkdir -p /root/.mujoco \
&& cd /root/.mujoco \
&& wget -qO- 'https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz' | tar -xzvf -
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin"
COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
RUN if [ "python:3.8-slim" = "python:3.6" ] ; then \
pip install .[box2d,classic_control,toy_text,other] pytest=="7.0.1" --no-cache-dir; \
else \
pip install .[testing] --no-cache-dir; \
fi
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: The RUN instruction contains a conditional that uses a literal string comparison which is always false (likely a placeholder for version detection)., The build relies on downloading Mujoco at build time; consider license and network access implications in CI environments., ENTRYPOINT points to /usr/local/gym/bin/docker_entrypoint; ensure this file exists in the repository and is executable.
Smoke [FAIL]: python -c 'import gym; print(gym.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print("smoke_ok")
Output: sh: 1: Syntax error: Unterminated quoted string# A Dockerfile to build gym from source including optional Mujoco support
FROM python:3.8-slim
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
unzip \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg cmake \
wget \
swig \
build-essential \
pkg-config \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Download mujoco (this enables MuJoCo environments in gym)
&& mkdir -p /root/.mujoco \
&& cd /root/.mujoco \
&& wget -qO- 'https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz' | tar -xzvf -
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin"
COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
RUN pip install --no-cache-dir .[testing]
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Smoke [FAIL]: python -c 'import gym; print(1)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; env=gym.make("CartPole-v1"); print(type(env.action_space)); env.close()
Output: sh: 1: Syntax error: Unterminated quoted string#!/bin/bash
# This script is the entrypoint for our Docker image.
set -ex
# Set up display; otherwise rendering will fail
Xvfb -screen 0 1024x768x24 &
export DISPLAY=:0
# Wait for the file to come up
display=0
file="/tmp/.X11-unix/X$display"
for i in $(seq 1 10); do
if [ -e "$file" ]; then
break
fi
echo "Waiting for $file to be created (try $i/10)"
sleep "$i"
done
if ! [ -e "$file" ]; then
echo "Timing out: $file was not created"
exit 1
fi
exec "$@"
# A Dockerfile to build gym from source for testing purposes (no MuJoCo download)
FROM python:3.8-slim
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
unzip \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg cmake \
wget \
swig \
build-essential \
pkg-config \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
# Install the project with testing dependencies (this may pull in many heavy optional deps)
RUN pip install --no-cache-dir .[testing]
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: ENTRYPOINT points to /usr/local/gym/bin/docker_entrypoint; ensure this script exists in the source or is generated during build., No explicit tests beyond import; consider adding a lightweight sanity check (e.g., import gym and verify a simple attribute) to catch runtime import issues early.
Smoke [FAIL]: python -c 'import gym; print(gym.__name__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; import gym.spaces; print("spaces import ok")
Output: sh: 1: Syntax error: Unterminated quoted string#!/bin/bash
# This script is the entrypoint for our Docker image.
set -ex
# Set up display; otherwise rendering will fail
Xvfb -screen 0 1024x768x24 &
export DISPLAY=:0
# Wait for the file to come up
display=0
file="/tmp/.X11-unix/X$display"
for i in $(seq 1 10); do
if [ -e "$file" ]; then
break
fi
echo "Waiting for $file to be created (try $i/10)"
sleep "$i"
done
if ! [ -e "$file" ]; then
echo "Timing out: $file was not created"
exit 1
fi
# Execute the provided command. Use bash -lc to ensure proper handling of quotes in the command.
exec /bin/bash -lc "$@"
Concerns: ENTRYPOINT references /usr/local/gym/bin/docker_entrypoint which must exist in the repo; if not, container will fail at runtime., Building from source assumes a proper setup.py/pyproject.toml and dependencies; could fail if extras 'testing' pull in heavy optional dependencies or require external resources., The image size may be large due to many build dependencies and the gym testing dependencies; consider multi-stage build to reduce image size.
Smoke [FAIL]: python -c \"import gym; print('ok')\
Output: sh: 1: Syntax error: word unexpected (expecting ")")#!/bin/bash
# This script is the entrypoint for our Docker image.
set -ex
# Set up display; otherwise rendering will fail
Xvfb -screen 0 1024x768x24 &
export DISPLAY=:0
# Wait for the file to come up
display=0
file="/tmp/.X11-unix/X$display"
for i in $(seq 1 10); do
if [ -e "$file" ]; then
break
fi
echo "Waiting for $file to be created (try $i/10)"
sleep "$i"
done
if ! [ -e "$file" ]; then
echo "Timing out: $file was not created"
exit 1
fi
exec "$@"
Concerns: ENTRYPOINT path /usr/local/gym/bin/docker_entrypoint may not exist after installation; verify the path or adjust to where the entrypoint script is installed., SHELL uses /bin/bash; ensure bash is present in the base image or install it, otherwise the RUN commands may fail on minimal images., COPY . copies the entire repository; consider adding a .dockerignore to exclude tests, docs, and other non-essential files to reduce image size.
Smoke [FAIL]: python -c 'import gym; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print(getattr(gym, "__version__", "unknown"))
Output: sh: 1: Syntax error: Unterminated quoted string#!/bin/bash # Minimal entrypoint to run the provided command inside the container. set -e exec "$@"
Smoke [FAIL]: python -c "import gym; print('ok')
Output: sh: 1: Syntax error: Unterminated quoted string# A Dockerfile to build gym from source for testing purposes (no entrypoint wrapper)
FROM python:3.8-slim
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
swig \
pkg-config \
unzip \
libgl1-mesa-dev \
libglu1-mesa-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
COPY . /workspace
# Install the project with testing dependencies (this pulls in a broad set of optional deps)
RUN pip install --no-cache-dir .[testing]
# Default command is not defined to allow docker run to supply commands directly (e.g. python -c ...)
Concerns: Base image uses Python 3.8-slim which is EOL; consider upgrading to a supported Python version for security and compatibility., No .dockerignore is provided in this snippet; copying the entire repository into the image can bloat the build context and image size. Adding a .dockerignore would help., No CMD/ENTRYPOINT defined; this is intentional for flexibility, but ensure smoke tests supply commands when running the image and consider documenting the expected usage.
Smoke [FAIL]: python -c 'import gym; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print(gym.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string# A Dockerfile that sets up a full Gym install with test dependencies
ARG PYTHON_VERSION
FROM python:$PYTHON_VERSION
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
unzip \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg cmake \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Download mujoco
&& mkdir /root/.mujoco \
&& cd /root/.mujoco \
&& wget -qO- 'https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz' | tar -xzvf -
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin"
COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
RUN if [ "python:${PYTHON_VERSION}" = "python:3.6.15" ] ; then pip install .[box2d,classic_control,toy_text,other] pytest=="7.0.1" --no-cache-dir; else pip install .[testing] --no-cache-dir; fi
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
# A minimal Dockerfile to build gym from source with core dependencies only
FROM python:3.8-slim
# Install minimal build and runtime dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
swig \
pkg-config \
unzip \
libgl1-mesa-dev \
libglu1-mesa-dev \
xvfb \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
COPY . /workspace
# Install the project without optional extras to keep build simple
RUN pip install --no-cache-dir .
# Ensure the entrypoint script is executable
RUN chmod +x /workspace/bin/docker_entrypoint
# Use the repository's entrypoint to run commands
ENTRYPOINT ["/workspace/bin/docker_entrypoint"]
Smoke [FAIL]: python -c 'import gym; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print(getattr(gym, "__version__", "unknown"))
Output: sh: 1: Syntax error: Unterminated quoted string#!/bin/sh set -e # Execute the provided command inside the container exec "$@"
Smoke [FAIL]: python -c 'import gym; print(gym.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print("OK")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print("path:", gym.__file__)
Output: sh: 1: Syntax error: Unterminated quoted string#!/bin/bash set -e # If no arguments are provided, drop into a shell. if [ "$#" -eq 0 ]; then exec /bin/bash else # Use bash -lc to properly interpret quoted strings passed as arguments exec /bin/bash -lc "$*" fi
FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build and run Gym from source (including Mujoco-related tooling if needed)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Ensure Python packaging tools are up to date and install the project from source with testing extras
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .[testing]
# Ensure the entrypoint script is available in a predictable path and is executable
RUN mkdir -p /usr/local/gym/bin \
&& cp bin/docker_entrypoint /usr/local/gym/bin/docker_entrypoint \
&& chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
__pycache__/ *.pyc *.pyo *.pyd .cluster/ .coverage build/ dist/ docker/ *.egg-info/ .env .envrc *.egg .eggs venv/ .envs/ .git .gitignore node_modules/ .idea/ .vscode/ *.log .DS_Store
Concerns: COPY . /usr/local/gym/ followed by a RUN that copies bin/docker_entrypoint from the build context will fail if bin/docker_entrypoint does not exist in the source tree., pip install --no-cache-dir .[testing] requires a 'testing' extra to be defined in setup.py/pyproject; if not defined, this build step will fail., No CMD is specified; runtime relies on an entrypoint script that may be missing or not executable, causing container startup failures.
FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build and run Gym from source (including Mujoco-related tooling if needed)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Ensure Python packaging tools are up to date and install the project from source with testing extras
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .[testing] || pip install --no-cache-dir .
# Ensure the entrypoint script is executable (it's located in the repo at bin/docker_entrypoint)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: COPY . /usr/local/gym/ relies on repository contents; ensure 'bin/docker_entrypoint' exists and is included in the build context, Installing with [testing] extras may pull optional dependencies (e.g., Mujoco) that require licenses or additional setup; ensure license terms and environment are handled
Smoke [FAIL]: python -c 'import gym; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print(getattr(gym, "__version__", "unknown"))
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build and run Gym from source (including Mujoco-related tooling if needed)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Ensure Python packaging tools are up to date and install the project from source with testing extras
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .[testing]
# Ensure the entrypoint script is executable (it's located in the repo at bin/docker_entrypoint)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Summary of Docker build error (concise, actionable)
- Failing command/step:
- [5/6] RUN python -m pip install --upgrade pip setuptools wheel && pip install --no-cache-dir .[testing]
- Exact error message and exit code:
- Exit code: 1
- Primary failure trace:
- /bin/sh: 1: sdl2-config: not found
- DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
- File "/tmp/pip-install-1i7f1y28/pygame_044f1f75233341aeab7850bf72659f48/buildconfig/config_unix.py", line 39, in __init__
- self.ver = config[0].strip()
- IndexError: list index out of range
- Also note: ERROR: Failed to build 'pygame' when getting requirements to build wheel
- Missing packages or files mentioned:
- sdl2-config not found (likely because libsdl2-dev is not installed)
- This indicates the SDL2 development package (SDL_CONFIG) is missing
- Version mismatch / environment details:
- Base image is Python 3.11 on Debian trixie (Debian 13) as seen in build logs
- SDL development headers (libsdl2-dev) are not installed, causing sdl2-config to be unavailable
- The pygame build from source fails due to this missing dependency, not an explicit library version mismatch
- Context note:
- The error originates from a subprocess during wheel build for pygame (not a direct Python/PIP issue).FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build and run Gym from source (including SDL2 for pygame)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Ensure Python packaging tools are up to date and install the project from source with testing extras
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .[testing]
# Ensure the entrypoint script is executable (it's located in the repo at bin/docker_entrypoint)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Error summary: - Exact error message and exit code: - "ERROR: Failed to build 'pygame' when getting requirements to build wheel" - exit code: 1 - Failing command/step: - RUN python -m pip install --upgrade pip setuptools wheel && pip install --no-cache-dir .[testing] - Missing packages or files mentioned: - PORTMIDI: not found - PORTTIME: not found - Version/mismatch info: - Base image: python:3.11-slim - During the build, Python 3.13 packages were installed (libpython3-stdlib, python3, python3-minimal, etc.), indicating multiple Python versions in the image. - The wheel text shows cp311 wheels (e.g., numpy-2.4.3-cp311), while the apt step later installs Python 3.13, highlighting a potential environment/version mismatch affecting dependency resolution for pygame/gym.
FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install minimal system dependencies needed for the entrypoint and display server
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
xvfb \
ca-certificates \
git \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source without extra dependencies to keep build simple
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .
# Ensure the entrypoint script is executable (it's located in the repo at bin/docker_entrypoint)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: Potential missing build tools (e.g., build-essential) in the base image could cause pip install . to fail if the project has C extensions. Consider adding build tools if needed.
Smoke [FAIL]: python -c "import gym; print('ok')
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install minimal system dependencies needed for the entrypoint and display server
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
xvfb \
ca-certificates \
git \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source without extra dependencies to keep build simple
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .
# Ensure the entrypoint script is executable (it's located in the repo at bin/docker_entrypoint)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: Assumes there is a docker_entrypoint script at bin/docker_entrypoint; if missing, the build will fail., Installing from source via 'pip install .' requires a valid setup.py/pyproject in the repository; if missing, the build will fail., Smoke tests assume the Python package is importable as 'gym'; if the actual package name differs, the import tests may fail.
Smoke [FAIL]: python -c \"import gym; print('ok')\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import gym; print(getattr(gym, '__version__', 'unknown'))\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import sys; print(sys.version.split()[0])\
Output: sh: 1: Syntax error: word unexpected (expecting ")")"""Root __init__ of the gym module setting the __all__ of gym modules."""
# isort: skip_file
from gym import error
from gym.version import VERSION as __version__
from gym.core import (
Env,
Wrapper,
ObservationWrapper,
ActionWrapper,
RewardWrapper,
)
from gym.spaces import Space
from gym.envs import make, spec, register
from gym import logger
from gym import vector
from gym import wrappers
import os
import sys
__all__ = ["Env", "Space", "Wrapper", "make", "spec", "register"]
# Initializing pygame initializes audio connections through SDL. SDL uses alsa by default on all Linux systems
# SDL connecting to alsa frequently create these giant lists of warnings every time you import an environment using
# pygame
# DSP is far more benign (and should probably be the default in SDL anyways)
if sys.platform.startswith("linux"):
os.environ["SDL_AUDIODRIVER"] = "dsp"
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "hide"
try:
import gym_notices.notices as notices
# print version warning if necessary
notice = notices.notices.get(__version__)
if notice:
print(notice, file=sys.stderr)
except Exception: # nosec
pass
FROM python:3.11-slim
# Build args for reproducibility
ARG PYTHON_VERSION=3.11
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build Gym from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source; prefer the testing extras to include common test dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install --no-cache-dir .[testing] \
|| python -m pip install --no-cache-dir .
# Ensure the entrypoint script is executable (bin/docker_entrypoint in the repo)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: The build assumes a docker_entrypoint script exists at /usr/local/gym/bin/docker_entrypoint; if the repo doesn't include this file, the build will fail at chmod +x step., ARG PYTHON_VERSION is declared but not used, which is confusing and could be removed or used to pin Python.
Smoke [FAIL]: python -c 'import gym; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; env = gym.make("CartPole-v1"); env.close(); print("ok")
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build Gym from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source without extras
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .
# Ensure the entrypoint script is executable (bin/docker_entrypoint in the repo)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: The Dockerfile copies the entire repository into the image; consider adding a .dockerignore to avoid shipping large or build artifacts., Relies on /usr/local/gym/bin/docker_entrypoint; ensure the script exists in the repo and is executable (the Dockerfile attempts to chmod +x)., Some gym environments may require rendering dependencies; the smoke tests avoid rendering, but future tests might need Xvfb or similar.
Smoke [FAIL]: python -c 'import gym; env = gym.make("CartPole-v1"); env.reset(); env.close(); print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import gym; print(getattr(gym, "__version__", "unknown"))
Output: sh: 1: Syntax error: Unterminated quoted stringARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source; avoid heavy extras by default
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install --no-cache-dir .
# Ensure the entrypoint script is executable (bin/docker_entrypoint in the repo)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Install build and system dependencies required to build Gym from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source; prefer the testing extras to include common test dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install --no-cache-dir .[testing]
# Ensure the entrypoint script is executable (bin/docker_entrypoint in the repo)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
- Exact error message and exit code
- ERROR: Failed to build 'pygame' when getting requirements to build wheel (exit code: 1)
- Additional final failure note: "ERROR: failed to build: failed to solve: process \"/bin/sh -c python -m pip install --upgrade pip setuptools wheel && python -m pip install --no-cache-dir .[testing]\" did not complete successfully: exit code: 1"
- Failing command/step
- RUN python -m pip install --upgrade pip setuptools wheel && python -m pip install --no-cache-dir .[testing]
- Missing packages/files mentioned
- Missing dependencies reported by pygame build:
- PORTMIDI: not found
- PORTTIME: not found
- Also presence of a general "Missing dependencies" message during pygame wheel acquisition
- Version mismatch info
- No explicit version mismatch errors shown. The build attempts include:
- numpy>=1.18.0 (from gym==0.26.2) → numpy-2.4.3
- opencv-python wheel (opencv_python-4.13.0.92-cp37-abi3-manylinux_2_28_x86_64.whl)
- pygame==2.1.0 (built from source)
- The failure is due to missing system dependencies for pygame, not a clear version incompatibility.FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Build and runtime dependencies to compile Gym from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /usr/local/gym
# Copy the repository contents into the image
COPY . /usr/local/gym/
# Install the package from source; avoid heavy extras to keep build lightweight
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install --no-cache-dir .
# Ensure the entrypoint script is executable (bin/docker_entrypoint in the repo)
RUN chmod +x /usr/local/gym/bin/docker_entrypoint
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
Concerns: ENTRYPOINT path /usr/local/gym/bin/docker_entrypoint is assumed to exist in the repository; ensure this file is present and executable in all builds. Smoke [FAIL]: python3 -c 'import gym; print(1) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python3 -c 'import gym; print(gym.__name__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python3 -c 'import gym, gym.spaces; print(1) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.11-slim
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# Build and runtime dependencies to compile Gym from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
swig \
pkg-config \
git \
unzip \
ca-certificates \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
ffmpeg \
xvfb \
patchelf \
bash \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to install the project from source
WORKDIR /workspace
# Copy the repository contents into the image
COPY . /workspace/
# Install the package from source without extra dependencies to keep the build light
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install --no-cache-dir .
# Ensure the entrypoint script is executable (bin/docker_entrypoint in the repo)
RUN chmod +x /workspace/bin/docker_entrypoint
ENTRYPOINT ["/workspace/bin/docker_entrypoint"]
Concerns: ENTRYPOINT points to /workspace/bin/docker_entrypoint; if this file does not exist in the context, the build will fail., COPY . /workspace/ may copy large or unnecessary files; consider adding a .dockerignore to avoid bloating the image.
Smoke [FAIL]: python -c "import gym; print('ok')
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import gym; print(getattr(gym, '__version__', 'no_version'))
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.11-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git && \
rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy minimal project files to build from source
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: print Gym version to verify
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
**/__pycache__ **/*.pyc *.git **/.git node_modules .dockerignore Dockerfile README.md *.pyc *.pyo *.pyd venv/ build/ dist/ .eggs/ *.egg-info/ __pycache__
Summary of Docker build error
- Failing step (exactly):
- RUN python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && pip install .[testing] --no-cache-dir
- This corresponds to step [10/11] in the log.
- Exact error message and exit code to preserve:
- 8.565 DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
- 8.565 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 8.565 /bin/sh: 1: sdl2-config: not found
- 8.565 IndexError: list index out of range
- 8.567 ERROR: Failed to build 'pygame' when getting requirements to build wheel
- ...
- ERROR: failed to build: failed to solve: process "/bin/sh -c python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && pip install .[testing] --no-cache-dir" did not complete successfully: exit code: 1
- Failing command/step (summary): The pip-based build of pygame in the final Docker RUN line failed while getting requirements to build the wheel.
- Missing packages/files mentioned:
- sdl2-config not found (SDL2 development headers likely missing). This implies missing SDL2 development files (e.g., libsdl2-dev or sdl2-dev) needed to build pygame.
- Version mismatch info:
- The error trace references SDL_CONFIG with value '2.0' (DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])), indicating a SDL2 requirement, but the build cannot locate sdl2-config. No explicit version mismatch is shown beyond the SDL2 tooling missing. pygame is being pulled from requirements as pygame==2.1.0.FROM python:3.11-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy minimal project files to build from source
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: print Gym version to verify
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
Build status - VerifyBuild status: build_failed Key concerns - COPY steps depend on build context files (requirements.txt, setup.py, gym/ dir, bin/docker_entrypoint); missing files break the build. - Using .[testing] extras requires setup.py to expose a 'testing' extra; if not defined, build may fail or skip needed test dependencies. - The smoke test for CartPole-v1 assumes environment registration; gym version changes or custom builds may affect availability. Failing step and commands - Failing step: Docker build step: [10/11] RUN python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && pip install .[testing] --no-cache-dir - Exit code: 1 - Command that failed: RUN python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && pip install .[testing] --no-cache-dir - Key error trace excerpt: 8.333 error: subprocess-exited-with-error 8.333 × Getting requirements to build wheel did not run successfully. 8.333 ... 8.333 Missing dependencies 8.333 [end of output] 8.333 8.333 note: This error originates from a subprocess, and is likely not a problem with pip. 8.335 ERROR: Failed to build 'pygame' when getting requirements to build wheel 8.333 8.333 ERROR: process "/bin/sh -c python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && pip install .[testing] --no-cache-dir" did not complete successfully: exit code: 1 What was missing or problematic - Missing pygame dependencies were not found: - MIXER: not found - PORTMIDI: not found - PORTTIME: not found - Pygame warning prior to failure: - WARNING:root:Some pygame dependencies were not found. Pygame can still compile and install, but games that depend on those missing dependencies will not run. Version/compatibility notes - Base image used: python:3.11-slim (see: load metadata for docker.io/library/python:3.11-slim) - During the build, Python 3.13 was installed: - Setting up libpython3.13-minimal:amd64 (3.13.5-2) - Setting up python3.13-minimal (3.13.5-2) - Setting up python3 (3.13.5-1) - The wheel/build attempt targets pygame inside this environment, i.e., building with Python 3.13 on a base that began as Python 3.11, which can cause wheel/build failures due to version incompatibilities. - Project dependency causing the failure: pygame==2.1.0 (the failing target during “Getting requirements to build wheel”). Filenames/paths and packages mentioned - Failing step: the RUN command above - Error arises during building pygame while fulfilling requirements.txt and the optional [testing] extras - pygame==2.1.0 is the failing wheel target In short - The build fails installing pygame==2.1.0 in a Python 3.13 environment, due to missing dependencies (MIXER, PORTMIDI, PORTTIME) and a downstream “Missing dependencies” error. Root cause appears to be a Python version mismatch introduced when a Debian base image started as Python 3.11-slim but upgraded to Python 3.13 during apt operations.
FROM python:3.11-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
libportmidi-dev portmidi \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy minimal project files to build from source
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt --no-cache-dir && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: verify Gym import and version
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
- Exact error message and exit code - E: Unable to locate package portmidi - exit code: 100 - Failing command/step - RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake xvfb wget ca-certificates curl git libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev pkg-config libportmidi-dev portmidi && rm -rf /var/lib/apt/lists/* - Missing packages or files mentioned - portmidi (not found in the apt repositories) - Version mismatch info - Base image is python:3.11-slim using Debian trixie; apt sources show trixie, and portmidi is not available in these repositories for this release, implying a repo/package version mismatch.
FROM python:3.11-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy minimal project files to build from source
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt --no-cache-dir && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: verify Gym import and version
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
- Exact error message and exit code
- Error: "ERROR: Failed to build 'pygame' when getting requirements to build wheel"
- Exit code: 1
- Failing command/step
- Step: [10/11] RUN python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt --no-cache-dir && pip install .[testing] --no-cache-dir
- Missing packages or files mentioned
- "Missing dependencies" (pygame build output)
- Not found:
- "MIXER: not found"
- "PORTMIDI: not found"
- "PORTTIME: not found"
- Version mismatch / other relevant details
- The build tries to install pygame==2.1.0 from source:
- "Downloading pygame-2.1.0.tar.gz" (no wheel available for this environment)
- This implies no compatible prebuilt wheel for Python 3.11 in the slim image, leading to a source build that fails due to missing system dependencies.FROM python:3.10-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy essential build files
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt --no-cache-dir && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: verify Gym import and version
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
Summary: - Failing step (command/step): [10/11] RUN python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt --no-cache-dir && pip install .[testing] --no-cache-dir - Exact error message and exit code: error: command 'swig' failed: No such file or directory exit code: 1 - Missing packages or files mentioned: - swig (not installed in the image; required to build box2d-py) - Version mismatch / environment details: - Base image: python:3.10-slim - Python/pip tooling shown in logs: pip 26.0.1, setuptools 82.0.1, wheel 0.46.3 - The failure occurs while building the wheel for box2d-py (a dependency from requirements.txt) during the "Getting requirements to build wheel" / "Building wheels for collected packages" phase. No SWIG binary was available to satisfy that build requirement.
FROM python:3.10-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
swig \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy essential build files
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt --no-cache-dir && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: verify Gym import and version
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
Summary (under 1500 chars): - Exact error message and exit code - FileNotFoundError: [Errno 2] No such file or directory: 'README.md' - Exited with: exit code 1 - Context: during the step “Getting requirements to build wheel” inside the failing pip install sequence - Failing command/step - Step [10/11] RUN python -m pip install --upgrade pip setuptools wheel && pip install -r requirements.txt --no-cache-dir && pip install .[testing] --no-cache-dir - The error occurs while executing this RUN, specifically during the wheel-building phase - Missing packages or files mentioned - The build failed because the setup process attempted to read README.md and could not find it: [Errno 2] No such file or directory: 'README.md' - Version mismatch info - Base image uses Python 3.10-slim, but the build logs show Python 3.13 being installed later (python3-software, python3-minimal, etc.), indicating multiple Python versions in the environment - Wheels being pulled in the log include cp310 (compatible with Python 3.10), while the system also contains Python 3.13, which can cause version/compatibility confusion during building - This environment mismatch could contribute to wheel-building failures beyond the missing README.md file
FROM python:3.11-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
swig \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy essential build files
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt --no-cache-dir && \
pip install .[testing] --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: verify Gym import and version
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
FROM python:3.10-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
swig \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
WORKDIR /workspace/gym
# Copy essential project files
COPY README.md /workspace/gym/README.md
COPY requirements.txt /workspace/gym/requirements.txt
COPY setup.py /workspace/gym/setup.py
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies and build the project from source
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt --no-cache-dir && \
pip install . --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command: verify Gym import and version
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]
Summary (under 1500 chars): - Exact error message and exit code: - "ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::zugrocdpcynwoo7n8690y97m0: \"/README.md\": not found" - No explicit exit code is shown in the log. - Failing command/step: - [ 5/12] COPY README.md /workspace/gym/README.md - Missing packages or files mentioned: - Missing file: README.md could not be found in the build context. - Cause noted by docker: CopyIgnoredFile: Attempting to Copy file "README.md" that is excluded by .dockerignore (line 26) - Version mismatch info: - Base image in use: docker.io/library/python:3.10-slim@sha256:4ba18b066cee17f2696cf9a2ba564d7d5eb05a91d6a949326780aa7c6912160d - No version mismatch indicated in the error. - Additional context: - The build progressed to step 4 ([ 1/12] FROM ...) and was canceled at step 4, with the failure occurring at step 5/12 when attempting to COPY README.md.
Gym: A universal API for reinforcement learning environments
- Exact error message and exit code - Error: "ERROR: failed to build: failed to solve: failed to calculate cache key: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::pcxeq5snod2hbh2jskxvbocc8: "/README.md": not found" - Exit code: not shown in the provided log - Failing command/step - [ 5/12] COPY README.md /workspace/gym/README.md - Missing packages or files mentioned - Missing: README.md (not found) - Related warning: "CopyIgnoredFile: Attempting to Copy file "README.md" that is excluded by .dockerignore (line 26)" - Version mismatch info - Base image: python:3.10-slim (digest: sha256:4ba18b066cee17f2696cf9a2ba564d7d5eb05a91d6a949326780aa7c6912160d)
Gym: A universal API for reinforcement learning environments
Summary (under 1500 chars): - Exact error message and exit code - "ERROR: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::12718xmig2fei52bncifhg4g4: "/README.md": not found" - Exit code: not shown in the log - Failing command/step - [ 5/12] COPY README.md /workspace/gym/README.md - Missing packages or files mentioned - Missing file: README.md (not found) - Related warning: CopyIgnoredFile - Attempting to Copy file "README.md" that is excluded by .dockerignore (line 26) - Version mismatch info - Base image used: python:3.10-slim (with digest sha256:4ba18b066cee17f2696cf9a2ba564d7d5eb05a91d6a949326780aa7c6912160d) - No explicit version mismatch reported - Additional notes - The COPY step fails due to the file being excluded by .dockerignore, leading to the checksum calculation failure for "/README.md". Consider including README.md in the build context or removing/adjusting the ignore rule.
**/__pycache__ **/*.pyc *.git **/.git node_modules .dockerignore Dockerfile README.md *.pyc *.pyo *.pyd venv/ build/ dist/ .eggs/ *.egg-info __pycache__
**/__pycache__ **/*.pyc *.git **/.git node_modules .dockerignore Dockerfile README.md *.pyc *.pyo *.pyd venv/ build/ dist/ .eggs/ *.egg-info __pycache__
**/__pycache__ **/*.pyc *.git **/.git node_modules .dockerignore Dockerfile *.pyc *.pyo *.pyd venv/ build/ dist/ .eggs/ *.egg-info __pycache__
Concerns: The container switches to a non-root user after installing dependencies; ensure /workspace/gym is owned by gymuser or adjust permissions to avoid runtime permission errors. Smoke [FAIL]: python -c 'import gym; print(gym.__version__); print(gym.__file__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import gym; print(gym.__name__) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.11-slim
# Metadata
LABEL maintainer="Gym Maintainers"
# Install system dependencies (build tools and libs)
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc g++ libffi-dev libjpeg-dev zlib1g-dev \
libgl1-mesa-dev libosmesa6-dev unzip patchelf ffmpeg cmake \
xvfb wget ca-certificates curl git \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m gymuser
# Copy source
WORKDIR /workspace/gym
COPY gym /workspace/gym/gym
COPY bin/docker_entrypoint /workspace/gym/bin/docker_entrypoint
COPY setup.py /workspace/gym/setup.py
RUN chmod +x /workspace/gym/bin/docker_entrypoint
# Install Python dependencies from setup.py (core only, no heavy extras)
RUN python -m pip install --upgrade pip setuptools wheel && \
python -m pip install . --no-cache-dir
# Switch to non-root user for running
USER gymuser
WORKDIR /workspace/gym
# Default command to verify import
CMD ["python","-c","import gym,sys; print('gym version:', gym.__version__); print('path:', gym.__file__)" ]
ENTRYPOINT ["/workspace/gym/bin/docker_entrypoint"]