From 21500dc7919747b7f881b5188ba44421dc0371d3 Mon Sep 17 00:00:00 2001 From: Kobi Kadosh Date: Mon, 30 Jun 2025 07:46:59 +0300 Subject: [PATCH] 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. --- .devcontainer/Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8c70dd43..b7e03411 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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 \ No newline at end of file +USER node