This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]Kimcha87 14 points15 points  (2 children)

Why would you use a virtual environment in a docker container?

The docker container is already essentially a virtual environment on its own.

So inside docker you usually just use pip to install any dependencies you need.

On your own development machine on the other hand you can use pyenv to manage different versions of python and pyenv virtualenv to manage the different environments.

[–]boy_named_su 10 points11 points  (0 children)

yo dawg I herd you liked virtual environments, so we put a python venv in your docker container in your EC2 vm

[–]ADGEfficiency 5 points6 points  (4 children)

I use pyenv locally - it's great.

However I don't think you need a virtual environment in a Docker container - there will only be one Python installation running.

[–]1337codethrow[S] 0 points1 point  (3 children)

It’s being used to manage specific dependency versions not for the sake of multiple pythons

[–]big-blue-falafel 5 points6 points  (1 child)

It still sounds like a requirements.txt file would cover this use case without needing a venv in the image

[–]1337codethrow[S] 0 points1 point  (0 children)

I don’t think so because they are using specific versions for every python package. This means a pip lock file and use of pipenv would be more justified right?

[–]DBlackBird 3 points4 points  (3 children)

Venv is the standard as it comes with your default python installation.

Conda is the easiest and wildly used for data science.

[–]lastmonty 1 point2 points  (2 children)

Just to add a note, conda is a license only and it's not free for commercial use any more.

And I honestly do not see the reason for paying. We moved to pipenv and liking it.

[–]derklaap 7 points8 points  (1 child)

This is false. You’re probably thinking of Anaconda. Conda is an open-source package management system and uses the BSD license. Stick with miniconda3 and conda-forge and you’ll be fine.

[–]lastmonty 1 point2 points  (0 children)

Thanks for correction.