Python binding for MuJoCo physics library using mujoco-py package
<p>I want to use MuJoCo (<a href="http://www.mujoco.org/" rel="noreferrer">http://www.mujoco.org/</a>), an advanced physics simulator with python bindings (<a href="https://github.com/openai/mujoco-py" rel="noreferrer">https://github.com/openai/mujoco-py</a>).</p>

<p>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.</p>

<pre><code>MUJOCO_PY_MJPRO_PATH = C:\Dropbox\PhD\MuJoCo\mjpro131
MUJOCO_PY_MJKEY_PATH = C:\Dropbox\PhD\MuJoCo\mjpro131\bin
</code></pre>

<p>However, a soon as I want to import the libray with the following simple code,</p>

<pre><code>import mujoco_py
</code></pre>

<p>I got the following error message.</p>

<pre><code>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 &lt;module&gt;
    import mujoco_py
  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 664, in _load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", 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 &lt;module&gt;
  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 664, in _load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", 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 &lt;module&gt;
  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 664, in _load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", 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 &lt;module&gt;
  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 664, in _load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", 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 &lt;module&gt;
  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
</code></pre>

<p>I am using a Python 3.5.1 64-bit on a Windows 7 64-bit with MuJoCo 1.31 64-bit.</p>

<p>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. </p>

<p>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 )</p>

<p>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.</p>

<p>I am open to any kind of comments and suggestions..</p>

<p>Cheers! And have a nice day!</p>