mujoco-py icon indicating copy to clipboard operation
mujoco-py copied to clipboard

[help wanted]errors occured when import mujoco_py

Open shaneshbi opened this issue 6 years ago • 7 comments

the problems occured as follows>>> import mujoco_py Compiling /usr/local/lib/python3.5/dist-packages/mujoco_py/cymj.pyx because it changed. [1/1] Cythonizing /usr/local/lib/python3.5/dist-packages/mujoco_py/cymj.pyx warning: /usr/local/lib/python3.5/dist-packages/mujoco_py/generated/../pxd/mjmodel.pxd:99:4: 'mjtDisableBit' redeclared warning: /usr/local/lib/python3.5/dist-packages/mujoco_py/generated/../pxd/mjmodel.pxd:114:4: 'mjtEnableBit' redeclared /ModuleNode.py", line 400, in generate_c_code f = open_new_file(result.c_file) File "/usr/local/lib/python3.5/dist-packages/Cython/Utils.py", line 57, in open_new_file os.unlink(path) PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/mujoco_py/cymj.c' Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/mujoco_py/init.py", line 1, in from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException File "/usr/local/lib/python3.5/dist-packages/mujoco_py/builder.py", line 468, in cymj = load_cython_ext(mjpro_path) File "/usr/local/lib/python3.5/dist-packages/mujoco_py/builder.py", line 90, in load_cython_ext cext_so_path = builder.build() File "/usr/local/lib/python3.5/dist-packages/mujoco_py/builder.py", line 202, in build built_so_file_path = self._build_impl() File "/usr/local/lib/python3.5/dist-packages/mujoco_py/builder.py", line 274, in _build_impl so_file_path = super()._build_impl() File "/usr/local/lib/python3.5/dist-packages/mujoco_py/builder.py", line 215, in _build_impl dist.ext_modules = cythonize([self.extension]) File "/usr/local/lib/python3.5/dist-packages/Cython/Build/Dependencies.py", line 1026, in cythonize cythonize_one(*args) File "/usr/local/lib/python3.5/dist-packages/Cython/Build/Dependencies.py", line 1146, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: /usr/local/lib/python3.5/dist-packages/mujoco_py/cymj.pyx

i tried to chmod 'cymi.c',but it doesn't work.

shaneshbi avatar Sep 17 '18 12:09 shaneshbi

It looks like the permissions on your compiled files are strange.

What happens when you uninstall and reinstall without cache?

pip uninstall mujoco-py
pip install -U --no-cache --no-cache-dir mujoco-py

machinaut avatar Oct 17 '18 23:10 machinaut

Facing same issue. Any solutions?

rohansingh42 avatar Jul 13 '19 23:07 rohansingh42

@rohansingh42 @shaneshbi did you get any solution to this yet? I'm facing the same

oluwayetty avatar Nov 19 '19 13:11 oluwayetty

How about to use "pip install -e ." instead of "python setup.py install" for install? This solves a similar problem in my case.

cross32768 avatar Dec 01 '19 13:12 cross32768

I received the following error when trying to import mujoco_py:

PermissionError: [Errno 13] Permission denied: b'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mujoco_py/generated/mujocopy-buildlock'

I solved as follows:

cd /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mujoco_py sudo chmod -R 777 ./ (change permission of all files in all subfolders recursively)

jamesheald avatar Dec 25 '19 21:12 jamesheald

Facing the same issue. Any solutions?

yuvalzaidel avatar Oct 14 '20 05:10 yuvalzaidel

Hello, my laptop is Macbook Pro with M1Pro, and I ever faced the same issue.I referred to this blog(https://blog.csdn.net/CCCDeric/article/details/131788795) and successfully solved this problem. This is a blog with chinese, It points out that you can try to run this code: pip install Cython==3.0.0a10 to change your version of Cython.

DogWY avatar Sep 28 '23 11:09 DogWY