0

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:

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

    ^~~~~~~~~~~~~`

  2. 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.`
    
  3. 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.`
    
  4. It looks like 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).

  5. 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
    
  6. 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 (preinstalled) 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 hope Ubuntu team or MESA team can fix this issue soon.

karel
  • 114,770
Jason
  • 121

2 Answers2

2

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

Jason
  • 121
1

I got a similar issue while trying to install octave.

   $ sudo apt install octave

This gave the following error:

The following packages have unmet dependencies: octave : Depends: libosmesa6 (>= 10.2~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

I then tried to install libosmesa6

(which is probably not the way to do)

  $ sudo apt install libosmesa6

This gave the following error:

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

Then it seemed like the version of mesa library that I have is more recent than what it expects, most probably due to the octave version that ubuntu is trying to install is an older version than what may be available.

As of today, the latest version of octave is 5.1.0. So, I got the tar file from here -- And then went on to build octave from source. I had to ignore the readline library as it had issues Inside the unzipped octave directory, run

$ ./configure --disable-readline
$ make 
$ ./run-octave
$ make check
$ sudo make install

It is now installed in /usr/local

Hope it works for you :)

marikhu
  • 41
  • Installing octave by disabling readline causes various "must have" features during command line program run. So this is not an optimal solution. – marikhu Aug 24 '19 at 01:56
  • The actual issue was the presence of ppa that I added for steam afaik (which is the one that caused the problem with the installation trying to look for old version rather than the one that is present). I remove unnecessary ppa from "Software and Updates > Other software" and then "sudo apt update" and "sudo apt upgrade" and then tried "sudo apt install octave" and the issue is no longer there and it also upgraded mesa libraries to 19.0.8 from 18.2.8. It is safer not to mess with mesa libs on your own (downgrading and stuff) as its dependencies go far and wide. – marikhu Aug 24 '19 at 02:03