Skip to content

bug: tox should run pip with PIP_USER=0 #838

@anntzer

Description

@anntzer
  • Minimal reproduceable example or detailed description, assign "bug"
  • OS and pip list output

tox cannot use pip to install in a venv if the user has a config file that defaults to --user installs (e.g. because they (I) intend to use the distro package manager when touching distro packages) -- because pip crashes in such settings. By setting the PIP_USER environment variable to 0, tox could override that setting to force the use of in-venv installs.

Arch Linux Py3.6 (from distro) in a clean venv.
pip list

Package    Version
---------- -------
pip        9.0.3  
pluggy     0.6.0  
py         1.5.3  
setuptools 39.0.1 
six        1.11.0 
tox        3.0.0  
virtualenv 16.0.0

foo/setup.py

from setuptools import setup; setup(name="foo")

foo/tox.ini

[tox]
envlist = py36

~/.config/pip/pip.conf

[install]
user = true

Running tox yields

GLOB sdist-make: /tmp/foo/setup.py
py36 inst-nodeps: /tmp/foo/.tox/dist/foo-0.0.0.zip
ERROR: invocation failed (exit code 1), logfile: /tmp/foo/.tox/py36/log/py36-3.log
ERROR: actionid: py36
msg: installpkg
cmdargs: ['/tmp/foo/.tox/py36/bin/pip', 'install', '-U', '--no-deps', '/tmp/foo/.tox/dist/foo-0.0.0.zip']

Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Exception information:
Traceback (most recent call last):
  File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 218, in run
    "Can not perform a '--user' install. User site-packages "
pip._internal.exceptions.InstallationError: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

py36 installed: foo==0.0.0
_____________________________________________________________________________________________ summary ______________________________________________________________________________________________
ERROR:   py36: InvocationError for command /tmp/foo/.tox/py36/bin/pip install -U --no-deps /tmp/foo/.tox/dist/foo-0.0.0.zip (see /tmp/foo/.tox/py36/log/py36-3.log) (exited with code 1)

Metadata

Metadata

Assignees

Labels

area:testenv-creationbug:normalaffects many people or has quite an impacthelp:wantedIssues that have been acknowledged, a solution determined and a PR might likely be accepted.level:mediumrought estimate that this might be neither easy nor hard to implementpr-merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions