Python installs packages globally, even with venv

63 views Asked by At

I have python and try to use Venvs (best practice yada yada yada). Whenever I install a package globally, it also installs in ALL activated virtual environments, and vice versa. What is the fix?

I installed a package 'pandas' with Pip and it worked. I then activated the venv I was working with and pip freeze and 'pandas' were in the the venv. It should not have been because I had not installed it to the virtual environment yet.

I use: MacOS and Python 3.11

1

There are 1 answers

0
Suprateem Banerjee On BEST ANSWER

It is likely that your Virtual Environment is accessing packages installed in base or root. Best practice is to not install any package outside of virtual environments.

Also, I would recommend switching to Anaconda as a package manager, as it is less buggy and provides another alternative for accessing packages (using conda install).