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.

pip no longer prompts for user credentials

See original GitHub issue

Description

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Jun 18, 2021

url: https://:@foo.com/

While there’s been a unintended change in behaviour here, I’m not sure that the older behaviour was correct even.

I wouldn’t even say it’s unintended. This is similar to the https://foo@example.com vs https://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.

0reactions
uranusjrcommented, Jul 10, 2021

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

Read more comments on GitHub >

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

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