It appears that Alpine is now a "Python built-in" distro like we've seen of Debian and special handling is now needed. Also, the Helix use of Python appears to be very dated. The Dockerfile appears to use virtual environments but doesn't actually use them.
I'm trying to develop a better pattern in #1091.
Observed error.
5.656 (18/18) Installing python3-dev (3.12.3-r1)
6.349 Executing busybox-1.36.1-r28.trigger
6.370 OK: 1285 MiB in 96 packages
8.680 error: externally-managed-environment
8.680
8.680 × This environment is externally managed
8.680 ╰─>
8.680 The system-wide python installation should be maintained using the system
8.680 package manager (apk) only.
8.680
8.680 If the package in question is not packaged already (and hence installable via
8.680 "apk add py3-somepackage"), please consider installing it inside a virtual
8.680 environment, e.g.:
8.680
8.680 python3 -m venv /path/to/venv
8.680 . /path/to/venv/bin/activate
8.680 pip install mypackage
8.680
8.680 To exit the virtual environment, run:
8.680
8.680 deactivate
8.680
8.680 The virtual environment is not deleted, and can be re-entered by re-sourcing
8.680 the activate file.
8.680
8.680 To automatically manage virtual environments, consider using pipx (from the
8.680 pipx package).
8.680
8.680 note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
8.680 hint: See PEP 668 for the detailed specification.
------
Dockerfile:55
--------------------
54 | # Install Helix Dependencies
55 | >>> RUN apk update && apk add --no-cache && \
56 | >>> apk add \
57 | >>> cargo \
58 | >>> libffi-dev \
59 | >>> linux-headers \
60 | >>> python3-dev \
61 | >>> openssl-dev && \
62 | >>> ln -sf /usr/bin/python3 /usr/bin/python && \
63 | >>> curl https://bootstrap.pypa.io/get-pip.py -o ./get-pip.py --fail --silent --show-error && \
64 | >>> python3 ./get-pip.py && rm ./get-pip.py && \
65 | >>> python3 -m pip install --upgrade pip==22.2.2 && \
66 | >>> python3 -m pip install virtualenv==20.16.5 && \
67 | >>> pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple && \
68 | >>> pip install ./helix_scripts-*-py3-none-any.whl && \
69 | >>> apk del \
70 | >>> cargo \
71 | >>> libffi-dev \
72 | >>> linux-headers \
73 | >>> python3-dev \
74 | >>> openssl-dev
75 |
I took our Alpine 3.18 Dockerfiles, changed the Alpine version number to
3.20
and built the Dockerfile. It fails.Related: https://github.com/pypa/pip/issues/12429
It appears that Alpine is now a "Python built-in" distro like we've seen of Debian and special handling is now needed. Also, the Helix use of Python appears to be very dated. The Dockerfile appears to use virtual environments but doesn't actually use them.
I'm trying to develop a better pattern in #1091.
Observed error.