Sample Header Ad - 728x90

I blew up python, pip, and dnf

0 votes
1 answer
1325 views
I bought a book about cyber security in Python, and the author uses python version 3.9. I use Fedora Linux 37 and the default Linux is Linux 3.11. I set up a virtual environment and tried to install the authors' requirements.txt packages. The process choked; apparently the new version of python can't handle retrograde versions of, say, numpy (and other packages). So I did something some may well criticize. I downloaded python 3.9 and compiled and installed it. It appeared to go OK. But then I noticed that both pip and dnf were broken. pip gave me the message:
-shellsession
$ pip install --upgrade pip
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in 
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/pip", line 10, in 
from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal'
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/pip", line 17, in 
from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/pip", line 20, in 
from pip import main
ImportError: cannot import name 'main' from 'pip' (unknown location)
And from dnf:
-shellsession
# dnf install wireshark
Traceback (most recent call last):
File "/usr/bin/dnf", line 61, in 
from dnf.cli import main
ModuleNotFoundError: No module named 'dnf'
Now, call me naive, but I thought one of the rationales for virtual environments was to be able to use different python versions with a particular program. As to what happened to my dnf, I have no clue, but I don't know how to fix it.
Asked by Bryan Zimmer (11 rep)
Feb 2, 2023, 11:12 PM
Last activity: Jan 16, 2025, 03:13 PM