no module librepo after installing pytorch on fedora27

人盡茶涼 提交于 2019-12-11 01:07:27

问题


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..


回答1:


First the magic one-liner to fix things:

echo 'import sys;sys.path += ["/usr/lib64/python3.6/site-packages/", "/usr/lib64/python3.6/"]' | sudo tee /usr/lib/python3.6/site-packages/lib64.pth

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:

  • Fedora is not completely compatible with conda.
  • Fedora bug reports get closed as duplicate with links to obviously unrelated reports.



回答2:


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

ModuleNotFoundError: No module named 'librepo'

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

rm -rf /usr/lib/libpython3*.*
rpm -iv --replacepkgs python3-3.6.6-1.fc28.x86_64.rpm
rpm -iv --replacepkgs python3-libs-3.6.6-1.fc28.x86_64.rpm

Now I know it is better to use pip than anaconda system wide.



来源:https://stackoverflow.com/questions/48291272/no-module-librepo-after-installing-pytorch-on-fedora27

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!