2

I'm trying to install mujoco-py and get this after compilation:

  /home/ubuntu/anaconda3/compiler_compat/ld: cannot find -lGL
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mujoco-py
  Running setup.py clean for mujoco-py
  Failed to build mujoco-py
  ERROR: Could not build wheels for mujoco-py which use PEP 517 and cannot be installed directly

I am using Ubuntu 18.04, Python 3.6.9.


Following this question, I install the suggested library , but turns out it was already installed.

(test_env) ubuntu@user:~$ sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libglfw3 is already the newest version (3.2.1-1).
libgl1-mesa-glx is already the newest version (19.0.8-0ubuntu0~18.04.3).
libosmesa6-dev is already the newest version (19.0.8-0ubuntu0~18.04.3).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

I then try the second answer and run locate libGL. Strangely this doesn't return anything.

I also try creating the symbolic link directly:

sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

but:

ln: failed to create symbolic link '/usr/lib/x86_64-linux-gnu/libGL.so': File exists

~$ ls -h /usr/lib/x86_64-linux-gnu | grep "libGL"
libGL.la
libGL.so
libGL.so.1
libGL.so.1.7.0
libGLESv1_CM.so
libGLESv1_CM.so.1
libGLESv1_CM.so.1.0.0
libGLESv1_CM.so.1.2.0
libGLESv1_CM_nvidia.so.1
libGLESv1_CM_nvidia.so.418.87.01
libGLESv2.so
libGLESv2.so.2
libGLESv2.so.2.0.0
libGLESv2.so.2.1.0
libGLESv2_nvidia.so.2
libGLESv2_nvidia.so.418.87.01
libGLEW.so
libGLEW.so.2.0
libGLEW.so.2.0.0
libGLU.a
libGLU.so
libGLU.so.1
libGLU.so.1.3.1
libGLX.so
libGLX.so.0
libGLX_indirect.so.0
libGLX_mesa.so.0
libGLX_mesa.so.0.0.0
libGLX_nvidia.so.0
libGLX_nvidia.so.418.87.01
libGLdispatch.so
libGLdispatch.so.0

Any suggestions are appreciated.

rrz0
  • 2,182
  • 5
  • 30
  • 65

2 Answers2

0

Maybe your Anaconda is too old (or setup.py of the package is not right initially) and affected by this bug too: https://github.com/cocodataset/cocoapi/issues/94

There in order to install the package the people recommend adding extra_link_args=['-L/usr/lib/x86_64-linux-gnu/']

See also How to set extra link argument in Python module setup?

Nick Vee
  • 621
  • 2
  • 7
  • 17
0

This helped me:

$ mamba install -c conda-forge mesa-libgl-devel-cos7-x86_64
andyandy
  • 1,384
  • 2
  • 15
  • 25