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 hangs after running any command (aside from --version, which is the only one that has worked for me)

See original GitHub issue

Environment

  • pip version: 20.0.2
  • Python version: 3.8
  • Operating system: Ubuntu 20.04 running on WSL2

Description

Running any pip command (except pip --version) seems to cause it to hang until keyboard interrupt

Expected behavior

The command typed is meant to be executed

How to Reproduce

Note: I linked pip3 to run with the alias pip since I uninstalled python 2.7

  1. Get a fresh install of pip3 from ‘sudo apt install python3-pip’
  2. Try to run any command aside from --version
  3. terminal hangs

Output I am forced to keyboard interrupt

pip search asd
^CTraceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    load_entry_point('pip==20.0.2', 'console_scripts', 'pip3')()
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/search.py", line 18, in <module>
    from pip._internal.cli.req_command import SessionCommandMixin
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 19, in <module>
    from pip._internal.network.session import PipSession
  File "/usr/lib/python3/dist-packages/pip/_internal/network/session.py", line 26, in <module>
    from pip._internal.network.auth import MultiDomainBasicAuth
  File "/usr/lib/python3/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 (
  File "/usr/lib/python3/dist-packages/keyring/core.py", line 189, in <module>
    init_backend()
  File "/usr/lib/python3/dist-packages/keyring/core.py", line 93, 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 210, in get_all_keyring
    return list(rings)
  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/util/properties.py", line 26, in __get__
    return self.fget.__get__(None, owner)()
  File "/usr/lib/python3/dist-packages/keyring/backend.py", line 67, in viable
    cls.priority
  File "/usr/lib/python3/dist-packages/keyring/util/properties.py", line 26, 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 212, in __new__
    return Bus.__new__(cls, Bus.TYPE_SESSION, private=private,
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 102, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 124, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/exceptions.py", line 47, in __init__
    def __init__(self, *args, **kwargs):
KeyboardInterrupt

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
andreportelacommented, Sep 1, 2021
  1. I’m using pip and pipenv on a wsl2 environment (Ubuntu 20.04)
  2. It was working just fine with vscode remote
  3. Then I installed VcXsrv on Windows and got PyCharm to work on the WSL2 environment using this XServer and setting the DISPLAY variable on my .bashrc to be able to quickly launch PyCharm
  4. Boom! Both pip and pipenv stopped working. Any command from them (with the exception of --version) hang until keyboard interrupt
  5. Found this thread
  6. Disabled the DISPLAY variable for the X server on my .bashrc
  7. Boom! Fixed both pip and pipenv
0reactions
TerminatedProcesscommented, Oct 22, 2021
  1. I’m using pip and pipenv on a wsl2 environment (Ubuntu 20.04)
  2. It was working just fine with vscode remote
  3. Then I installed VcXsrv on Windows and got PyCharm to work on the WSL2 environment using this XServer and setting the DISPLAY variable on my .bashrc to be able to quickly launch PyCharm
  4. Boom! Both pip and pipenv stopped working. Any command from them (with the exception of --version) hang until keyboard interrupt
  5. Found this thread
  6. Disabled the DISPLAY variable for the X server on my .bashrc
  7. Boom! Fixed both pip and pipenv

This was exactly it for me! I was trying to get tkinter to work in wsl and updated the DISPLAY variable. I never did get it working but forgot to remove my change. I just commented it out and pip is working again. Thanks a bunch!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pip Install hangs - python - Stack Overflow
I'm trying to install a Python package using the command "pip install" but as soon as I hit enter nothing happens. The action...
Read more >
pip install hangs : Forums - PythonAnywhere
In a fresh Bash console, I am trying to use the command. pip install --user Django==3.1.9. This results in · That's really strange!...
Read more >
Troubleshooting | PyCharm Documentation - JetBrains
A version of the package installed for a particular Python interpreter is outdated. Run the following commands to install the required package:.
Read more >
Create Your requirements.txt Using This Technique
txt file is to run pip freeze > requirements.txt when all packages are already installed. However, the problem with such an approach is...
Read more >
Installing Python requirements with an extra index url hangs ...
This used to work, but now hangs when installing dependencies. I tried updating pip, and using pip3. I have modified the requirements.txt to...
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