Let me preface this by stating that I have read pip installing in global site-packages instead of virtualenv and it did not solve my problem.
When creating a virtual environment using python -m venv venv
(or any other name) and then activating said venv using source venv/bin/activate
, running pip install [package]
actually installs the package to the (user) global python site packages, located in ~/.local/lib/python3.7/site-packages/
.
Interestingly, it always tries to install the packages and does not recognize that they are installed globally, meaning it is looking for packages initially in the correct location.
I am running Manjaro Linux, and running the latest updates.
I created this virtual environment in ~/Stuff/tests/venv
.
Running which pip
and which python
returns:
(venv) angelin@asgard:~/Stuff/tests/venv $ which pip
/home/angelin/Stuff/tests/venv/bin/pip
(venv) angelin@asgard:~/Stuff/tests/venv $ which python
/home/angelin/Stuff/tests/venv/bin/python
Checking said pip executable shows the correct shebang:
(venv) angelin@asgard:~/Stuff/tests/venv $ cat bin/pip
#!/home/angelin/Stuff/tests/venv/bin/python
# -*- coding: utf-8 -*-
...
My path, when inside the virtualenv, points to the virtual environment first, too:
(venv) angelin@asgard:~/Stuff/tests/venv $ echo $PATH
/home/angelin/Stuff/tests/venv/bin:/home/angelin/.local/bin:...
Manually running python -m pip
or venv/bin/python venv/bin/pip
produces the same results.
The PYTHONPATH
variable is not set.
I have tried reinstalling python and pip using pacman -S python python-pip
, but I believe that only reinstalls the global package (located in /usr/bin
and I didn't want to mess with the .local
install in case I broke something even more than it is.
Any advice is appreciated.