hello,
On windows 10, I was finaly able to install mujoco-py. However when trying to run an example I am getting the following:
tensorflow-gpu) C:\test\mujoco-py\mujoco-py-master\examples>python tosser.py
running build_ext
building 'mujoco_py.cymj' extension
creating C:\Users\testAnaconda3\envs\tensorflow-gpu\lib\site-packages\mujoco_py-1.50.1.7-py3.5.egg\mujoco_py\generated_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\Users\testAnaconda3\envs\tensorflow-gpu\lib\site-packages\mujoco_py-1.50.1.7-py3.5.egg
Traceback (most recent call last):
File "C:\Users\testAnaconda3\envs\tensorflow-gpu\lib\distutils\dir_util.py", line 70, in mkpath
os.mkdir(head, mode)
FileNotFoundError: [WinError 206] The filename or extension is too long: 'C:\Users\test\Anaconda3\envs\tensorflow-gpu\lib\site-packages\mujoco_py-1.50.1.7-py3.5.egg\mujoco_py\generated\_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\Users\test\Anaconda3\envs\tensorflow-gpu\lib\site-packages\mujoco_py-1.50.1.7-py3.5.egg'
The crux of the error seems to be the resulting path for what it's building is too long for the operating system.
I'm confused why there seems to be a python within a python. "Users\testAnaconda3\envs\tensorflow-gpu\lib\site-packages\mujoco_py-1.50.1.7-py3.5" appears twice in the path, which seems to point to something being incorrect.
What does just trying to import the module do: python -c "import mujoco_py"
Now I have the same error too. And after python -c "import mujoco_py" too:
python -c "import mujoco_py"
running build_ext
building 'mujoco_py.cymj' extension
creating C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\generated\_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs
Traceback (most recent call last):
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\dir_util.py", line 70, in mkpath
os.mkdir(head, mode)
FileNotFoundError: [WinError 206] The filename or extension is too long: 'C:\\Users\\vmakoviychuk\\AppData\\Local\\Continuum\\Anaconda3\\envs\\Isaac\\lib\\site-packages\\mujoco_py-1.50.1.10-py3.5.egg\\mujoco_py\\generated\\_pyxbld_WindowsExtensionBuilder\\temp.win-amd64-3.5\\Release\\Users\\vmakoviychuk\\AppData\\Local\\Continuum\\Anaconda3\\envs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\__init__.py", line 1, in <module>
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\builder.py", line 296, in <module>
cymj = load_cython_ext(mjpro_path)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\builder.py", line 56, in load_cython_ext
cext_so_path = builder.build()
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\builder.py", line 119, in build
built_so_file_path = self._build_impl()
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\builder.py", line 139, in _build_impl
dist.run_commands()
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\Cython\Distutils\old_build_ext.py", line 185, in run
_build_ext.build_ext.run(self)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\builder.py", line 77, in build_extensions
build_ext.build_extensions(self)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\Cython\Distutils\old_build_ext.py", line 193, in build_extensions
self.build_extension(ext)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\command\build_ext.py", line 532, in build_extension
depends=ext.depends)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\_msvccompiler.py", line 308, in compile
sources, depends, extra_postargs)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\ccompiler.py", line 348, in _setup_compile
self.mkpath(os.path.dirname(obj))
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\ccompiler.py", line 915, in mkpath
mkpath(name, mode, dry_run=self.dry_run)
File "C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\distutils\dir_util.py", line 74, in mkpath
"could not create '%s': %s" % (head, exc.args[-1]))
distutils.errors.DistutilsFileError: could not create 'C:\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs\Isaac\lib\site-packages\mujoco_py-1.50.1.10-py3.5.egg\mujoco_py\generated\_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\Users\vmakoviychuk\AppData\Local\Continuum\Anaconda3\envs': The filename or extension is too long
I've spent this evening trying to set up Windows 10 + Anaconda + Python 3.5 environment + Tensorflow + Mujoco_py and can't resolve this final error as well. I tried to set up registry keys and group policies to enable long paths in Windows according to various guides but it didn't work at all.
I have the same issue. Windows 7 + Python 3.5.2 environment . Has anyone found a solution or resolution to this problem? thanks!
Same problem here:
Windows 10 + Python 3.5.2 64bit... Any news? [WinError 206]
```C:\UsersAndrea>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import mujoco_py
running build_ext
building 'mujoco_py.cymj' extension
creating C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\generated_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages
Traceback (most recent call last):
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dir_util.py", line 70, in mkpath
os.mkdir(head, mode)
FileNotFoundError: [WinError 206] Nome del file o estensione troppo lunga: 'C:\Users\Andrea\AppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\generated\_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\Users\Andrea\AppData\Local\Programs\Python\Python35\lib\site-packages'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py__init__.py", line 1, in
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 439, in
cymj = load_cython_ext(mjpro_path)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 80, in load_cython_ext
cext_so_path = builder.build()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 187, in build
built_so_file_path = self._build_impl()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 207, in _build_impl
dist.run_commands()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\andrea\desktop\rl\mujoco-py.eggs\cython-0.27.2-py3.5-win-amd64.egg\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 106, in build_extensions
build_ext.build_extensions(self)
File "c:\users\andrea\desktop\rl\mujoco-py.eggs\cython-0.27.2-py3.5-win-amd64.egg\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\command\build_ext.py", line 532, in build_extension
depends=ext.depends)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils_msvccompiler.py", line 308, in compile
sources, depends, extra_postargs)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\ccompiler.py", line 348, in _setup_compile
self.mkpath(os.path.dirname(obj))
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\ccompiler.py", line 915, in mkpath
mkpath(name, mode, dry_run=self.dry_run)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dir_util.py", line 74, in mkpath
"could not create '%s': %s" % (head, exc.args[-1]))
distutils.errors.DistutilsFileError: could not create 'C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\generated_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages': Nome del file o estensione troppo lunga```
The problem seems to be solved with the Python installation dir in
C:\Python35
I can succesfully import mujoco_py from terminal but not on pycharm. It simply get stuck giving no errors...
Edit: i was installing mujoco 1.5 when Gym only supports 0.5. Returning to the old directory, now with the right version and activation key everything works fine.
Did some digging around this bug...
Tracked it down to builder.py line228...
Up to that build build.build_base has a directory that looks ok.
(len of the str up to that point is 149 letters in my case...)
But from there it goes to dist.run_commands() where it dives into Cython.
On Cython's side... (with my very limited understanding of that side...) it looks like tempfile.TemporaryDirectory on cymj.pyx is duplicating the directory structure and going over the 260 limit.
edit:
found a work around :D
using code from
http://code.activestate.com/recipes/286179-getshortpathname/
so that in builder.py
CYMJ_DIR_PATH = getShortPathName(abspath(dirname(__file__)))
Not sure if this can just be patched into the code as it may not work with other OS
cheers.
Most helpful comment
Same problem here:
Windows 10 + Python 3.5.2 64bit... Any news? [WinError 206]
```C:\UsersAndrea>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):", line 1, in
File "
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py__init__.py", line 1, in
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 439, in
cymj = load_cython_ext(mjpro_path)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 80, in load_cython_ext
cext_so_path = builder.build()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 187, in build
built_so_file_path = self._build_impl()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 207, in _build_impl
dist.run_commands()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\andrea\desktop\rl\mujoco-py.eggs\cython-0.27.2-py3.5-win-amd64.egg\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\builder.py", line 106, in build_extensions
build_ext.build_extensions(self)
File "c:\users\andrea\desktop\rl\mujoco-py.eggs\cython-0.27.2-py3.5-win-amd64.egg\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\command\build_ext.py", line 532, in build_extension
depends=ext.depends)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils_msvccompiler.py", line 308, in compile
sources, depends, extra_postargs)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\ccompiler.py", line 348, in _setup_compile
self.mkpath(os.path.dirname(obj))
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\ccompiler.py", line 915, in mkpath
mkpath(name, mode, dry_run=self.dry_run)
File "C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\distutils\dir_util.py", line 74, in mkpath
"could not create '%s': %s" % (head, exc.args[-1]))
distutils.errors.DistutilsFileError: could not create 'C:\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages\mujoco_py-1.50.1.24-py3.5.egg\mujoco_py\generated_pyxbld_WindowsExtensionBuilder\temp.win-amd64-3.5\Release\UsersAndreaAppData\Local\Programs\Python\Python35\lib\site-packages': Nome del file o estensione troppo lunga```