#Any case where multiple virtual environments are used in a project?

12 messages · Page 1 of 1 (latest)

tardy star
#

Hello, I am learning about manually creating virtual environments.

In your experience have you ever needed to create multiple virtual environments for a project? Like creating a venv1 and a venv2. Just curious.

Thanks!

craggy yacht
tardy star
#

alright thats what i thought, thank you!

pseudo holly
#

You may want to have a scalable solution. For that you will need to spin up additional vm’s

tardy star
#

Sorry would you please elaborate on what scalable solution means? Like other projects building upon my code?

pseudo holly
#

no, like serving hudressd or thousand clients the same time

tardy star
#

I see, so each user might have a different version of dependencies they need to use?

pseudo holly
#

No, they would normally run the same version, you just spin up the necessary number of instances to serve all clients without too much waiting

tardy star
#

gotcha, thanks

pseudo holly
#

oh, totally misunderstood venv as the term - I was on a different track of thoughts... sorry
Obviously you need a single venv for the project, unless there are incompatible packages needed. In that case you may need multiple venvs, but all venvs need to run as a separate process, so it is only feasible if you can/need to separate these processes.

tardy star
#

do you happen to have an example where incompatible packages are needed?

pseudo holly
#

not specifically, but there could be a case where you develop a package with features introduced in python 3.12, but you have a dependency on another package which had a breaking change in 3.11 and not yet fixed, so you need python 3.10 for that. in this case you would need to split your tasks to 2 processes and run two python processes (on with 3.10 and another with 3.12), you would also need to have a handoff mechanism between the 2 processes (file/pipe, shared memory, networking - some kind of IPC)...