question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore `--user` in virtual environments

See original GitHub issue

What’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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
pradyunsgcommented, Oct 23, 2019

so maybe the general best-practice advice should be to upgrade to 19.4 (20.0?)

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. : )

0reactions
chrahuntcommented, Oct 23, 2019

@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 execute pip install ... which should do the right thing?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found