Ignore `--user` in virtual environments
See original GitHub issueWhat’s the problem this feature will solve?
Ensure that folks who do pip config set install.user true
can continue using virtual environments without “–user isn’t visible, aborting” messages. 😃
Describe the solution you’d like
--user
does nothing in a virtualenv that does not have system site-packages access.
Alternative Solutions
Maintain status quo. Or #7002. Or something else entirely!
Additional context
https://github.com/pypa/pip/issues/4141#issuecomment-272870788 – some past discussion. https://github.com/pypa/pip/pull/6984#issuecomment-539390107 – a proposed way to implement this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Top Results From Across the Web
gitignore syntax - how to exclude virtualenv sub-directories?
This will ignore all sub directories in the venv folder. ... Pycharm for example asks where you want to set up a virtual...
Read more >pip install --user misbehaves inside venv · Issue #5702 - GitHub
To summarise, --user doesn't work properly when used within a virtual environment. Normally, the obvious workaround is "don't do that", but when ...
Read more >venv — Creation of virtual environments — Python 3.11.1 ...
Python Packaging User Guide: Creating and using virtual environments ... File Explorer will resolve the symlink eagerly and ignore the virtual environment.
Read more >Disable pip Outside of Virtual Environments
How to stop pip from running outside of a virtual environment and messing up your dependencies?
Read more >Virtual environments for absolute beginners — what is it and ...
In order to do this you can simply create a file in your root folder called .gitignore (notice that gitignore is the extension,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep.
I feel this doesn’t as much sense if we have saner defaults that work better in this case. Explicit opt-ins shouldn’t be needed then, which should make things easier to manage. : )
@pradyunsg I think this was more to contrast the behavior updated with PR #7155, that is: if
--user
is indicated anywhere (CLI, environment, configuration) while we are in a virtual environment which does not have system site packages enabled (the default IIRC) then pip aborts.That said, the reason that this would happen for users is because they would put
user = true
in config to avoid accidental global installation, so maybe the general best-practice advice should be to upgrade to 19.4 (20.0?) when it is released and then just executepip install ...
which should do the right thing?