pythonc++gcclibstdc++

GLIBCXX_3.4.29 not found


I am trying to install mujuco onto my linux laptop and everything works until I try to import it into a python file. When I try to import it/run a python script that already has mujuco in it I get the following errors:

Import error. Trying to rebuild mujoco_py.

running build_ext

building 'mujoco_py.cymj' extension

gcc -pthread -B /home/daniel/miniconda3/envs/mujoco_py/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/daniel/.mujoco/mujoco-py/mujoco_py -I/home/daniel/.mujoco/mujoco210/include -I/home/daniel/miniconda3/envs/mujoco_py/lib/python3.8/site-packages/numpy/core/include -I/home/daniel/miniconda3/envs/mujoco_py/include/python3.8 -c /home/daniel/.mujoco/mujoco-py/mujoco_py/cymj.c -o /home/daniel/.mujoco/mujoco-py/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxcpuextensionbuilder/temp.linux-x86_64-3.8/home/daniel/.mujoco/mujoco-py/mujoco_py/cymj.o -fopenmp -w

gcc -pthread -B /home/daniel/miniconda3/envs/mujoco_py/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/daniel/.mujoco/mujoco-py/mujoco_py -I/home/daniel/.mujoco/mujoco210/include -I/home/daniel/miniconda3/envs/mujoco_py/lib/python3.8/site-packages/numpy/core/include -I/home/daniel/miniconda3/envs/mujoco_py/include/python3.8 -c /home/daniel/.mujoco/mujoco-py/mujoco_py/gl/osmesashim.c -o /home/daniel/.mujoco/mujoco-py/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxcpuextensionbuilder/temp.linux-x86_64-3.8/home/daniel/.mujoco/mujoco-py/mujoco_py/gl/osmesashim.o -fopenmp -w
gcc -pthread -shared -B /home/daniel/miniconda3/envs/mujoco_py/compiler_compat -L/home/daniel/miniconda3/envs/mujoco_py/lib -Wl,-rpath=/home/daniel/miniconda3/envs/mujoco_py/lib -Wl,--no-as-needed -Wl,--sysroot=/ /home/daniel/.mujoco/mujoco-py/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxcpuextensionbuilder/temp.linux-x86_64-3.8/home/daniel/.mujoco/mujoco-py/mujoco_py/cymj.o /home/daniel/.mujoco/mujoco-py/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxcpuextensionbuilder/temp.linux-x86_64-3.8/home/daniel/.mujoco/mujoco-py/mujoco_py/gl/osmesashim.o -L/home/daniel/.mujoco/mujoco210/bin -Wl,-R/home/daniel/.mujoco/mujoco210/bin -lmujoco210 -lglewosmesa -lOSMesa -lGL -o /home/daniel/.mujoco/mujoco-py/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxcpuextensionbuilder/lib.linux-x86_64-3.8/mujoco_py/cymj.cpython-38-x86_64-linux-gnu.so -fopenmp

Traceback (most recent call last):
  File "setting_state.py", line 7, in <module>
    from mujoco_py import load_model_from_xml, MjSim, MjViewer
  File "/home/daniel/.mujoco/mujoco-py/mujoco_py/__init__.py", line 2, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/home/daniel/.mujoco/mujoco-py/mujoco_py/builder.py", line 504, in <module>
    cymj = load_cython_ext(mujoco_path)
  File "/home/daniel/.mujoco/mujoco-py/mujoco_py/builder.py", line 111, in load_cython_ext
    mod = load_dynamic_ext('cymj', cext_so_path)
  File "/home/daniel/.mujoco/mujoco-py/mujoco_py/builder.py", line 130, in load_dynamic_ext
    return loader.load_module()

ImportError: /home/daniel/miniconda3/envs/mujoco_py/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/libOSMesa.so.8)

  [1]: https://i.sstatic.net/gUhXI.png

I have gcc 11.0.2 installed and I'm using python3.8 in my virtual environment. Here are my exact steps https://docs.google.com/document/d/1eBvfKoczKmImUgoGMbqypODBXmI1bD91/edit

Everything works accordingly until the very last step where I try to run an actual python module

I really don't know why this is happening and I've tried just about everything on the internet. I would really appreciate it if someone can help.


Solution

  • Where does /home/daniel/miniconda3/envs/mujoco_py/lib/libstdc++.so.6 come from? Something bundles a version of libstdc++.so.6 which is older than your system version, and other system libraries depend on the newer version. You should be able to fix this issue by just deleting the file in your home directory.