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.

No module named pip

See original GitHub issue

Opening this ticket because I think it could help others. Also, not pipx’s fault 👍!

My distribution recently updated Python from 3.7.x to 3.8.0. It broke every single package I had installed with pipx somehow, and pipx itself.

I was left with these kind of errors:

$ guessit "some string"
Traceback (most recent call last):
  File "/home/pawamoy/.local/bin/guessit", line 5, in <module>
    from guessit.__main__ import main
ModuleNotFoundError: No module named 'guessit'
$ pipx install guessit
Traceback (most recent call last):
  File "/home/pawamoy/.local/bin/pipx", line 6, in <module>
    from pipx.main import cli
ModuleNotFoundError: No module named 'pipx'
$ pip install --user pipx
$ pipx install guessit
'guessit' already seems to be installed. Not modifying existing installation in '/home/pawamoy/.local/pipx/venvs/guessit'. Pass '--force' to force installation.
$ pipx install guessit --force
Installing to existing directory '/home/pawamoy/.local/pipx/venvs/guessit'
/home/pawamoy/.local/pipx/venvs/guessit/bin/python: No module named pip

Not removing existing venv /home/pawamoy/.local/pipx/venvs/guessit because it was not created in this session
'/home/pawamoy/.local/pipx/venvs/guessit/bin/python -m pip install guessit -q' failed
$ guessit
Traceback (most recent call last):
  File "/home/pawamoy/.local/bin/guessit", line 5, in <module>
    from guessit.__main__ import main
ModuleNotFoundError: No module named 'guessit'
$ pipx uninstall guessit
uninstalled guessit! ✨ 🌟 ✨
$ pipx install guessit
/home/pawamoy/.local/pipx/venvs/guessit/bin/python: No module named pip

'/home/pawamoy/.local/pipx/venvs/guessit/bin/python -m pip install guessit -q' failed

Not sure what exactly was happening behind the scenes as it’s always hard to figure out with Python: there’s the system versions, with their respective site-packages, there’s pyenv and its own installed versions and shims, then there’s potentially multiple pipx (shims?) and a script in ~/.local/bin (which one is the first in PATH?)… very convoluted but usually working.

Solution

Well, I simply had to explicitly uninstall pipx from the old system Python version with python3.7 -m pip uninstall pipx and then reinstall it with the new system Python version with python -m pip install --user pipx, and reinstall all pipx packages.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

60reactions
QasimKcommented, Nov 16, 2019

I had the same problem, but was not able to use Python 3.7 to uninstall pipx.

I resolved this by uninstalling pipx, deleting ~/.local/pipx, and reinstalling pipx with the new version of Python.

14reactions
uolotcommented, Nov 21, 2019

Removing ~/.local/pipx and reinstalling pipx also worked for me! Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named pip - python - Stack Overflow
I have installed setuptools 1.0 with ez_setup.py from https://pypi.python.org/pypi/setuptools Then I download pip.1.4.1 pkg from https://pypi.python.org/pypi/ ...
Read more >
ModuleNotFoundError: No module named 'pip' in Python
The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, ...
Read more >
[Fixed] ModuleNotFoundError: No module named 'pip' - Finxter
How to Fix “ModuleNotFoundError: No module named 'pip'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >
No Module Named Pip - Python - Linux Hint
Python 'no module named pip'. This error occurs when you attempt to import a module named 'pip' and Python cannot find it in...
Read more >
No Module Named Pip: 7 Solutions To Use Pip On Your PC
No module named pip is an error message that Python shows when it cannot find pip in your Python environment. Read this article,...
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