I would recommend to 'python -m venv' and thats all.
I would recommend to 'python -m venv' and thats all.
The only limitation I've encountered is when moving the environment or renaming one of the parent directories. In which case it's easy to create a new one:
# optional: freeze the environment if you don't already have a requirements.txt
source .venv/bin/activate
pip freeze > requirements.txt
deactivate
# remove the old environment
rm -rf .venv
# create a new one
python3.10 -m venv .venv
# activate it
source .venv/bin/activate
# install the requirements
pip install -r requirements.txt # install the requirements
npm install
# remove it
rm -rf node_modules
The rest is unnecessary because NPM uses the equivalent of a venv automatically based on your current working directory and the location of your package.json file.For those already familiar with venvs, the above just condenses to “remove the old venv and create a new one”.
Aside from needing to know to use it. Which is certainly a problem. But python blessing a single venv-system might be worse in the long run...?
The whole reason I posted this one is to justify the "just use -m pip and -m venv" stance I wrote in the article 4 days ago.
Because you will always have a very vocal minority of people that will fill the threads with counter arguments actually increasing complexity and risks of failure.
As the article says, I think these days it's pretty safe to just use Python's built-in venv and stay away from everything else.
sudo apt install python3.X
I also recommend similarly sudo apt install python3.X-venv
which allows you to create venvs with whichever python version you have installed python3.X -m venv .venv