Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/tmp/pip-build-92_avjgn/mujoco-py/mujoco_py/gl/osmesashim.c:1:23: fatal error: GL/osmesa.h: No such file or directory #96

Open
goodnamegood opened this issue Aug 24, 2017 · 20 comments

Comments

@goodnamegood
Copy link

goodnamegood commented Aug 24, 2017

I follow the instructions to install MuJoCo, and got the following error:

    /tmp/pip-build-92_avjgn/mujoco-py/mujoco_py/gl/osmesashim.c:1:23: fatal error: GL/osmesa.h: No such file or directory

So I tried to install with "sudo apt-get install libosmesa6-dev", and it prompts that I should install a list of dependencies, so I tried to install via "sudo apt-get install libdrm2" and it propmts an error message says

    E: Sub-process /usr/bin/dpkg returned an error code (1)

The computer is a Ubuntu 14.04, with GPU installed.

@andrewliao11
Copy link

I encounter this issue, too.
Also Ubuntu 14.04, with GPU installed.
Using python3.5.2

@ViktorM
Copy link

ViktorM commented Oct 9, 2017

Just have the same error on Ubuntu 16.04, Python 3.5.2, laptop with GPU - GTX 1070:

  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Imujoco_py -I/tmp/pip-build-20t9hi5v/mujoco-py/mujoco_py -I/home/viktor/.mujoco/mjpro150/include -I/home/viktor/.local/lib/python3.5/site-packages/numpy/core/include -I/home/viktor/anaconda3/envs/mujoco/include/python3.5m -c /tmp/pip-build-20t9hi5v/mujoco-py/mujoco_py/gl/osmesashim.c -o /tmp/pip-build-20t9hi5v/mujoco-py/mujoco_py/generated/_pyxbld_LinuxCPUExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-20t9hi5v/mujoco-py/mujoco_py/gl/osmesashim.o -fopenmp -w
  /tmp/pip-build-20t9hi5v/mujoco-py/mujoco_py/gl/osmesashim.c:1:23: fatal error: GL/osmesa.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1```

@yenchenlin
Copy link

same issue here.

@keven425
Copy link

same issue

@uidilr
Copy link

uidilr commented Oct 17, 2017

sudo apt-get install libosmesa6-dev
worked for me

@gntoni
Copy link

gntoni commented Oct 17, 2017

I had the same problem. Solved it by installing the last version of mesa (17.0.2)
https://www.mesa3d.org/relnotes/17.0.2.html

@nrontsis
Copy link

nrontsis commented Nov 23, 2017

A potentially unorthodox conda-only solution that worked for me is:

conda install -c clinicalgraphics osmesa 

and then update the C_LIBRARY_PATH variable accordingly:

export C_INCLUDE_PATH="YOUR-ANACONDA-ENVIRONMENT/include:$C_LIBRARY_PATH"

@ghost
Copy link

ghost commented Feb 2, 2018

I have the same problem running it on a CentOS6 cluster. But I cannot find a .el6 rpm for latest version of mesa and the .el7(supported for CentOS7 gives error requesting for glib_2.14).
Will mesa 11.0.7 work for any version of mujoco-py or does it strictly needs mesa 17?

@lmzintgraf
Copy link

Solved it for me on Fedora26:
sudo dnf install mesa-libOSMesa-devel

@JerryLingjieMei
Copy link

Hi everyone! How can I resolve this issue if I am working on a server and have no root access?

@inspirepassion
Copy link

inspirepassion commented Sep 2, 2018

Update to the previous post

-------------previous------------------------------------
Still cannot solve it. Does anyone know how to deal with it?

(temp36) zhixun@zhixun-MS-7B48:~/Downloads/mujoco-py$ sudo apt-get install libosmesa6-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

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.

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 sudo apt-get install libsomesa6 first
2 If step 1 doesn't work, e.g. in my case it said: 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. It's due to the newer version of libglapi-mesa has been installed, and my Ubuntu repository only finds libosmesa6=18.0.0-rc5-1ubuntu1

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

4 Now, we could add repository for newer version of libosmesa6-dev to be avialble
sudo add-apt-repository ppa:xorg-edgers/ppa
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.

5 Once it's installed, I have no issue to import mujoco_py under my environment

@zhangchuheng123
Copy link

Anyone solve this problem on CentOS?

@mrahtz
Copy link

mrahtz commented May 17, 2019

On CentOS 7, the following worked for me to install the necessary packages without root:

cd $(mktemp -d)
for url in http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libOSMesa-18.0.5-3.el7.x86_64.rpm http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libOSMesa-devel-18.0.5-3.el7.x86_64.rpm http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/patchelf-0.9-10.el7.x86_64.rpm; do
    curl $url | rpm2cpio | cpio -id
done
mkdir ~/.local
cp -a usr/* ~/.local/

then adding the following lines to my .bashrc:

export PATH="$PATH:$HOME/.local/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/lib:$HOME/.local/lib64"
export LDFLAGS="-L$HOME/.local/lib -L$HOME/.local/lib64"
export CPATH="$CPATH:$HOME/.local/include"

pip install mujoco-py then worked fine.

@samarjeet
Copy link

Installing https://pkgs.org/download/mesa-libOSMesa on CentOS worked for me.

@GoingMyWay
Copy link

If you install openai's baselines, you should python setup.py install rather than pip install -e .

@muratgursu
Copy link

#90
^This solved it for me.

@zzaym
Copy link

zzaym commented Mar 20, 2020

On CentOS 7, the following worked for me to install the necessary packages without root:

cd $(mktemp -d)
for url in http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libOSMesa-18.0.5-3.el7.x86_64.rpm http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libOSMesa-devel-18.0.5-3.el7.x86_64.rpm http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/patchelf-0.9-10.el7.x86_64.rpm; do
    curl $url | rpm2cpio | cpio -id
done
mkdir ~/.local
cp -a usr/* ~/.local/

then adding the following lines to my .bashrc:

export PATH="$PATH:$HOME/.local/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/lib:$HOME/.local/lib64"
export LDFLAGS="-L$HOME/.local/lib -L$HOME/.local/lib64"
export CPATH="$CPATH:$HOME/.local/include"

pip install mujoco-py then worked fine.

For people who still have this problem on centos 7 without root access, it looks like the rpm links are not up-to-date anymore. We should use this:

cd $(mktemp -d)
for url in http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libOSMesa-18.3.4-5.el7.x86_64.rpm http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libOSMesa-devel-18.3.4-5.el7.x86_64.rpm; do
    curl $url | rpm2cpio | cpio -id
done
mkdir ~/.local
cp -a usr/* ~/.local/

always check the latest version of libOSMeas on https://pkgs.org/download/mesa-libOSMesa!

@RaghuSpaceRajan
Copy link

Based on https://stackoverflow.com/a/52567731/11063709 and the previous comments, for CentOS without root access, the following should work without having to manually update the package URLs:

mkdir -p ~/rpm
yumdownloader --destdir ~/rpm --resolve mesa-libOSMesa.x86_64 mesa-libOSMesa-devel.x86_64 patchelf.x86_64
cd ~/rpm
for rpm in `ls`; do rpm2cpio $rpm | cpio -id ; done
export PATH="$PATH:$HOME/rpm/usr/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/rpm/usr/lib:$HOME/rpm/usr/lib64"
export LDFLAGS="-L$HOME/rpm/usr/lib -L$HOME/rpm/usr/lib64"
export CPATH="$CPATH:$HOME/rpm/usr/include"

@gfreund123
Copy link

Based on https://stackoverflow.com/a/52567731/11063709 and the previous comments, for CentOS without root access, the following should work without having to manually update the package URLs:

mkdir -p ~/rpm
yumdownloader --destdir ~/rpm --resolve mesa-libOSMesa.x86_64 mesa-libOSMesa-devel.x86_64 patchelf.x86_64
cd ~/rpm
for rpm in `ls`; do rpm2cpio $rpm | cpio -id ; done
export PATH="$PATH:$HOME/rpm/usr/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/rpm/usr/lib:$HOME/rpm/usr/lib64"
export LDFLAGS="-L$HOME/rpm/usr/lib -L$HOME/rpm/usr/lib64"
export CPATH="$CPATH:$HOME/rpm/usr/include"

@RaghuSpaceRajan Hey, I had the original error and your solution worked for me in the base environment (I use Anaconda), but now when I've installed mujoco-py in another environment I get the following similar error when importing it:

distutils.errors.CompileError: command '/home/dsi/myname/anaconda3/envs/spinningup/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1

Sorry for the noob question, but what do I need to add now to my .bashrc so that mujoco-py will also work in this environment?

@RaghuSpaceRajan
Copy link

Hi @gfreund123 , unfortunately I don't think I have seen this error before. If it's related to your environments only, then you might want to either activate the environment in .bashrc or run the export commands again after activating the environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests