D4RL icon indicating copy to clipboard operation
D4RL copied to clipboard

import d4rl Cannot find MuJoCo library issue

Open albert-no opened this issue 3 years ago • 3 comments

I am getting OSError : Cannot find MuJoCo library /home/noa/.mujoco/lib/libmujoco.so.2.1.1. issue. I successfully installed d4rl with pip install e . but I am getting this error when importing d4rl. The error message is pasted below.

import d4rl Warning: Flow failed to import. Set the environment variable D4RL_SUPPRESS_IMPORT_ERROR=1 to suppress this message. No module named 'flow' WARNING:absl:mjbindings failed to import mjlib and other functions. libmujoco.so may not be accessible. Traceback (most recent call last): File "", line 1, in File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/d4rl/init.py", line 32, in import d4rl.kitchen File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/d4rl/kitchen/init.py", line 1, in from .kitchen_envs import KitchenMicrowaveKettleLightSliderV0, KitchenMicrowaveKettleBottomBurnerLightV0 File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/d4rl/kitchen/kitchen_envs.py", line 5, in from d4rl.kitchen.adept_envs.franka.kitchen_multitask_v0 import KitchenTaskRelaxV1 File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/d4rl/kitchen/adept_envs/franka/kitchen_multitask_v0.py", line 23, in from dm_control.mujoco import engine File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/init.py", line 18, in from dm_control.mujoco.engine import action_spec File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/engine.py", line 42, in from dm_control.mujoco import index File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/index.py", line 88, in from dm_control.mujoco.wrapper import util File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/wrapper/init.py", line 20, in from dm_control.mujoco.wrapper.core import callback_context File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/wrapper/core.py", line 29, in from dm_control.mujoco.wrapper.mjbindings import functions File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/wrapper/mjbindings/functions.py", line 17, in mjlib = util.get_mjlib() File "/home/noa/anaconda3/envs/offrl/lib/python3.8/site-packages/dm_control/mujoco/wrapper/util.py", line 120, in get_mjlib raise OSError("Cannot find MuJoCo library at {}.".format(library_path)) OSError: Cannot find MuJoCo library at /home/noa/.mujoco/lib/libmujoco.so.2.1.1.

albert-no avatar Jan 08 '22 11:01 albert-no

Had the same error yesterday, for some reason dm_control is looking for the .so file in a wrong path. Eventually I resolved to a brute force approach: I edited the dm_control code (the get_mjlib function) and inserted a hard-coded path to the file in ~/.mujoco/mujoco210/bin/libmujoco210.so.

orrivlin avatar Jan 10 '22 14:01 orrivlin

Had the same error yesterday, for some reason dm_control is looking for the .so file in a wrong path. Eventually I resolved to a brute force approach: I edited the dm_control code (the get_mjlib function) and inserted a hard-coded path to the file in ~/.mujoco/mujoco210/bin/libmujoco210.so. I did the same thing as you, but there was another error.AttributeError: /home/lyl/.mujoco/mujoco210/bin/libmujoco210.so: undefined symbol: mj_printFormattedModel

CodingNovice7 avatar Feb 14 '22 09:02 CodingNovice7

Download the newest mujoco from : https://github.com/deepmind/mujoco/releases/tag/2.1.1 and then tar -zxvf it to ~/.mujoco, which works for me!

liyc-ai avatar Mar 15 '22 13:03 liyc-ai