pip no longer prompts for user credentials
See original GitHub issueDescription
When installing from an index url containing environment variables for user authentication, pip no longer prompts for credentials in case the environment variables aren’t set. This used to work up until v20.3.4.
Note: In our particular use case, packages are located on artifactory which returns 404 rather than 401 in case of incorrect credentials. Keyring is not an option since this needs to work in different environments where no keyring might be available.
Expected behavior
If environment variables needed for user authentication aren’t set, pip should prompt for credentials.
pip version
21.1.1
Python version
3.6.9
OS
Ubuntu 18.04 LTS
How to Reproduce
This works for pip version <= 20.3.4:
> echo $USER
> echo $PASSWORD
> pip install -i https://${USER}:${PASSWORD}@my.private.index -r requirements.txt
Looking in indexes: https://:****@my.private.index
User for my.private.index:
Instead now I get this:
> echo $USER
> echo $PASSWORD
> pip install -i https://${USER}:${PASSWORD}@my.private.index -r requirements.txt
Looking in indexes: https://:****@my.private.index
ERROR: Could not find a version that satisfies the requirement XXX
Output
No response
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
pip install keep asking user and password - Stack Overflow
Since I pass the username and password already in URL, should it just pass without aksing? Anyone have the same case and how...
Read more >Authentication - pip documentation v22.3.1
If no credentials are part of the URL, pip will attempt to get authentication credentials for the URL's hostname from the user's .netrc...
Read more >getpass — Portable password input — Python 3.11.1 ...
Prompt the user for a password without echoing. The user is prompted using the string prompt, which defaults to 'Password: ' . On...
Read more >Get started with Python packages in Azure Artifacts
Manually set up credentials for pip.ini/pip.conf for pushes, and .pypirc for pulls with a personal access token (PAT). Note. artifacts ...
Read more >getpass() and getuser() in Python (Password without echo)
The getpass() function is used to prompt to users using the string prompt and reads the input from the user as Password. The...
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 Free
Top 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
I wouldn’t even say it’s unintended. This is similar to the
https://foo@example.com
vshttps://foo:@example.com
debate we had in another issue; a blank username/password is not the same as not providing a username/password (according to how Basic Authentication is defined), so they should be treated differently.I think it’s correct to not prompt. You supplied a username/password pair with
foo:
, so when that fails to authenticate, pip is expected to fail as in all other cases when a username/password pair is suplied. If you want pip to prompt for a password, you should not write that:
.