Bug 2312526 - ModuleNotFoundError: No module named 'pip'
Summary: ModuleNotFoundError: No module named 'pip'
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.12
Version: 41
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Python Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-09-16 07:53 UTC by Michal Konecny
Modified: 2024-09-17 12:12 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-09-17 12:12:37 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Michal Konecny 2024-09-16 07:53:46 UTC
Everytime I'm trying to do anything with my user installation of pip on Fedora Silverblue 41 it will throw the following traceback:
```
Traceback (most recent call last):
  File "/var/home/zlopez/.local/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
```

This started happening after rebase from F40 to F41. I assume the issue is related to old pip version, but without working pip I'm not sure how to fix it.

Reproducible: Always

Steps to Reproduce:
1. pip list
Actual Results:  
Traceback (most recent call last):
  File "/var/home/zlopez/.local/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

Expected Results:  
Shows output of pip list

Comment 1 Charalampos Stratakis 2024-09-16 12:31:09 UTC
Hi. Fedora 41 changed the main python from 3.12 to 3.13. Your user installed pip was possibly installed with python3.12. Can you try to install pip via dnf?

Comment 2 Michal Konecny 2024-09-16 15:16:14 UTC
Hi, I'm on Fedora Silverblue, so that should be part of the ostree image for F41. I don't have any python package layered and the `python --version` is saying python 3.13rc1.

When trying to do `rpm -qa | grep pip` the only related package is `python-pip-wheel-24.2-1.fc41.noarch`. Should the correct package be `python3-pip`? If yes that means it's missing from the base ostree image.

Comment 3 Miro Hrončok 2024-09-17 09:48:37 UTC
/var/home/zlopez/.local/bin/pip seems like pip-installed. Presumably, you installed this for Python 3.12. Do you remember how?

Anyway, to fix this:

 1. remove /var/home/zlopez/.local/bin/pip (not sure if this step needed, but it cannot hurt)
 2. run: python3.13 -m ensurepip --user --default-pip


I opened https://gitlab.com/fedora/docs/fedora-linux-documentation/release-notes/-/issues/94 to have this in the release notes.

----

> When trying to do `rpm -qa | grep pip` the only related package is `python-pip-wheel-24.2-1.fc41.noarch`. Should the correct package be `python3-pip`? If yes that means it's missing from the base ostree image.

Yep, python3-pip is not on the ostree image. That should be fine. python-pip-wheel allows the above to work.

Comment 4 Michal Konecny 2024-09-17 12:06:05 UTC
Thanks Miro that did the trick.

Comment 5 Michal Konecny 2024-09-17 12:10:32 UTC
I don't remember how I did it, as it was long time ago.


Note You need to log in before you can comment on or make changes to this bug.