Mujoco-py: SET PATH ERROR in Windows 10 64bit

Created on 7 Nov 2019  路  7Comments  路  Source: openai/mujoco-py

  1. I have downloaded and unzip mujoco200 at \userpath.mojoco.
  2. I have obtained license and mjkey.txt and copied it to \userpath.mujoco as well as
    \userpath.mujoco\mujoco200\bin\
  3. I have added environment variable name PATH = C:\userpath.mujoco\mujoco200\bin;%PATH%
  4. Alongside this, I have tried

    set MUJOCO_PY_MJKEY_PATH=C:\path\to.mujoco\mjkey.txt
    set MUJOCO_PY_MUJOCO_PATH=C:\path\to.mujoco\mujoco200\bin

  5. And the rest of procedure of cloning this git, and installing openai

Yet I only able to run classic gym environments, whenever I try to run any robotics environment it shows " add mujoco to your library error".

image

The error shown is

image

I don't get it even I have added the PATH as new variable and also in command promt, why it is still showing this error.

Any help is highly appreciated.

Most helpful comment

After you set the path, if you still have the problem, restart your computer. That fixed it for me. Restart it, don't shut down and open again.

All 7 comments

I don't have an answer, but I have the same issue. I installed MuJoCo, have the license key and everything, but get that exact error when I try to run a MuJoCo program:

Exception: Please add mujoco library to your PATH:
set PATH=C:\Users\USERNAME.mujoco\mujoco200\bin;%PATH%

I have tried several different batch configurations, and have put the MuJoCo mjkey.txt file in several different directories. My user environment variables are as follows:

MUJOCO_PY_MJKEY_PATH = C:\path\to.mujoco\mujoco200\bin\mjkey.txt
MUJOCO_PY_MUJOCO_PATH = C:\path\to.mujoco\mujoco200\bin
Path = C:\Users\USERNAME.mujoco\mujoco200\bin;%PATH%

I have also tried:

MUJOCO_PY_MJKEY_PATH = C:\path\to.mujoco\mjkey.txt
MUJOCO_PY_MUJOCO_PATH = C:\path\to.mujoco\mujoco200\bin
Path = C:\path\to.mujoco\mujoco200\bin;%PATH% - (or the previous USERNAME one)

Just adding this to the list of things that have been tried.

The python wheel currently expects you to have mjpro150 and not mujuco200. Your paths are otherwise set correctly. Check the download page at https://www.roboti.us/index.html

I have successfully install mujoco-py on Windows 10. In my opinion, your problem might be:

1) Window-supported mujoco-py version stopped at 1.50.1.68 as it was written in README. So we should use that version. And if using this version, we need to download mjpro150 from https://www.roboti.us/index.html.

2) About the SET PATH errors, I just copied and pasted the recommended from the error which was
set PATH=C:\Users\tranthanh.mujoco\mjpro150\bin;%PATH% , into the terminal.

Hello, I followed serveral tutorials to install Mujoco on WIndows 10:

But none of these worked for me.

Here are my steps that i made

  1. I downloaded Microsoft Visual C++ build tools 2019

  2. I downloaded mjpro150 win64 from https://www.roboti.us/index.html

  3. created %userprofile%\.mujoco\ and put mjpro150 into the folder.
    So my folder structure looks as following:

  4. .mujoco

    • mjkey.txt

      • mjpro150



        • bin





          • mjkey.txt



          • ...





        • doc


        • include


        • model


        • sample



  5. I created my virtual enviroment in my projectfolder.
    > virtualenv env

  6. I cloned the repository and

    $git clone https://github.com/openai/mujoco-py.git
    $git checkout tag/1.50.1.0
    
  7. I activated my virtual enviroment and installed gym
    ```

    & env/Scripts/activate
    pip install gym
    SET PATH=%userprofile%.mujoco\mjpro150\bin;$Env:PATH;

 `> echo $Env:PATH ` contained  the path `%userprofile%\.mujoco\mjpro150\bin`


7. Preparations to install mujoco

cd mujoco-py
python -m pip install --upgrade setuptools #upgrade setuptools
pip install -r requirements.txt #install requirements
pip install -r requirements.dev.txt #install dev requirements

8. I replaced all the instances of
`isinstance(addr, (int, np.int32, np.int64))`
with
`hasattr(addr, '__int__')`
in these files
 ```
\path\to\mujoco-py\scripts\gen_wrappers.py
and
\path\to\mujoco-py\mujoco_py\generated\wrappers.pxi
  1. Now I tried to recompile it
    > python -c "import mujoco_py" #force compile mujoco_py

And then this Error occured :
ImportError: DLL load failed while importing cymj:

_Note the error occured even if I did not made the changes in Step 8._

  1. I ignored this error and continued with
    >python setup.py install
    and it displayed no Error

  2. However I executed the following code
    ```
    import gym # openAi gym
    from gym import envs

env = gym.make('FetchReach-v1')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
env.close()
```

and got:
CompileError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

Can someone tell which steps I have done wrong?

After you set the path, if you still have the problem, restart your computer. That fixed it for me. Restart it, don't shut down and open again.

I have successfully install mujoco-py on Windows 10. In my opinion, your problem might be:

  1. Window-supported mujoco-py version stopped at 1.50.1.68 as it was written in README. So we should use that version. And if using this version, we need to download mjpro150 from https://www.roboti.us/index.html.
  2. About the SET PATH errors, I just copied and pasted the recommended from the error which was
    set PATH=C:\Users\tranthanh.mujoco\mjpro150\bin;%PATH% , into the terminal.

Literally open up the terminal and paste the set path, and then it should work

After you set the path, if you still have the problem, restart your computer. That fixed it for me. Restart it, don't shut down and open again.

This also works for me! Thanks very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adarshsehgal picture adarshsehgal  路  6Comments

azmosavi picture azmosavi  路  3Comments

rajathkmp picture rajathkmp  路  4Comments

bebbo203 picture bebbo203  路  3Comments

dialogchat picture dialogchat  路  3Comments