Skip to content

pip ignores the site.ENABLE_USER_SITE value if user is set explicitly (asymetric with venv behaviour) #8794

@pelson

Description

@pelson

Environment

  • pip version: 20.2.0 & master
  • Python version: all
  • OS: all

Description

When we have a venv or virtualenv, and site.ENABLE_USER_SITE is False, and try to pip install --user and error is raised (InstallationError). If we do the same with a non-virtual environment, the ENABLE_USER_SITE value is ignored.

$ python -m venv /tmp/venv
$ source /tmp/venv/bin/activate
(venv) $ PYTHONNOUSERSITE=1 pip install --user typing-extensions
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

But with a base environment (i.e. not virtual):

(venv) $ deactivate
$ PYTHONNOUSERSITE=1 pip -v install --user typing-extensions
Using pip 20.2.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
User install by explicit request
...
Collecting typing-extensions
  Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Installing collected packages: typing-extensions
Successfully installed typing-extensions-3.7.4.3

Expected behavior

I expect the site.ENABLE_USER_SITE to always be honoured

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: user schemeHandling of packages in user-specific directoriesstate: needs eyesNeeds a maintainer/triager to take a closer look

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions