Skip to content

Commit f88730a

Browse files
authored
Use venv to resolve error: externally-managed-environment (#190)
This patch try to resolve `externally-managed-environment` error by using separate venv. ``` error: externally-managed-environment  × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. ``` See also: - https://stackoverflow.com/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3 - https://peps.python.org/pep-0668/ Co-authored-by: 李奕鹏 <[email protected]>
1 parent 75fb953 commit f88730a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu
22

3-
RUN apt update && apt install git git-lfs python3 python3-pip -y && \
3+
RUN apt update && apt install git git-lfs python3-full python3-pip -y && \
44
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
55

66
ADD *.sh /

entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ mkdir -p /root/.ssh
1010
echo "${INPUT_DST_KEY}" > /root/.ssh/id_rsa
1111
chmod 600 /root/.ssh/id_rsa
1212

13+
python3 -m venv /hub-mirror/venv
14+
source /hub-mirror/venv/bin/activate
1315
pip3 install -r /hub-mirror/requirements.txt
1416

1517
git lfs install

0 commit comments

Comments
 (0)