Skip to content

pip/_internal/locations.py not respecting site.ENABLE_USER_SITE #7055

@bjmuld

Description

@bjmuld

Environment

  • pip version: 19.2.2
  • Python version: 3.7
  • OS: Ubuntu

Description
user site is disabled in site.py (and command-line [-s], and PYTHONNOUSERSITE env var)
but pip is still looking in ~/.local/lib/python*/site-packages/ during (un)installation of packages

Expected behavior
pip should respect site.ENABLE_USER_SITE=False

How to Reproduce

  1. install an editable "user" package in ~/.local : pip install --user -e ~/xanity-src/
  2. create a new python installation at /opt/my-python
  3. install a package there: PYTHONNOUSERSITE=1 /opt/my-python/bin/python -m pip install -e ~/xanity-src/
  4. try to uninstall that package: PYTHONNOUSERSITE=1 /opt/my-python/bin/python -m pip uninstall xanity
  5. error "Egg-link * does not match installed location of xanity (*)"

Output

bjmuld@disco:~$ pip install -e ~/work/xanity/src/xanity/xanity_self_replication/
Obtaining file:///home/bjmuld/work/xanity/src/xanity/xanity_self_replication
Requirement already satisfied: dill in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from xanity==0.2b9) (0.3.0)
Requirement already satisfied: pandas in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from xanity==0.2b9) (0.25.1)
Requirement already satisfied: pyparsing in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from xanity==0.2b9) (2.4.2)
Requirement already satisfied: cloudpickle in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from xanity==0.2b9) (1.2.2)
Requirement already satisfied: numpy>=1.13.3 in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from pandas->xanity==0.2b9) (1.16.5)
Requirement already satisfied: pytz>=2017.2 in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from pandas->xanity==0.2b9) (2019.2)
Requirement already satisfied: python-dateutil>=2.6.1 in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from pandas->xanity==0.2b9) (2.8.0)
Requirement already satisfied: six>=1.5 in ./work/chonets/.xanity/conda_env/lib/python3.7/site-packages (from python-dateutil>=2.6.1->pandas->xanity==0.2b9) (1.12.0)
Installing collected packages: xanity
  Found existing installation: xanity 0.2b9
ERROR: Exception:
Traceback (most recent call last):
  File "/home/bjmuld/work/chonets/.xanity/conda_env/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/home/bjmuld/work/chonets/.xanity/conda_env/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 407, in run
    use_user_site=options.use_user_site,
  File "/home/bjmuld/work/chonets/.xanity/conda_env/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 51, in install_given_reqs
    auto_confirm=True
  File "/home/bjmuld/work/chonets/.xanity/conda_env/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 830, in uninstall
    uninstalled_pathset = UninstallPathSet.from_dist(dist)
  File "/home/bjmuld/work/chonets/.xanity/conda_env/lib/python3.7/site-packages/pip/_internal/req/req_uninstall.py", line 538, in from_dist
    '(at %s)' % (link_pointer, dist.project_name, dist.location)
AssertionError: Egg-link /home/bjmuld/work/xanity/src does not match installed location of xanity (at /home/bjmuld/work/xanity/src/xanity/xanity_self_replication)

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automationtype: supportUser Support

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions