J. Siek
J. Siek

Reputation: 43

Mujoco_py missing path to LD_LIBRARY_PATH, Ubuntu 16.04

I am trying to get mujoco_py running. When I do

import mujoco_py  

I get this error:
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/jonah/.mujoco/mjpro150/bin  

I have added the above line to both /etc/skel/.bashrc and ~/.bashrc. If I run

echo $LD_LIBRARY_PATH  

I get

/home/jonah/.mujoco/mjpro150/bin/  

My .mujoco folder includes mjkey.txt and the mjpro150 folder. I can run ./simulate successfully, so I have a feeling that this is some kind of mujoco_py specific bug.

Upvotes: 1

Views: 4953

Answers (4)

Xiong-Hui Chen
Xiong-Hui Chen

Reputation: 400

Please check the user which you run the code with. The mismatch user will cause this problem. There is the checklist may help you:

  1. Don’t use ‘sudo’ to run the code;
  2. Don’t use ‘sudo’ or virtual environment (e.g., anaconda) to run Pycharm (If you run the code in Pycharm).

Upvotes: 0

Ind
Ind

Reputation: 397

After you save the .bashrc file your want execute this code.

source ~/.bashrc

Now link is updated.

Upvotes: 0

Wenzhang Liu
Wenzhang Liu

Reputation: 1

You can try to reinstall Pycharm for the newest version.

Upvotes: 0

Ray Walker
Ray Walker

Reputation: 293

Which program do you use to import mujoco?

I had a similar issue using mujoco_py with PyCharm Community 2018.1. A workaround was to launch PyCharm from the terminal instead of using the launcher icon. Maybe it could help with your issue too.

Otherwise you could try adding the LD_LIBRARY_PATH to ~/.profile instead of ~/.bashrc, as proposed in this answer here: https://askubuntu.com/questions/1022836/python-not-recognizing-ld-library-path/1022913#1022913

Upvotes: 2

Related Questions