在fedora27上安装pytorch后没有模块librepo [英] no module librepo after installing pytorch on fedora27

查看:300
本文介绍了在fedora27上安装pytorch后没有模块librepo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在conda上安装pytorch,然后在尝试升级系统时遇到此错误:

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'

我看到了一些使用yum弃用的答案来重新安装python,但看来我的机器上没有它.我不想再次安装linux,我正在寻找一种解决该问题的方法.

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.

通过conda安装pytorch时,它也安装了cuda.也许是个问题? 在此之前,我记得(不确定,但有点)我默认使用python2.7运行,现在是python 3.6 ..

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:

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

在使用conda安装jupyterlab之后,我遇到了相同的错误.由于某种原因,conda安装了自己的python版本,该版本掩盖了fedora的版本. Conda的python从/usr/lib/中搜索库,而fedora的也在/usr/lib64/中搜索.在大多数Linux发行版中,/usr/lib/是/usr/lib64/的链接,或者是以另一种方式使用,因此可以使用其中任何一个. librepo安装在/usr/lib64/中.

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

我的结论:

  • Fedora与conda并不完全兼容.
  • Fedora错误报告将以重复的形式关闭,并带有指向显然不相关的报告的链接.

这篇关于在fedora27上安装pytorch后没有模块librepo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆