Hello,
I repeatedly get the following error installing Mujoco on Ubuntu 18.04 LTS (Bionic Beaver):
Please add following line to .bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/shubhom/.mujoco/mjpro150/bin
however, my .bashrc file is updated with that and i f I echo $LD_LIBRARY_PATH I receive
:/home/shubhom/.mujoco/mjpro150/bin
same question
me too, i have add the true path of mjpro150/bin in the .bashrc flie, but when i import mujoco_py, it output error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/mujoco_py-1.50.1.56-py3.5.egg/mujoco_py/__init__.py", line 1, in <module>
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/usr/local/lib/python3.5/dist-packages/mujoco_py-1.50.1.56-py3.5.egg/mujoco_py/builder.py", line 468, in <module>
cymj = load_cython_ext(mjpro_path)
File "/usr/local/lib/python3.5/dist-packages/mujoco_py-1.50.1.56-py3.5.egg/mujoco_py/builder.py", line 68, in load_cython_ext
_ensure_set_env_var("LD_LIBRARY_PATH", lib_path)
File "/usr/local/lib/python3.5/dist-packages/mujoco_py-1.50.1.56-py3.5.egg/mujoco_py/builder.py", line 101, in _ensure_set_env_var
var_name, var_name, lib_path))
Exception:
Missing path to your environment variable.
Current values LD_LIBRARY_PATH=
Please add following line to .bashrc:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/huang/.mujoco/mjpro150/bin
Did you guys run python with sudo? If this is true, sudo will change your current user settings to root settings, including environment variables.
I did that and it did not change the error. Any other suggestions?
What I meant was that you should not use sudo.
If you look at the source code, it is actually this line of code failed to get the correct LD_LIBRARY_PATH.
os.environ.get("LD_LIBRARY_PATH", "")
You may run this code elsewhere to see if it gives you the correct LD_LIBRARY_PATH.
What I found is the following,
When you add "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/shubhom/.mujoco/mjpro150/bin" to .bashrc, this environment variable is only valid to the current user. However, if you run the python script using sudo, the user is changed to the root user and the LD_LIBRARY_PATH of the root user is empty.
Same issue... someone for the rescue ?
same issue, anyone who found the fix?
So here is something that worked for me:
It's still not working for me. Anybody have another idea?
I solve it by installing mujoco_py without using sudo, try this:
sudo pip3 uninstall mujoco_py
pip3 install mujoco-py==1.50.1.56
I have got the same problem when I did "import mujoco_py" in pycharm. I solved this problem by reinstall my Pycharm on linux.
same question, no solution yet.
Here's an example dockerfile installing mujoco-py and gym on ubuntu 18.04 https://gist.github.com/machinaut/b5a7c6719a30e9fbfd95c13d5e963b61
Without more information I don't know how to help with this error.
The python process you import mujoco-py in needs to have the environment variable (LD_LIBRARY_PATH) set to include the folder with the mujoco binaries.
In order to avoid crashes with difficult-to-understand bugs, we explicitly check for it before importing, and then print a warning with instructions useful to beginner users on how to fix it.
same problem, but I solve it by opening IDE(Pycharm) in terminal.
In terminal:
pycharm2018.3/bin/pycharm.sh
But I still have error by opening my IDE with icon on desktop
-------------After 10 minutes--------------
:) I solved this problem by adding LD_LIBRARY_PATH to /etc/proflie. Then I restart and reopen my IDE with icon on desktop, the error didn't appear.
This issue has a bunch of different concerns, many from old versions.
Closing for now. If you see this error, please open a new issue! We now have a template that helps us get the information we need!
Thanks,
~Alex
Same issue here using spyder, and I solved it by opening it through Terminal.
I solve this issue, by adding "source ~/.bashrc" to ".profile"
you should check your ~/.bashrc
Add
export LD_LIBRARY_PATH= /path/to/.mujoco/mjpro150/bin${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MUJOCO_KEY_PATH= /path/to/.mujoco${MUJOCO_KEY_PATH}
and "source ~/.bashrc"
you should check if it can run successfully on terminal at first.
if ok on terminal, then:
click Run -> Edit Configurations -> Environment Variables
Add
LD_LIBRARY_PATH /path/to/.mujoco/mjpro150/bin
MUJOCO_KEY_PATH /path/to/.mujoco
@hzm2016 > I solve this issue, by adding "source ~/.bashrc" to ".profile"
how ? what do you mean to .profile?
Most helpful comment
you should check your ~/.bashrc
Add
export LD_LIBRARY_PATH= /path/to/.mujoco/mjpro150/bin${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MUJOCO_KEY_PATH= /path/to/.mujoco${MUJOCO_KEY_PATH}
and "source ~/.bashrc"
you should check if it can run successfully on terminal at first.
if ok on terminal, then:
click Run -> Edit Configurations -> Environment Variables
Add
LD_LIBRARY_PATH /path/to/.mujoco/mjpro150/bin
MUJOCO_KEY_PATH /path/to/.mujoco