Reputation: 3535
Quite a few people encounter this issue, especially those who want to use Gym and Mujoco for reinforcement learning. The installation process is frustrating, but luckily some people spot part of the issue
I want to post this problem, so hopefully the Ubuntu developers could see, as the instruction doesn't lead me to any dialog box to write something.
The problem is happened as followed:
I want to use Mujoco, so I follow the installation instruction, but when I implement import mujoco_py in python3.5/3.6, it gives the following error:
>>> 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>
^~~~~~~~~~~~~
Quite a few people suggest to install libosmesa-dev by running sudo apt-get install libosmesa6-dev, so I tried it. But the error is:
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.
Then I think this sudo apt-get install libosmesa6 would solve it, but unfortunately:
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.
It looks like it's the version of current libglapi-mesa (18.0.5-0ubuntu0~18.04.1) is incompatible with what mesa really needs(18.0.0~rc5-1ubuntu1)
I am confused about how to downgrade it, because it seems like there are tons of packages depending on the current version of libglapi-mesa. For example, when I tried to correct the version, using sudo apt-get install libglapi-mesa=18.0.0~rc5-1ubuntu1 , the warning is going crazy:
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
Now when I looked back to the Ubuntu 18.04 USB installation driver, I noticed that the version of current libglapi-mesa (18.0.5-0ubuntu0~18.04.1) is already there (pre-installed) on this Ubuntu 18.04 version. I am a newbie to Ubuntu, I already reinstall the system for few times due to following different people's post. I really hope Ubuntu team or MESA team could fix this issue soon. If you know how to solve this (other than install Ubuntu 14/16), please leave your comment, I really appreciate it!
Upvotes: 2
Views: 1053
Reputation: 3535
I am very new to Ubuntu, knowing nothing about it, so my question looks a bit dump. But here is how I solved it for my situation when I could not proper install libosmesa6-dev due to package dependency:
1 Try to google libosmesa6=18.0.5-rc5-0ubuntu0
, download the deb file for your Ubuntu version, and cpu architecture(e.g. my case 0ubuntu0~18.04.1 (amd64 binary)), and install it manually. This is because in the current package repository, there is no libsomesa6=18.0.5-rc5-0ubuntu0
to match libglapi-mesa=18.0.5...
2 Now, I add repository for newer version of libosmesa6-dev to my repository, and install it with apt-get command:
sudo add-apt-repository ppa:ubuntu-x-swat/updates
sudo apt-get update
sudo apt-get install libosmesa6-dev
After this, the libosmesa6-dev, libosmesa6, libglapi-mesa would be automatically upgraded to a newer version.
3 Once it's installed, I have no issue to import mujoco_py under my environment
Upvotes: 2