Pip won't install packages in virtualenv
Asked Answered
V

2

9

After performing a system upgrade this morning, I'm not able to install or update packages in any of my old or fresh created virtual environments. I create the virtual environments using virtualenvwrapper.

I've tried rebooting my PC, recreating all of my virtual environments, but nothing worked. Strange enough, pip freeze does not output my installed packages, although they are found in sitepackages.

Im using python3.7 on manjaro linux with the newest kernel. In my envs and on my system pip 19.2.3 is installed.

The error I'm seeing is the following:

pip install <package>
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

When trying to use the system pip without virtualenv, everything works just fine.

pip install cython
Requirement already satisfied: cython in /home/manuel/.local/lib/python3.7/site-packages (0.29.13

I expect pip to install the desired package to the sitepackages folder of my virtualenv without telling me to not use a '--user' install, which I'm not doing explicitly anyway

Vendetta answered 5/9, 2019 at 8:34 Comment(1)
You can read a discussion about this change in Manjaro forums : forum.manjaro.org/t/call-for-testing-making-pip-default-to-user/…Nauplius
V
8

I was able to fix this myself. I checked all the pip config files here https://pip.pypa.io/en/latest/user_guide/#configuration

Seems like in the pip configuration file /etc/pip.conf the user parameter was set to true. Changing it to false resolved my issue.

I still don't know why/if the config file changed.

Vendetta answered 5/9, 2019 at 9:22 Comment(0)
A
4

One quick fix is (this work for me!):

  1. Go to the pyvenv.cfg file in the Virtual environment folder

  2. Set the include-system-site-packages to true and save the change

  3. Reactivate the virtual environment. This should work!

Thank's to jeffmaddocks!

Attorneyatlaw answered 24/4, 2023 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.