I want to use MuJoCo (http://www.mujoco.org/), an advanced physics simulator with python bindings (https://github.com/openai/mujoco-py).
I've got my MuJoCo license file mjkey.text and added the required paths MUJOCO_PY_MJKEY_PATH, MUJOCO_PY_MJPRO_PATH to the environment variables accordingly.
MUJOCO_PY_MJPRO_PATH = C:\Dropbox\PhD\MuJoCo\mjpro131
MUJOCO_PY_MJKEY_PATH = C:\Dropbox\PhD\MuJoCo\mjpro131\bin
However, a soon as I want to import the libray with the following simple code,
import mujoco_py
I got the following error message.
C:\Dropbox\Python\Anaconda\python.exe
C:/Dropbox/PhD/Python/X/MujocoHelloWorld/test.py
Traceback (most recent call last):
File "C:/Dropbox/PhD/Python/X/MujocoHelloWorld/test.py", line 1, in <module>
import mujoco_py
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "C:\Dropbox\Python\Anaconda\lib\site-packages\mujoco_py-0.5.4-py3.5.egg\mujoco_py\__init__.py", line 4, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "C:\Dropbox\Python\Anaconda\lib\site-packages\mujoco_py-0.5.4-py3.5.egg\mujoco_py\mjviewer.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "C:\Dropbox\Python\Anaconda\lib\site-packages\mujoco_py-0.5.4-py3.5.egg\mujoco_py\mjcore.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "C:\Dropbox\Python\Anaconda\lib\site-packages\mujoco_py-0.5.4-py3.5.egg\mujoco_py\mjlib.py", line 21, in <module>
File "C:\Dropbox\Python\Anaconda\lib\ctypes\__init__.py", line 425, in LoadLibrary
return self._dlltype(name)
File "C:\Dropbox\Python\Anaconda\lib\ctypes\__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
Process finished with exit code 1
I am using a Python 3.5.1 64-bit on a Windows 7 64-bit with MuJoCo 1.31 64-bit.
I guessed the problem is due to a some kind of incompatibility, I also tried Python 3.5.2 32-bit with MuJoCo 1.31 32-bit. Even, I tried the non-logical 32-bit Python and 64-bit MuJoCo combination and vice versa.
The already compiled given example "simulate.exe" in the MuJoCo library works perfectly. So, I guess there is no problem with the 64-bit MuJoCo library that I have. ( By the way, 32-bit version of it doesn't run on 64-bit Windows )
So, the problem should probably occur when loading the C++ library to Python. I debugged and at least checked that the Python code in mujoco_py library tries to load "mujoco131.lib" ( Not "mujoco131.dll" though ) from the correct path. And then the error occurs and code fails to run further.
I am open to any kind of comments and suggestions..
Cheers! And have a nice day!
print("hey")
import mujoco_py
print("hey")
This code prints the first "hey" and then keeps on running forever.. Any further ideas? – Merrymaker