openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.86k stars 816 forks source link

Difference behavior between running in terminal vs in Pycharm #602

Open jing-bi opened 3 years ago

jing-bi commented 3 years ago

Describe the bug A clear and concise description of what the bug is. mujoco-py is installed in a conda environment, execute the same command with same environment variables everything works fine in ternimal. BUT when i use pycharm, it seems cannot find the libglewegl.so lib:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/u/user/miniconda3/envs/vplan/lib/python3.8/site-packages/mujoco_py/__init__.py", line 3, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/u/user/miniconda3/envs/vplan/lib/python3.8/site-packages/mujoco_py/builder.py", line 515, in <module>
    cymj = load_cython_ext(mujoco_path)
  File "/u/user/miniconda3/envs/vplan/lib/python3.8/site-packages/mujoco_py/builder.py", line 103, in load_cython_ext
    mod = load_dynamic_ext('cymj', cext_so_path)
  File "/u/user/miniconda3/envs/vplan/lib/python3.8/site-packages/mujoco_py/builder.py", line 128, in load_dynamic_ext
    module=loader.load_module()
ImportError: libglewegl.so: cannot open shared object file: No such file or directory

I tried to modify the source code and print(name,path) in load_dynamic_ext in mujoco-py/builder.py. Both method give me the same result which is cymj /u/user/miniconda3/envs/vplan/lib/python3.8/site-packages/mujoco_py/generated/cymj_2.0.2.13_38_linuxgpuextensionbuilder_38.so but once executed loader.load_module(), pycharm will say ImportError: libglewegl.so: cannot open shared object file: No such file or directory while things work well in terminal.

Desktop (please complete the following information):

Environment

I'm hoping anybody can give a hint on how should I proceed.

tiny-vla commented 1 year ago

me too, anybody help!!!!!!

hbonnavaud commented 8 months ago

For some reason in pycharm, you should set the LD_LIBRARY_PATH variable in another way (yeah, it pissed me off too.)

For a script

Add the LD_LIBRARY_PATH value in the pycharm run configuration:

then add your environment variable here image

For pycharm python console

do the same but here image