Skip to content

Commit

Permalink
Use venv to resolve error: externally-managed-environment (#190)
Browse files Browse the repository at this point in the history
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: 李奕鹏 <45395042+liyipeng123@users.noreply.github.com>
  • Loading branch information
liyipeng3 and liyipeng3 authored Apr 26, 2024
1 parent 75fb953 commit f88730a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu

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

ADD *.sh /
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ mkdir -p /root/.ssh
echo "${INPUT_DST_KEY}" > /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa

python3 -m venv /hub-mirror/venv
source /hub-mirror/venv/bin/activate
pip3 install -r /hub-mirror/requirements.txt

git lfs install
Expand Down

0 comments on commit f88730a

Please sign in to comment.