添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.stack.imgur.com/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.

What does "install mujuco" mean? On Linux something gets installed by compiling and building from source or installing your Linux distribution's pre-compiled and pre-built package. Attempting to download some random binary, from somewhere, always ends in tears. – Sam Varshavchik May 11, 2022 at 17:55 I've tried just about everything on the internet. Most of the stuff you'll find on the Internet won't help and some of it is downright disgusting. – user4581301 May 11, 2022 at 17:59 Hi, when I say install mujuco I meant following these exact steps and attempting to install its packages github.com/openai/mujoco-py – danielliucs May 11, 2022 at 18:03 "Download binaries"? That's pretty much it, see my first comment. Don't believe everything you read on the Internet. Unless your Linux distribution is the exact same one that was used to build those binaries, this will end in tears. You'll need to go back to the source code for mujoco, and build it directly from source. – Sam Varshavchik May 11, 2022 at 18:19

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.

HI! I wish I could give this a million thumbs up but my reputation is not high enough. It worked, thank you so much. How did you know with so much confidence that just deleting that random file would fix this issue? Absolutely flabbergasted. Thanks again – danielliucs May 11, 2022 at 18:41 That trick saved me a ton of time. I don't know why Anaconda is copying the file. But hey, I got it fixed and that's what counts. – Willem Meints Oct 15, 2022 at 8:50

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.