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: Cannot perform install, list operations (possibly more) after upgrading to pip3 19.3.1 #4805

Closed
emsal0 opened this issue Jan 8, 2020 · 5 comments
Labels

Comments

@emsal0
Copy link

emsal0 commented Jan 8, 2020

I'm using WSL 2 using Ubuntu:

Powershell output for wsl -l -v:

PS C:\Users\Em> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

Ubuntu version:

em@LAPTOP-2318OD4D:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.04
DISTRIB_CODENAME=disco
DISTRIB_DESCRIPTION="Ubuntu 19.04"

And here's the aformented problem. I start with a fresh install of python3-pip (version 9.0.1) from apt, then upgrade pip using itself (upgrading to 19.3.1), then attempt to upgrade/install pip again:

em@LAPTOP-2318OD4D:~$ sudo -H python3 -m pip install --upgrade pip
[sudo] password for em:
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.2MB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-19.3.1
em@LAPTOP-2318OD4D:~$ sudo -H python3 -m pip install --upgrade pip

At this point this operation hangs forever until I do a Ctrl-C. Here's the prompt from the Keyboard Interrupt, if it helps

^CTraceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/pip/__main__.py", line 19, in <module>
    sys.exit(_main())
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/main.py", line 45, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 23, in <module>
    from pip._internal.cli.req_command import RequirementCommand
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 20, in <module>
    from pip._internal.network.session import PipSession
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/network/session.py", line 26, in <module>
    from pip._internal.network.auth import MultiDomainBasicAuth
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/network/auth.py", line 36, in <module>
    import keyring  # noqa
  File "/usr/lib/python3/dist-packages/keyring/__init__.py", line 3, in <module>
    from .core import (set_keyring, get_keyring, set_password, get_password,
  File "/usr/lib/python3/dist-packages/keyring/core.py", line 153, in <module>
    init_backend()
  File "/usr/lib/python3/dist-packages/keyring/core.py", line 66, in init_backend
    keyrings = filter(limit, backend.get_all_keyring())
  File "/usr/lib/python3/dist-packages/keyring/util/__init__.py", line 21, in wrapper
    func.always_returns = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/keyring/backend.py", line 196, in get_all_keyring
    exceptions=TypeError))
  File "/usr/lib/python3/dist-packages/keyring/util/__init__.py", line 31, in suppress_exceptions
    for callable in callables:
  File "/usr/lib/python3/dist-packages/keyring/backend.py", line 188, in is_class_viable
    keyring_cls.priority
  File "/usr/lib/python3/dist-packages/keyring/util/properties.py", line 24, in __get__
    return self.fget.__get__(None, owner)()
  File "/usr/lib/python3/dist-packages/keyring/backends/kwallet.py", line 37, in priority
    bus = dbus.SessionBus(mainloop=DBusGMainLoop())
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 211, in __new__
    mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 100, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 122, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/exceptions.py", line 45, in __init__
    def __init__(self, *args, **kwargs):
KeyboardInterrupt
em@LAPTOP-2318OD4D:~$
@emsal0
Copy link
Author

emsal0 commented Jan 8, 2020

Update: apparently this works when I have an X server running (I'm using vcXsrv). If I run pip3 again with the DISPLAY environment variable not set, then it works.

@emsal0
Copy link
Author

emsal0 commented Jan 8, 2020

To clarify:

  • If the DISPLAY environment variable is not set, pip3 19.3.1 works just fine.
  • If the DISPLAY environment variable is set (in my case it was set to 172.30.144.1:0), and there is no X server running, presumably because the new version of pip3 relies on DBus messaging (would need to investigate the root cause)

@reelbeelveel
Copy link

To clarify:

  • If the DISPLAY environment variable is not set, pip3 19.3.1 works just fine.
  • If the DISPLAY environment variable is set (in my case it was set to 172.30.144.1:0), and there is no X server running, presumably because the new version of pip3 relies on DBus messaging (would need to investigate the root cause)

Just encountered this issue in 2021! So frustrating trying everything but pip just wouldn't work. Using unset DISPLAY fixed everything instantly. Thanks!

@Howard0401
Copy link

This issue still remains now.
unset DISPLAY could fix
Is there any other solution? What happened?

@brent-lauder
Copy link

Also, just encountered this same exact issue. The only difference I can tell is that I was in a virtual env with --system-site-packages enabled.

unset DISPLAY fixed.

Using:
python 3.8.5
pip version 20.0.2

Also running WSL 2 with Ubuntu:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants