Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MuJoCo 1.5 #638

Closed
jeffkaufman opened this issue Jun 30, 2017 · 36 comments
Closed

Support MuJoCo 1.5 #638

jeffkaufman opened this issue Jun 30, 2017 · 36 comments

Comments

@jeffkaufman
Copy link

In order to use MuJoCo on a recent mac, you need to be using MuJoCo 1.5: openai/mujoco-py#36 Otherwise you get:

>>> import mujoco_py
ERROR: Could not open disk

This is because MuJoCo before 1.5 doesn't support NVMe disks.

Gym depends on MuJoCo via mujoco-py, which just released support for MuJoCo 1.5.

It looks like maybe this is something you're already working on? Or would it be useful for me to look into fixing it?

@jeffkaufman
Copy link
Author

One tricky thing here is that gym supports python 2 and 3, but mujoco-py 1.50 only supports python 3

@7kbird
Copy link

7kbird commented Jul 3, 2017

I try to fix the MujocoEnv and find it cost more time than expected.

In mujoco_py 1.50:

  • mujoco_py.MjModel is split into MjSim and PyMjModel. Since MujocoEnv.model is used by all mujoco envs, there may be lot of modification.
  • mujoco_py.mjlib.mjlib is renamed to 'mujoco_py.functions'
  • mujoco_py.MjViewer do not have start/finish API

I try modify MujocoEnv.__init__:

# From
self.model = mujoco_py.MjModel(fullpath)
# To
self.sim = mujoco_py.MjSim(mujoco_py.load_model_from_path(fullpath))
self.model = self.sim.model

still not work, because all other envs use self.model.data and the new PyMjModel do not hold the data. Also find shape of model.body_mass in humanoid is (14,) which is not same with (14,1) in mujoco_py 0.5 and result in numpy errors. Don't known how many other compatibility issues, I have to go back to mujoko_py 0.5 to finish my work first.

Any update is appreciated.

@classicCoder16
Copy link

Agreed -- would be great to have support for 1.5!

@geyang
Copy link
Contributor

geyang commented Jul 7, 2017

I'm running into this error: the mujoco_py library is installed from git master, in v1.50 mujoco_py does not have the mjlib module.

Traceback (most recent call last):
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/mujoco/mujoco_env.py", line 12, in <module>
    from mujoco_py.mjlib import mjlib
ImportError: No module named 'mujoco_py.mjlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/projects/reinforcement learning learning notes/berkeley deep RL course/hw1/run_expert.py", line 75, in <module>
    main()
  File "/home/ubuntu/projects/reinforcement learning learning notes/berkeley deep RL course/hw1/run_expert.py", line 41, in main
    env = gym.make(args.envname)
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/registration.py", line 161, in make
    return registry.make(id)
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/registration.py", line 119, in make
    env = spec.make()
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/registration.py", line 85, in make
    cls = load(self._entry_point)
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/registration.py", line 17, in load
    result = entry_point.load(False)
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2258, in load
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2264, in resolve
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/mujoco/__init__.py", line 1, in <module>
    from gym.envs.mujoco.mujoco_env import MujocoEnv
  File "/home/ubuntu/.conda/envs/gym/lib/python3.5/site-packages/gym-0.9.2-py3.5.egg/gym/envs/mujoco/mujoco_env.py", line 14, in <module>
    raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e))
gym.error.DependencyNotInstalled: No module named 'mujoco_py.mjlib'. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)

@jeffkaufman
Copy link
Author

@episodeyang it looks like you're trying to just drop in 1.5 in place of 1.3? That's not going to work; there are a bunch of changes between 1.3 and 1.5 including the mjlib one you're getting

@geyang
Copy link
Contributor

geyang commented Jul 7, 2017

@jeffkaufman Yeah thanks! I'm on ubuntu so I could revert back to 1.3.

Do I need to use both mujoco1.3 as well as mujoco_py.1.3? and if so do you know which mujoco_py1.3 version should I use?

Thanks!

@vitchyr
Copy link
Contributor

vitchyr commented Jul 9, 2017

@episodeyang I don't know about 1.3, but mujoco_py version 0.5.7 worked for me with Mujoco131.

@weiliu620
Copy link

When I set the variableMUJOCO_PY_MJPRO_PATH to mjpro150, I got the following error when import mujoco_py:

MujocoDependencyError: We expected your MUJOCO_PY_MJPRO_PATH final directory to be 'mjpro131', but you provided:  (/Users/weiliu/.mujoco/mjpro150/). MuJoCo often changes in incompatible ways between versions, so you must use MuJoCo 1.31. If you're using MuJoCo 1.31 but changed the directory name, simply change the name back.

I'm on OS X 10.12, Anaconda python 3.5. Have downloaded mujoco 150.

@vBarbaros
Copy link

@weiliu620 so, it's exactly what it says - you need to download mujoco 131 instead of 150

@weiliu620
Copy link

@vBarbaros Thanks. But I also have the "Could not open disk" error when I downgraded to 1.3.

On OS X 10.12, does Mujoco_py support 1.5 or not currently?

@viral612
Copy link

viral612 commented Sep 4, 2017

I am trying to use mujoco with openAI gym on MAC.
I am supposed to use 1.31 version. What version of mujoco-py needs to be installed.
By default pip install mujoco-py is getting me 1.50. Pls suggest.

@Kelym
Copy link

Kelym commented Sep 25, 2017

@viral612 At this time it seems that OpenAI gym only supports mujoco-py 0.5.7 so you could install with pip install mujoco-py==0.5.7 and download mujoco131 binary to your computer.

However, the point in this issue is: mujoco131 does not support the Apple NVM disk for newest MacBook. We'd have to install mujoco150, which sadly does not work with OpenAI gym now. I did search for workaround but it seemed that there is no way to use gym.make('Humanoid-v1') on MacBooks with NVM disks. Please add this support and it will be greatly appreciated.

@manacoa
Copy link

manacoa commented Sep 29, 2017

+1

1 similar comment
@lnpalmer
Copy link

+1

@Kelvinson
Copy link

+1, hope mujoco1.5 can be used on mac

@aaxwaz
Copy link

aaxwaz commented Oct 13, 2017

+1

@maddymanu
Copy link

+1

1 similar comment
@bchasnov
Copy link

+1

@machinaut
Copy link
Contributor

This thread might be tracking more than one thing, but I want to add a specific point:

The upgrade from 0.5.7 to 1.50.1.X is a breaking change. It's essentially a ground-up rewrite. Even the method and linking and loading the mujoco libraries changed, as well as all accessors and processing of field, etc.

mujoco_py.mjlib is only in the old 0.5.7 version, and is not present in the new version.

If you see an error about missing it, then you probably need to downgrade pip install mujoco-py==0.5.7, or see if you can update the underlying code to use the new interfaces.

Hope this helps.

@ethanabrooks
Copy link
Contributor

This pull request should fix this. Please try it and let me know if you have any issues.

@abhigenie92
Copy link

@machinaut The error is still there, despite using previous mujoco-py version.

>>> import gym,mujoco_py
>>> gym.make("Hopper-v1")
Traceback (most recent call last):
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/mujoco/mujoco_env.py", line 12, in <module>
    from mujoco_py.mjlib import mjlib
ModuleNotFoundError: No module named 'mujoco_py.mjlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 164, in make
    return registry.make(id)
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 122, in make
    env = spec.make()
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 88, in make
    cls = load(self._entry_point)
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 17, in load
    result = entry_point.load(False)
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2316, in load
    return self.resolve()
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2322, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/mujoco/__init__.py", line 1, in <module>
    from gym.envs.mujoco.mujoco_env import MujocoEnv
  File "/nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/gym/envs/mujoco/mujoco_env.py", line 14, in <module>
    raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e))
gym.error.DependencyNotInstalled: No module named 'mujoco_py.mjlib'. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)
>>>
gonzo% pip list | grep gym
gym                                0.9.4
gonzo% pip list | grep mujoco-py
mujoco-py                          0.5.7

@ethanabrooks
Copy link
Contributor

@abhigenie92 In my pull request, the line that is throwing the error has been deleted. Are you sure that you are using the updated code?
Also, in order to use mujoco 1.5, you need to use the latest version of mujoco-py:

❯ pip list | ag mujoco-py 
mujoco-py (1.50.1.22)

@InnerPeace-Wu
Copy link

@lobachevzky Thx. I tested on recent Mac by running berkeleydeeprlcourse hw1 demo with mujoco 1.5. And it's working.

@ghost
Copy link

ghost commented Dec 8, 2017

thanks @lobachevzky !

@rajeev595
Copy link

rajeev595 commented Dec 31, 2017

Can anyone help me with the mujoco 1.5 fix ? where can I access it ? Otherwise,
How can I use tensorflow with Mujoco 0.5.7 in the other case ? Since tensorflow needs python3 and mujoco 0.5.7 needs python2, is there a way to work around this ? I have been trying to find a solution. I would really appreciate for any help.

@ethanabrooks
Copy link
Contributor

@rajeev595, you can access the 1.5 fix here. However, you should know that Tensorflow should work with python2 and mujoco 0.5.7 should work with python3. What are the errors that you have been encountering?

@rajeev595
Copy link

@lobachevzky Your fix worked. Thanks for the fix and prompt response :) . I was confused with the python version requirements. Anyways it worked finally.

@zhuzd12
Copy link

zhuzd12 commented Jan 19, 2018

Thanks! @lobachevzky I think the best way to make it work is to install modules we need in virtualenv, including TensorFlow, the modified gym and the mujoco 1.5. And that's my final solution.

@JamesOwers
Copy link
Contributor

@InnerPeace-Wu - I'm trying to do the same thing at the moment and struggling. Please can you detail your install?

@InnerPeace-Wu
Copy link

@JamesOwers Hi, I just clone the pull request and install with official instructions.

@CinderellaRobaker
Copy link

under the python 3.6.1 , when I "import mujoco_py" , it returns error "could not read activation key".
Do someone know where is the problem? my mujoco_py version is 1.3.1

@vitchyr
Copy link
Contributor

vitchyr commented Jun 4, 2018

CinderellaRobaker, do you have a mujoco key (see the mujoco website)? If so, I'd recommend creating a new issue and giving details on what your situation is since it sounds rather different from this thread.

@CinderellaRobaker
Copy link

@vitchyr Yes, I have mujoco key by a student email and have solved the problem. Thank you very much.
And could I bother you with another problem?
That is the error "module 'mujoco_py' has no attribute 'load_model_from_path'" raises, when I run "model = mujoco_py.load_model_from_path(...)", from the demo at https://github.com/openai/mujoco-py.
I have found the similar issues, but the solution do not works for me, the solution is to uninstall and install the gym 0.9.3 or other versions.

@chelseas
Copy link

Why is this issue still open? Does gym work with mujuco 1.5? I'm trying to understand how much work it would take to use rllab with mujoco 1.5 (via gym). rllab only has official support for mujoco1.3.1

@christopherhesse
Copy link
Contributor

Gym now uses mujoco 1.5 #834

@tangbotony
Copy link

One tricky thing here is that gym supports python 2 and 3, but mujoco-py 1.50 only supports python 3

How did you solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests