Ubuntu 18.04 libosmesa6 依赖libglapi-mesa (= 18.0.0~rc5-1ubuntu1) 但要安装18.0.5-0ubuntu0~18.04.1

Ubuntu 18.04 libosmesa6 depends libglapi-mesa (= 18.0.0~rc5-1ubuntu1) but 18.0.5-0ubuntu0~18.04.1 is to be installed

不少人遇到过这个问题,尤其是想使用Gym和Mujoco进行强化学习的人。安装过程令人沮丧,但幸运的是 some people 发现了部分问题

我想 post 这个问题,所以希望 Ubuntu 开发人员能看到,因为 instruction 不会让我进入任何对话框来写东西。

问题发生如下:

  1. 我想使用Mujoco,所以我按照安装说明进行操作,但是当我在python3.5/3.6中执行import mujoco_py时,出现以下错误:

    >>> import mujoco_py

    Import error. Trying to rebuild mujoco_py.

    running build_ext building 'mujoco_py.cymj' extension

    ...

    /home/username/.local/lib/python3.6/site-packages/mujoco_py/gl/osmesashim.c:1:10: fatal error: GL/osmesa.h: No such file or directory #include <GL/osmesa.h> ^~~~~~~~~~~~~

  2. Quite a few people 建议通过运行 sudo apt-get install libosmesa6-dev 安装libosmesa-dev,所以我试了一下。但是错误是:

    The following packages have unmet dependencies: libosmesa6-dev : Depends: libosmesa6 (= 18.0.0~rc5-1ubuntu1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

  3. 那我觉得这个sudo apt-get install libosmesa6就可以解决了,可惜:

    The following packages have unmet dependencies: libosmesa6 : Depends: libglapi-mesa (= 18.0.0~rc5-1ubuntu1) but 18.0.5-0ubuntu0~18.04.1 is to be installed E: Unable to correct problems, you have held broken packages.

  4. 看起来是当前libglapi-mesa版本 (18.0.5-0ubuntu0~18.04. 1) 与 mesa 真正需要的不兼容(18.0.0~rc5-1ubuntu1)

  5. 我对如何降级感到困惑,因为根据 libglapi-mesa 的当前版本,似乎有大量的软件包。例如,当我尝试更正版本时,使用 sudo apt-get install libglapi-mesa=18.0.0~rc5-1ubuntu1 ,警告变得疯狂:

    The following additional packages will be installed: policykit-1-gnome The following packages will be REMOVED: apturl cheese deja-dup gdm3 gir1.2-gst-plugins-base-1.0 gir1.2-mutter-2 gir1.2-rb-3.0 gir1.2-totem-1.0 gir1.2-webkit2-4.0 gnome-calendar gnome-control-center gnome-getting-started-docs gnome-initial-setup gnome-online-accounts gnome-session-bin gnome-shell gnome-startup-applications gnome-todo gnome-user-docs gnome-user-guide gstreamer1.0-clutter-3.0 gstreamer1.0-gl gstreamer1.0-vaapi gvfs gvfs-backends gvfs-daemons gvfs-fuse libcheese-gtk25 libcheese8 libclutter-1.0-0 libclutter-gst-3.0-0 libclutter-gtk-1.0-0 libcogl-pango20 libcogl-path20 libcogl20 libedataserverui-1.2-2 libgl1 libgl1-mesa-glx libglu1-mesa libglx-mesa0 libglx0 libgoa-backend-1.0-1 libgstreamer-gl1.0-0 libmutter-2-0 libtotem0 libwebkit2gtk-4.0-37 libyelp0 mutter nautilus nautilus-share rhythmbox-plugins shotwell totem totem-plugins ubuntu-desktop ubuntu-docs ubuntu-release-upgrader-gtk ubuntu-session update-manager update-notifier x11-utils xorg xserver-xephyr xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-libinput xserver-xorg-input-wacom xserver-xorg-video-all xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-qxl xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware xwayland yelp zenity

  6. 现在回头看Ubuntu 18.04 USB安装驱动,发现当前libglapi-mesa的版本(18.0.5-0ubuntu0~18.04 .1) 已经存在于此 Ubuntu 18.04 版本中(预安装)。我是Ubuntu的新手,由于关注了不同的人post,我已经重装了几次系统。我真的希望 Ubuntu 团队或 MESA 团队能尽快解决这个问题。 如果你知道如何解决这个问题(除了安装 Ubuntu 14/16),请留下你的评论,我真的很感激!

我是Ubuntu的新手,对此一无所知,所以我的问题看起来有点啰嗦。但是当我由于包依赖性而无法正确安装 libosmesa6-dev 时,我是这样解决的:

1 尝试 google libosmesa6=18.0.5-rc5-0ubuntu0,为您的 Ubuntu 版本和 cpu 架构下载 deb 文件(例如我的案例 0ubuntu0~18.04.1 (amd64二进制)),然后手动安装。这是因为在当前的包仓库中,没有libsomesa6=18.0.5-rc5-0ubuntu0来匹配libglapi-mesa=18.0.5...

2 现在,我将更新版本的 libosmesa6-dev 的存储库添加到我的存储库,并使用 apt-get 命令安装它:

sudo add-apt-repository ppa:ubuntu-x-swat/updates

sudo apt-get update

sudo apt-get install libosmesa6-dev

之后libosmesa6-dev、libosmesa6、libglapi-mesa会自动升级到新版本

3 安装后,在我的环境下导入 mujoco_py 没有问题