i have this weird problem with python venvs. If i activate the venv and try to install packages via pip install -r requirements.txt the packages are getting installed to the global python and not in the venv.
i am using python 3.11.2 on Debian Bookworm.
I've googled now 2 hours and tried everything including everything in pip installing in global site-packages instead of virtualenv and nothing helped. The path are correctly set,which pip gives me the path to the venv pip, there are no aliases, i created configfiles but nothing helped.
Then i tried to install a package without the -r requirements.txt e.g. pip install numpy that worked and the packages were installed inside the venv.
So what's the problem of pip not installing packages with the -r parameter to the venv?
This works for me:
python -m pip install -r requirements.txt
I think you error is occurring because pip is still referring to the global pip. This command refers to python's (the venv python) pip instead of the global python's pip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With