I had to install pytorch with conda, and next I had this error when trying to upgrade system :
sudo dnf upgrade
Traceback (most recent call last):
File "/bin/dnf", line 57, in <module>
from dnf.cli import main
File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 31, in <module>
import dnf.base
File "/usr/lib/python3.6/site-packages/dnf/base.py", line 26, in <module>
from dnf.comps import CompsQuery
File "/usr/lib/python3.6/site-packages/dnf/comps.py", line 29, in <module>
import dnf.util
File "/usr/lib/python3.6/site-packages/dnf/util.py", line 32, in <module>
import librepo
ModuleNotFoundError: No module named 'librepo'
I saw some answer that uses yum-deprecated for re install python, but it seems I don't have it on my machine. I don't want to reinstall linux another time, and I'm searching for kind an answer for that problem.
When installing pytorch via conda, it also installed cuda. Maybe it can be a problem ? Before this, I remember (not sure, but kind of) I was running with python2.7 by default, and now it is python 3.6..
First the magic one-liner to fix things:
I got the same error after using conda to install jupyterlab. For some reason conda installed its own version of python which shadows fedora's one. Conda's python searches libraries from /usr/lib/ while fedora's also searches /usr/lib64/. On most linux distros /usr/lib/ is a link for /usr/lib64/ or the other way so either one can be used. librepo is installed in /usr/lib64/.
My conclusions:
I have stumbled upon the same issue in Fedora 28. I used anaconda as root to update packages system wide, and this broke dnf with the message
yum-deprecated did not work, although Fedora installed it for me after automatically querying for it (a bit strange that this worked since dnf and yum did not work). In order to fix the issue, I deleted the existing libpython, downloaded the python3 and python3-lib rpms from rpmfind, and installed the new rpms
Now I know it is better to use pip than anaconda system wide.