-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip will hang asking for the password of an index server even if the output is redirected #2920
Comments
pip can't tell the difference between | tee my.log (where you can see the prompt and enter it) and > log.txt. If you want to run it headless, be sure to redirect input < /dev/null as well. That should make it error rather than hang. If it doesn't, then thats a bug, but on the information so far, I don't see the bug. |
pip should be able to tell the difference. |
@pypa/pip-committers Between "redirect input /note-to-self mark as awaiting PR once decided. |
I can confirm the situation has not changed with pip 19.1.1: Given
Run Then the following is pip's current behavior: No redirection, both "User" and "Password" prompts are visible:
With redirection, the "User" prompt is not visible and the "Password" prompt is visible:
A quick test confirms that
I think it is very common to behave differently for TTYs, with an option to force the behavior (see e.g. I would propose the following approach: only prompt if This would give us an opportunity to give a descriptive error message instead of relying on the fact that
|
Thanks for the investigation here @chrahunt! Hmm, seems like requests is showing that prompt. Maybe we can tell it not to do that and raise an exception instead? |
Just a note that pipx is impacted by this behavior and would benefit from this change, pypa/pipx#219. Ideally we would be able to pass a |
Have you tried |
I haven't, but that looks like exactly what we're looking for. Thank you! |
My environment, briefly ❯ cat /etc/fedora-release
Fedora release 38 (Thirty Eight)
❯ python --version
Python 3.10.13
❯ python -m pip list
Package Version
---------- -------
pip 23.3.2
setuptools 69.0.2 Terse example ❯ python -m pip --no-input install nonexistent-module@git+https://github.com/mfleader/nonexistent-module.git &>/dev/null
Username for 'https://github.com':
Password for 'https://github.com': Terse example with stdout and stderr ❯ python -m pip --no-input install nonexistent-module@git+https://github.com/mfleader/nonexistent-module.git
Collecting nonexistent-module@ git+https://github.com/mfleader/nonexistent-module.git
Cloning https://github.com/mfleader/nonexistent-module.git to /tmp/pip-install-b_ezznu_/nonexistent-module_148ce4e8ef254ae4a1d9ed4bb09b9337
Running command git clone --filter=blob:none --quiet https://github.com/mfleader/nonexistent-module.git /tmp/pip-install-b_ezznu_/nonexistent-module_148ce4e8ef254ae4a1d9ed4bb09b9337
Username for 'https://github.com':
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/mfleader/nonexistent-module.git/'
error: subprocess-exited-with-error
× git clone --filter=blob:none --quiet https://github.com/mfleader/nonexistent-module.git /tmp/pip-install-b_ezznu_/nonexistent-module_148ce4e8ef254ae4a1d9ed4bb09b9337 did not run successfully.
│ exit code: 128
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× git clone --filter=blob:none --quiet https://github.com/mfleader/nonexistent-module.git /tmp/pip-install-b_ezznu_/nonexistent-module_148ce4e8ef254ae4a1d9ed4bb09b9337 did not run successfully.
│ exit code: 128
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. From the error message, the prompt seemed to be coming from the subprocess execution of ❯ GIT_TERMINAL_PROMPT=0 python -m pip install nonexistent-module@git+https://github.com/mfleader/nonexistent-module.git &> /dev/null
❯ echo $?
1 |
No description provided.
The text was updated successfully, but these errors were encountered: