3

So I recently just bought a Raspberry Pi 4, flashed Linux Manjaro XFCE onto it and booted it up. I managed to install python-pip with Pacman without any errors but when I actually try to use the command, I get this error.

Traceback (most recent call last):
  File "/usr/bin/pip", line 33, in <module>
    sys.exit(load_entry_point('pip==20.3.4', 'console_scripts', 'pip')())
  File "/usr/bin/pip", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.8/importlib/metadata.py", line 504, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.8/importlib/metadata.py", line 177, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: pip

I've tried reinstalling it many times but it still doesn't work. This is what comes out while I install it.

resolving dependencies...
looking for conflicting packages...

Packages (1) python-pip-20.3.4-1

Total Installed Size:  1.60 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                                     [####################################################################] 100%
(1/1) checking package integrity                                                                                   [####################################################################] 100%
(1/1) loading package files                                                                                        [####################################################################] 100%
(1/1) checking for file conflicts                                                                                  [####################################################################] 100%
(1/1) checking available disk space                                                                                [####################################################################] 100%
:: Processing package changes...
(1/1) installing python-pip                                                                                        [####################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...

Do take note that I'm a complete Linux noob and have recently just started using it.

One more thing to add, I already have Python installed on this and its version is Python 3.8.5. Just in case anyone needs that information.

Tony
  • 618
  • 12
  • 27
Daniel Tam
  • 908
  • 1
  • 12
  • 25
  • What happens when you run `pip` in terminal? – Tony Jul 21 '21 at 09:46
  • I get the error shown in my post. importlib.metadata.PackageNotFoundError @T0ny1234 – Daniel Tam Jul 21 '21 at 09:48
  • 1
    what about `pip3` ? When you run it you should see the man page of pip. – Tony Jul 21 '21 at 09:49
  • Same thing, same error – Daniel Tam Jul 21 '21 at 09:50
  • Can you write the exact command you are trying to start pip with? – Tony Jul 21 '21 at 09:51
  • pip install pygame, pip install virtualenv – Daniel Tam Jul 21 '21 at 09:52
  • for creating virtual environmet you can do `python -m venv venv` in your working folder, and then `cd` in that directory, if you are not in it already, then do `source venv\bin\activate` (this activates the virtual environment), and finaly do `pip install pygame`, btw if you want to install more modules with pip you do `pip install pygame virtualenv` – Tony Jul 21 '21 at 09:55
  • 1
    Oh wow, that worked. Why though? Does that mean I will never be able to install packages globally? :( – Daniel Tam Jul 21 '21 at 09:58
  • You will, your install command is wrong - basically here `pip install pygame, pip install virtualenv` you are trying to install pip with pip. Do you want me to add this as an answer? – Tony Jul 21 '21 at 10:00
  • Oh but, I did use the proper install command. I was just listing out the two separate commands that I tried. I used those commands separately. Without being in a virtualenv, I used `pip install pygame`, and then tried `pip install virtualenv`. But those didn't work. – Daniel Tam Jul 21 '21 at 10:02
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/235129/discussion-between-t0ny1234-and-daniel-tam). – Tony Jul 21 '21 at 10:05
  • What is the output of `python3 -m pip install pygame`? Does that work? If it does it just means you need to configure your `PATH` – Rolv Apneseth Jul 21 '21 at 10:40

1 Answers1

0

Encountered a related issue today without finding a good description about how to recover from such situation. Soo… Here's a "porr man's" solution to that:

pamac reinstall python-pip

If that's not enough and you have accidentally removed some or all of Manjaro's system Python packages, reinstall them one by one:

pamac reinstall python-<MISSING-MODULE>

Example: pamac reinstall python-pip python-packaging python-chardet python-urllib3 …

If even pamac is not available, replace the command with pacman:

sudo pacman -S python-<module-name>

If someone finds a better way, please share! Happy trouble-shooting! :)

Nils Fenner
  • 131
  • 4