Hello guys, I have some questions on how Python virtual environment (
python -m venv) works in docker containers.
- On my local openSUSE machine, I have an already created virtual environment
- I use VSCode’s Dev Container to open
workspacein a Tensorflow container, and
workspaceis mounted in the container.
- When I activate
.venvfrom the container, Python will not use the packages in
.venv. It seems that Python is still using system-wide packages. I checked this by running
pip3 list --localwhen
.venvwas activated, and it gave a result that is exactly the same as when
.venvis not activated.
- When I create a new virtual environment under
workspacefrom the container, it works and Python will use the packages in the new virtual environment.
- Python version is 10 on the local machine, and 8 in the container.
So why is Python in the container still using system-wide packages when the virtual environment (that is created on the local machine) is activated? Is this related to how Python is configured in the Tensorflow container?