Skip to content

🐛 fix(pip): set PIP_USER=0 to prevent --user installs in virtualenvs#3719

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-pip-user-3010
Feb 17, 2026
Merged

🐛 fix(pip): set PIP_USER=0 to prevent --user installs in virtualenvs#3719
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-pip-user-3010

Conversation

@gaborbernat
Copy link
Member

Users with pip config --user configured globally experienced installation failures in tox virtualenvs. 🐛 When pip attempted to honor the --user flag inside virtualenvs, it crashed because user site-packages aren't visible in isolated environments.

This regression was introduced during the tox 4 rewrite. Tox 3 correctly set PIP_USER=0 to override user configuration, but this protection was lost in the rewrite. The fix restores this behavior by setting the environment variable in all virtualenv-based Python environments.

The solution follows pip's documented environment variable precedence where PIP_USER=0 explicitly disables --user installs regardless of config file settings. This preserves user workflows while ensuring tox virtualenvs remain isolated. ✨

Fixes #3010

@gaborbernat gaborbernat force-pushed the fix-pip-user-3010 branch 2 times, most recently from b68f4c6 to bb9ad36 Compare February 17, 2026 02:36
@gaborbernat gaborbernat enabled auto-merge (squash) February 17, 2026 02:36
@gaborbernat gaborbernat marked this pull request as draft February 17, 2026 02:42
auto-merge was automatically disabled February 17, 2026 02:42

Pull request was converted to draft

@gaborbernat gaborbernat force-pushed the fix-pip-user-3010 branch 2 times, most recently from 35e0d84 to e63f151 Compare February 17, 2026 06:01
When users have pip configured globally to install packages with --user
(via pip config --user), pip attempts to use this inside tox virtualenvs
where user site-packages aren't visible, causing installation failures.

This was fixed in tox 3 but the patch was lost during the tox 4 rewrite.

Fixes tox-dev#3010
@gaborbernat gaborbernat marked this pull request as ready for review February 17, 2026 06:17
@gaborbernat gaborbernat enabled auto-merge (squash) February 17, 2026 06:17
@gaborbernat gaborbernat merged commit 6450988 into tox-dev:main Feb 17, 2026
28 checks passed
@gaborbernat gaborbernat deleted the fix-pip-user-3010 branch February 17, 2026 14:37
@gaborbernat gaborbernat restored the fix-pip-user-3010 branch February 17, 2026 17:12
@gaborbernat gaborbernat deleted the fix-pip-user-3010 branch February 18, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tox should run pip with PIP_USER=0 (again)

1 participant