Python Forum

Full Version: installing packages Globally vs Virtually
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all, I was wondering what are best practices regarding installing packages globally vs installing in a virtual environment. What would be some good examples of packages that should be installed globally? Thanks!
i think it would depend on your situation...meaning your computer, OS type, who owns, what its used for, how many people is it used for, how many projects you are developing, etc.

I never use a virtual environment. i install everything to python even if it is to test someones package here that imports it and to only use it once. However i am also using linux, which i tend to reinstall every 6 months to a year. The same is not true with windows users. I also am using my personal PC vs a work/school one.

A useful benefit to using a virtual environment would be the ability to run numerous package versions to the same python version. Another would be those times that you use a package once, you would not have to install it to your systems python. In my opinion if you are going to consistently use a package, and not need multiple versions of it, the best solution would be to install to the systems python. Otherwise use a virtual environment.

Why the need for virtual environments?
I use virtual environment in many situation,also many times i don't as small code messing around and testing out stuff.
Almost always use virtual environment when working with code for web-development or larger GUI project.
This make it a lot easier if need to move code for local environment to a server,or example build .exe for a GUI prosject.

Always use virtual environment if i need to keep track of dependencies as example making a module/package,
then pip list(is totally useless on my OS) or pipenv graph(using pipenv),
will only list only dependencies in virtual environment and building wheel with setup.py becomes a lot easier.