Cannot import mujoco_py into python

Discussion in 'Bug Reports' started by Amin, Sep 11, 2017.

  1. Hi

    I installed mujoco_py and downloaded mjpro131 64bit.
    When I try to import mujoco_py, I see this error:

    Traceback (most recent call last):
      File "E:/Babadi/Aalto University/ProjectsSources/OpenAIGym/test01/", line 2, in <module>
        env = gym.make('Hopper-v1')
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\", line 161, in make
        return registry.make(id)
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\", line 119, in make
        env = spec.make()
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\", line 85, in make
        cls = load(self._entry_point)
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\", line 17, in load
        result = entry_point.load(False)
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\pkg_resources\", line 2316, in load
        return self.resolve()
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\pkg_resources\", line 2322, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\mujoco\", line 1, in <module>
        from gym.envs.mujoco.mujoco_env import MujocoEnv
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\mujoco\", line 11, in <module>
        import mujoco_py
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py\", line 4, in <module>
        from .mjviewer import MjViewer
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py\", line 7, in <module>
        from . import mjcore, mjconstants, glfw
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py\", line 6, in <module>
        from .mjlib import mjlib
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py\", line 21, in <module>
        mjlib = cdll.LoadLibrary(os.path.abspath(libfile))
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\ctypes\", line 425, in LoadLibrary
        return self._dlltype(name)
      File "C:\Users\AminB\AppData\Local\Programs\Python\Python35\lib\ctypes\", line 347, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 193] %1 is not a valid Win32 application
    Can someone tell me what's the problem? Apparently it's a common problem that shows up when importing C++ libraries into python code and you should recompile the library to fix the problem.
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    This is a question for the OpenAI team; mujoco_py is their software. Note that they now have a Python wrapper for MuJoCo 1.50 which has improved physics simulation, so you should use that new version if possible.