Skip to content
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 install block waiting forever for a keyring to unlock #7883

Closed
riquito opened this issue Mar 22, 2020 · 22 comments
Closed

Pip install block waiting forever for a keyring to unlock #7883

riquito opened this issue Mar 22, 2020 · 22 comments
Labels
C: keyring Related to pip's keyring integration

Comments

@riquito
Copy link

riquito commented Mar 22, 2020

Environment

  • pip version: 20.0.2
  • Python version: 3.7.6
  • OS: Fedora

jaraco/keyring: v20.0.1 (automatically installed as PIP dependency)

Description

Pip block during install, waiting for a keyring to unlock (at least that's my understanding)

Expected behavior

Pip install should proceed.
I'm also confused about why pypi try to use any keyring to access pypi.org (See in the verbose output Getting credentials from keyring for https://pypi.org/simple).

How to Reproduce

pip install -vvv --no-deps --no-cache-dir -U importlib-metadata==1.1.3

Workaround
Disable the keyring

PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
pip install -vvv --no-deps --no-cache-dir -U importlib-metadata==1.1.3

Likely related issue: #6773

Output

Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-710zevvx
Created temporary directory: /tmp/pip-req-tracker-1h_3qnhb
Initialized build tracking at /tmp/pip-req-tracker-1h_3qnhb
Created build tracker: /tmp/pip-req-tracker-1h_3qnhb
Entered build tracker: /tmp/pip-req-tracker-1h_3qnhb
Created temporary directory: /tmp/pip-install-arqqjx8s
1 location(s) to search for versions of importlib-metadata:
* https://pypi.org/simple/importlib-metadata/
Fetching project page and analyzing links: https://pypi.org/simple/importlib-metadata/
Getting page https://pypi.org/simple/importlib-metadata/
Found index url https://pypi.org/simple
Getting credentials from keyring for https://pypi.org/simple
^CCleaning up...
Removed build tracker: '/tmp/pip-req-tracker-1h_3qnhb'
ERROR: Operation cancelled by user
Exception information:
Traceback (most recent call last):
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/commands/install.py", line 331, in run
    resolver.resolve(requirement_set)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 281, in _get_abstract_dist_for
    req.populate_link(self.finder, upgrade_allowed, require_hashes)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/req/req_install.py", line 249, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/package_finder.py", line 899, in find_requirement
    req.name, specifier=req.specifier, hashes=hashes,
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/package_finder.py", line 826, in find_all_candidates
    project_url, link_evaluator=link_evaluator,
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/package_finder.py", line 790, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/collector.py", line 497, in fetch_page
    return _get_html_page(location, session=self.session)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/collector.py", line 337, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/index/collector.py", line 143, in _get_html_response
    "Cache-Control": "max-age=0",
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/network/session.py", line 405, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 519, in request
    prep = self.prepare_request(req)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 462, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_vendor/requests/models.py", line 317, in prepare
    self.prepare_auth(auth, url)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_vendor/requests/models.py", line 548, in prepare_auth
    r = auth(self)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/network/auth.py", line 202, in __call__
    url, username, password = self._get_url_and_credentials(req.url)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/network/auth.py", line 178, in _get_url_and_credentials
    username, password = self._get_new_credentials(original_url)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/network/auth.py", line 151, in _get_new_credentials
    get_keyring_auth(index_url, username) or
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/pip/_internal/network/auth.py", line 58, in get_keyring_auth
    cred = get_credential(url, username)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/keyring/core.py", line 74, in get_credential
    return _keyring_backend.get_credential(service_name, username)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/keyring/backends/SecretService.py", line 113, in get_credential
    collection = self.get_preferred_collection()
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/keyring/backends/SecretService.py", line 60, in get_preferred_collection
    collection.unlock()
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/secretstorage/collection.py", line 67, in unlock
    return unlock_objects(self.connection, [self.collection_path])
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/secretstorage/util.py", line 154, in unlock_objects
    dismissed, (signature, unlocked) = exec_prompt(connection, prompt)
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/secretstorage/util.py", line 140, in exec_prompt
    connection.recv_messages()
  File "/home/riquito/piggy_store/.env/lib64/python3.7/site-packages/jeepney/integrate/blocking.py", line 64, in recv_messages
    b = unwrap_read(self.sock.recv(4096))
KeyboardInterrupt
@actionless
Copy link

having the same issue here, can't understand why keyring is needed on install

phmccarty added a commit to phmccarty/autospec that referenced this issue Apr 16, 2020
Instruct pip to not use a keyring by setting an environment variable
(PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring). As far as I
know, there is no need to use a keyring for any of the pip commands
autospec runs.

Some users have encountered timeouts similar to the report from
pypa/pip#7883, which describes this
environment variable setting as a workaround.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
bryteise pushed a commit to clearlinux/autospec that referenced this issue Apr 16, 2020
Instruct pip to not use a keyring by setting an environment variable
(PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring). As far as I
know, there is no need to use a keyring for any of the pip commands
autospec runs.

Some users have encountered timeouts similar to the report from
pypa/pip#7883, which describes this
environment variable setting as a workaround.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
@msyim
Copy link

msyim commented Jun 12, 2020

Any solution to this? I have the same issue after a reboot on Ubuntu 18.04

@JohnVillalovos
Copy link

Any solution to this? I have the same issue after a reboot on Ubuntu 18.04

Not a solution, but I as a workaround have added the following to my ~/.bashrc

# 1-May-2020: Fix for Keyring error with pip. Hopefully new pip will fix it
# soon https://github.com/pypa/pip/issues/7883
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

@pradyunsg pradyunsg added the C: keyring Related to pip's keyring integration label Aug 30, 2020
@pradyunsg
Copy link
Member

FYI: #8687 should have made pip less eager in trying to use keyring. We're also considering making keyring support in pip into an opt-in: #8719

@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Aug 30, 2020
@AstraLuma
Copy link

I just got this on Debian Testing, gnome.

🐚 pip install --verbose poetry==1.0.9                                                                                 
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-9bx45e78
Created temporary directory: /tmp/pip-req-tracker-lu2srv1l
Initialized build tracking at /tmp/pip-req-tracker-lu2srv1l
Created build tracker: /tmp/pip-req-tracker-lu2srv1l
Entered build tracker: /tmp/pip-req-tracker-lu2srv1l
Created temporary directory: /tmp/pip-install-t3llvdta
1 location(s) to search for versions of poetry:
* https://pypi.org/simple/poetry/
Fetching project page and analyzing links: https://pypi.org/simple/poetry/
Getting page https://pypi.org/simple/poetry/
Found index url https://pypi.org/simple
Getting credentials from keyring for https://pypi.org/simple

This doesn't happen with a fresh environment, though. Just one with poetry installed.

🐚 pip freeze                                                                                                          
attrs==20.2.0
CacheControl==0.12.6
cachy==0.3.0
certifi==2020.6.20
cffi==1.14.2
chardet==3.0.4
cleo==0.7.6
clikit==0.4.3
cryptography==3.1
html5lib==1.1
idna==2.10
jeepney==0.4.3
jsonschema==3.2.0
keyring==20.0.1
lockfile==0.12.2
msgpack==1.0.0
pastel==0.2.0
pexpect==4.8.0
pkginfo==1.5.0.1
poetry==1.0.10
ptyprocess==0.6.0
pycparser==2.20
pylev==1.3.0
pyparsing==2.4.7
pyrsistent==0.14.11
requests==2.24.0
requests-toolbelt==0.8.0
SecretStorage==3.1.2
shellingham==1.3.2
six==1.15.0
tomlkit==0.5.11
urllib3==1.25.10
webencodings==0.5.1

(Probably the addition of the non-default keyring package.)

@psacawa
Copy link

psacawa commented Oct 5, 2020

I am also experiencing pip hanging indefinitely on getting credentials from the keyring when using pyenv. It works without the pyenv shims. This is on Ubuntu 20.04, pyenv 1.2.20-18-g5d84eed8 running python3.8.6 environment with pip 20.2.3.
Sample output:

$ pip install -vvv asciinema
Using pip 20.2.3 from /home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip (python 3.8)
Non-user install because site-packages writeable
Created temporary directory: /tmp/pip-ephem-wheel-cache-q3syfjk6
Created temporary directory: /tmp/pip-req-tracker-svoa_2fh
Initialized build tracking at /tmp/pip-req-tracker-svoa_2fh
Created build tracker: /tmp/pip-req-tracker-svoa_2fh
Entered build tracker: /tmp/pip-req-tracker-svoa_2fh
Created temporary directory: /tmp/pip-install-sgviwh00
1 location(s) to search for versions of asciinema:
* https://pypi.org/simple/asciinema/
Fetching project page and analyzing links: https://pypi.org/simple/asciinema/
Getting page https://pypi.org/simple/asciinema/
Found index url https://pypi.org/simple
Getting credentials from keyring for https://pypi.org/simple
^CERROR: Operation cancelled by user
Exception information:
Traceback (most recent call last):
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
    status = self.run(options, args)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 323, in run
    requirement_set = resolver.resolve(
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
    self._populate_link(req)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
    req.link = self._find_requirement_link(req)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
    best_candidate = self.finder.find_requirement(req, upgrade)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 898, in find_requirement
    best_candidate_result = self.find_best_candidate(
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 825, in find_all_candidates
    package_links = self.process_project_url(
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 790, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 643, in fetch_page
    return _get_html_page(location, session=self.session)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 455, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 152, in _get_html_response
    resp = session.get(
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_vendor/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/network/session.py", line 421, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_vendor/requests/sessions.py", line 516, in request
    prep = self.prepare_request(req)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_vendor/requests/sessions.py", line 449, in prepare_request
    p.prepare(
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_vendor/requests/models.py", line 318, in prepare
    self.prepare_auth(auth, url)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_vendor/requests/models.py", line 549, in prepare_auth
    r = auth(self)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/network/auth.py", line 209, in __call__
    url, username, password = self._get_url_and_credentials(req.url)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/network/auth.py", line 184, in _get_url_and_credentials
    username, password = self._get_new_credentials(original_url)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/network/auth.py", line 156, in _get_new_credentials
    get_keyring_auth(index_url, username) or
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip/_internal/network/auth.py", line 58, in get_keyring_auth
    cred = get_credential(url, username)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/keyring/core.py", line 68, in get_credential
    return _keyring_backend.get_credential(service_name, username)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/keyring/backends/SecretService.py", line 115, in get_credential
    collection = self.get_preferred_collection()
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/keyring/backends/SecretService.py", line 61, in get_preferred_collection
    collection.unlock()
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/secretstorage/collection.py", line 67, in unlock
    return unlock_objects(self.connection, [self.collection_path])
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/secretstorage/util.py", line 154, in unlock_objects
    dismissed, (signature, unlocked) = exec_prompt(connection, prompt)
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/secretstorage/util.py", line 140, in exec_prompt
    connection.recv_messages()
  File "/home/psacawa/.pyenv/versions/3.8.6/lib/python3.8/site-packages/jeepney/integrate/blocking.py", line 64, in recv_messages
    b = unwrap_read(self.sock.recv(4096))
KeyboardInterrupt
Removed build tracker: '/tmp/pip-req-tracker-svoa_2fh'

@kousu
Copy link

kousu commented Dec 29, 2020

I'm also having this on ArchLinux under i3; I reported it at #9391 before being pointed here (thanks for correcting me!). I have screenshots:

2020-12-28-203931_1366x768_scrot

Plus, it particularly gets in the way if I'm working on a real tty (e.g. Ctrl-Alt-F3) instead of an GUI terminal emulator. There, pip hangs but doesn't prompt because the prompt is open under X11 and I don't see it -- and pip can't proceed -- until I switch (Ctrl-Alt-F7) and cancel it there.

@kousu
Copy link

kousu commented Dec 30, 2020

And I second being very

confused about why pypi try to use any keyring to access pypi.org

@kousu
Copy link

kousu commented Jan 1, 2021

In case it helps someone, I have a different workaround than #7883 (comment), which also avoids other apps, like Chrome, from nagging me in the same way: my problem stems from Arch packaging lightdm (and gdm, lxdm, and ssdm) with gnome-keyring built in:

https://github.com/archlinux/svntogit-packages/blob/8d85fa6b8d07e4a82b24efc7635853110c2f93ed/trunk/lightdm.pam#L7

which is why logging in via lightdm causes it to spawn:

$ pstree -ap
systemd,1
  |-accounts-daemon,586
[...]
  |-systemd,819 --user
[...]
  |   |-gnome-keyring-d,2736 --start --foreground --components=secrets
  |   |   |-{gnome-keyring-d},2737
  |   |   |-{gnome-keyring-d},2738
  |   |   `-{gnome-keyring-d},2739

and pip to print that prompt and leave this "WARNING: keyring ..":

$ pip install markdown2
Defaulting to user installation because normal site-packages is not writeable
WARNING: Keyring is skipped due to an exception: Failed to unlock the collection!
Collecting markdown2
  Downloading markdown2-2.3.10-py2.py3-none-any.whl (34 kB)
Installing collected packages: markdown2
Successfully installed markdown2-2.3.10

Once I found this, getting rid of it was easy:

--- /etc/pam.d/lightdm.orig 2020-12-31 21:19:10.151609312 -0500
+++ /etc/pam.d/lightdm	2020-12-31 21:12:17.601523586 -0500
@@ -1,7 +1,7 @@
 #%PAM-1.0
 auth        include     system-login
--auth       optional    pam_gnome_keyring.so
+#-auth       optional    pam_gnome_keyring.so
 account     include     system-login
 password    include     system-login
 session     include     system-login
--session    optional    pam_gnome_keyring.so auto_start
+#-session    optional    pam_gnome_keyring.so auto_start

that plus rebooting successfully disabled pip bothering me:

$ pip install markdown2
Defaulting to user installation because normal site-packages is not writeable
Collecting markdown2
  Using cached markdown2-2.3.10-py2.py3-none-any.whl (34 kB)
Installing collected packages: markdown2
Successfully installed markdown2-2.3.10

@sjlongland
Copy link

Getting hassled for a password just to install a package when no password is needed was annoying, but thankfully only required a few stabs of the ESC key to make it keep going.

Today, it starts blocking indefinitely, waiting for something, and when I hit ^C, sure enough, it's blocking on a passphrase to unlock a keyring it doesn't need, to access a password that doesn't exist.

The problem has been known of for more than a year (see issue #6773), why is this this crazy behaviour the default?

@skrat
Copy link

skrat commented Jan 5, 2021

Is there anyone who could explain why was this odd behavior introduced? Or link to a document explaining it? It's really annoying to know that a tool so core to the ecosystem can be messed up this way this easily.

@zvolsky
Copy link

zvolsky commented Jan 8, 2021

Same here, Debian-Testing + KDE. It is really strange (MS Windows style) behaviour, especially from pipenv. Keyring reports "Some application requires..." instead of "pip requires...". The modal dialog causes that everything hangs, it has 2 options (Cancel/Open). With Cancel the dialog repeats immediatelly. Please prevent this.

@micahscopes
Copy link

I'm getting this too and it's very disconcerting

@dan-1d
Copy link

dan-1d commented Jan 22, 2021

Add me to the list that has wasted HOURS tracking this down. Thanks for the workaround

@kousu
Copy link

kousu commented Mar 17, 2021

My workaround in #7883 (comment) has stopped working.

$ cat /etc/pam.d/lightdm
#%PAM-1.0
auth        include     system-login
#-auth       optional    pam_gnome_keyring.so
account     include     system-login
password    include     system-login
session     include     system-login
#-session    optional    pam_gnome_keyring.so auto_start

But gnome-keyring is back:

$ pstree -ap 
systemd,1
[...]
  ├─systemd,632 --user
  │   ├─(sd-pam),633
[...]
  │   ├─dbus-daemon,647 --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
[...]
  │   ├─gnome-keyring-d,2006 --start --foreground --components=secrets
  │   │   ├─{gnome-keyring-d},2007
  │   │   ├─{gnome-keyring-d},2008
  │   │   └─{gnome-keyring-d},2009
[...]

Chromium is not triggering the gnome-keyring prompt like it was before -- which is why I tried to disable it completely instead of only solving it for people. But now the only thing I've found so far that triggers it is pip.

I have these:

$ pacman -Qi gnome-keyring
Name            : gnome-keyring
Version         : 1:3.36.0-3
$ pacman -Qi python-pip
Name            : python-pip
Version         : 20.3.1-1
$ # AKA:
$ pip --version 
pip 20.3.1 from /usr/lib/python3.9/site-packages/pip (python 3.9)

I've switched to @JohnVillalovos's solution (#7883 (comment)) and that seems to be working for me.

@SchizoDuckie
Copy link

SchizoDuckie commented May 20, 2021

Well, I'll add one to the mix for you all.
I'm running ansible on wsl2 and just wanted to upgrade to the latest version, which requires python3 with pip3.

Pip3 fails to do anything even after minutes and I need to keyboardinterrupt it.
Then went searching and entered the rabbithole of all the options to disable keyring, which all did not work (because apparently all the backend config options listed in related issues like #7883 ) are ignored on wsl2 or not processed correctly) .

I ended up doing what any man with not enough time for this would do: I monkey patched keyring on my local system:

$ sudo nano /usr/lib/python3/dist-packages/keyring/core.py
Comment out the last line:

image

Result: Pip is blazing again and I can move on with my life.

@JelteF
Copy link

JelteF commented Jun 1, 2021

I had the problem on WSL2 that DISPLAY was set, but there was no X server running. This caused pip to hang on the keyring. The fix for me was simply:

unset DISPLAY

@ShaneEverittM
Copy link

I had the problem on WSL2 that DISPLAY was set, but there was no X server running. This caused pip to hang on the keyring. The fix for me was simply:

unset DISPLAY

This was it for me. I was doing some display forwarding over an X server to run Qemu using WSL and forgot I had display set, but did not have the display server running!

@analkumar2
Copy link

I had the problem on WSL2 that DISPLAY was set, but there was no X server running. This caused pip to hang on the keyring. The fix for me was simply:

unset DISPLAY

Had the same issue. After starting my xserver, it worked on WSL2.

@mzpqnxow
Copy link

I ended up just removing the keyring package- it was only installed because it's a dependency of Twine and I'm installing most of my packages via git+https://... anyway

I'm not sure if twine will work without keyring but unsetting my DISPLAY didn't work :/

yarikoptic added a commit to yarikoptic/datalad that referenced this issue Aug 5, 2021
Happened to me: a number of days ago I had to workaround a pip issuehttps://github.com/pypa/pip/issues/7883 for which Q&D workaround was just
to export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring .

Then I lived happily ever after (since 1-May?), probably even datalad download-url
was just reusing prior cookies etc.  But while troubleshooting earthdata
data access, I was at WTF stage that datalad kept asking for
credentials, and there were no visual feedback on a reason.
@Cimbali
Copy link

Cimbali commented Aug 11, 2021

#8687 indeed fixes this for 99.9% of cases (i.e. only prompts the keyring when there’s a 401 Unauthorized), so make sure to have pip updated to ≥ 21.1 if you’re running into this issue.

@pradyunsg
Copy link
Member

pradyunsg commented Aug 13, 2021

Ah, I didn't notice that #8687 didn't close this. Thanks for the reminder of that @Cimbali! ^>^

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: keyring Related to pip's keyring integration
Projects
None yet
Development

No branches or pull requests