fix: add --break-system-packages flag to pip installs in devcontainer

Resolves build failure caused by PEP 668 "externally-managed-environment" 
protection in Python 3.11+. The --break-system-packages flag is safe to 
use in this containerized development environment as it won't affect the 
host system. This allows pip to install development tools (black, flake8, 
isort) globally within the container as intended.

Fixes devcontainer creation error that was preventing environment setup.
This commit is contained in:
Kobi Kadosh
2025-06-30 07:46:59 +03:00
committed by GitHub
parent a54fc2fb5d
commit 21500dc791

View File

@@ -71,8 +71,13 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
-x
# Install Python packages and create symlink
RUN pip3 install --upgrade pip && \
pip3 install black flake8 isort && \
# Fix for PEP 668 "externally-managed-environment" error in Python 3.11+
# The --break-system-packages flag is safe to use in this devcontainer environment
# because we're in an isolated container where system package conflicts won't
# affect the host system. This allows pip to install packages globally within
# the container, which is the expected behavior for development environments.
RUN pip3 install --upgrade pip --break-system-packages && \
pip3 install black flake8 isort --break-system-packages && \
ln -sf /usr/bin/python3 /usr/local/bin/python
# Install Claude
@@ -84,4 +89,4 @@ USER root
RUN chmod +x /usr/local/bin/init-firewall.sh && \
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
chmod 0440 /etc/sudoers.d/node-firewall
USER node
USER node