In order to use MuJoCo on a recent mac, you need to be using MuJoCo 1.5: https://github.com/openai/mujoco-py/issues/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?
One tricky thing here is that gym supports python 2 and 3, but mujoco-py 1.50 only supports python 3
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 APII 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.
Agreed -- would be great to have support for 1.5!
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/.)
@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
@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!
@episodeyang I don't know about 1.3, but mujoco_py version 0.5.7 worked for me with Mujoco131.
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.
@weiliu620 so, it's exactly what it says - you need to download mujoco 131 instead of 150
@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?
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.
@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.
+1
+1
+1, hope mujoco1.5 can be used on mac
+1
+1
+1
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.
This pull request should fix this. Please try it and let me know if you have any issues.
@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
@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)
@lobachevzky Thx. I tested on recent Mac by running berkeleydeeprlcourse hw1 demo with mujoco 1.5. And it's working.
thanks @lobachevzky !
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.
@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?
@lobachevzky Your fix worked. Thanks for the fix and prompt response :) . I was confused with the python version requirements. Anyways it worked finally.
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.
@InnerPeace-Wu - I'm trying to do the same thing at the moment and struggling. Please can you detail your install?
@JamesOwers Hi, I just clone the pull request and install with official instructions.
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
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.
@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.
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
Gym now uses mujoco 1.5 https://github.com/openai/gym/pull/834
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
Most helpful comment
@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.7and 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.