New submission from Bernd Wechner <bernd.wech...@gmail.com>:

When developing Python software it is highly discouraged to install python 
modules globally (risking adverse impacts upon the underlying OS where if has 
Python dependencies).

Project by project this typically done with venvs (and the venv module)

User by user it is typically done with the --user option.

In fact to make impacting system libraries less likely a pip.conf file can be 
written that contains:

[install]
user = true

I suspect this is an increasingly common practice which means pip installs are 
on a local user profile not into system dirs. 

Alas when in a venv now, pip bombs with a detected conflict:

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

This was explored with pip here:

https://github.com/pypa/pip/issues/8977

It turns out that pip can be made to function by overriding this setting in the 
venv. That is depositing a pip.conf in the vend dir that contains:

[install]
user = true

and all is good once more. In the activated venv pip now works again. 

This is at its core a coordination issue then between the venv module and pip 
and the point to fix it seems most likely to be in the venv module which, 
knowing that this conflict can exist can as a safety precaution simply always, 
or optionally, write a pip.conf into newly created venvs that disables the user 
options. Given pip won't work in a venv if that option is enabled and we know 
that up front.

Why fix it in the venv module? Because discovering the cause of this conflict 
was time consuming and disorienting, poor UX by any definition and it should 
ideally not arise or if it must have an easily discovered fix. 

This is a request to prevent it arising altogether in newly created venvs.

----------
components: Library (Lib)
messages: 378368
nosy: bernd.wechner
priority: normal
severity: normal
status: open
title: venv module clashes with pip --user ... improve coordination.
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to