Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error - file name too long #298

Closed
iandanforth opened this issue Sep 28, 2018 · 14 comments
Closed

Fatal error - file name too long #298

iandanforth opened this issue Sep 28, 2018 · 14 comments

Comments

@iandanforth
Copy link

iandanforth commented Sep 28, 2018

c1: fatal error C1081: 'C:\Users\Ian\Miniconda3\envs\drlnd\lib\site-packages\mujoco_py-1.50.1.59-py3.6.egg\mujoco_py\generated\_pyxbld_1.50.1.59_36_windowsextensionbuilder\temp.win-amd64-3.6\Release\Users\Ian\Miniconda3\envs\drlnd\lib\site-packages\mujoco_py-1.50.1.59-py3.6.egg\mujoco_py\cymj.obj': file name too long

Given that conda is the recommended installation mechanism for pytorch I expect other windows users to run into this issue when installing mujoco-py into an env.

There doesn't seem to be anything in that path that isn't mandated by either conda or python.

I'm blocked on this issue so any suggestions are welcome!

@iandanforth
Copy link
Author

I ended up copying a previously compiled version I had outside the conda env into the env dir and then updating the easy-install.pth file that conda maintains to point to the mujoco-py .egg dir.

@machinaut
Copy link
Contributor

Pull requests welcome for this, but otherwise not sure how to fix this.

Possible that you could hack the internals of cython or the python builder to make it generate different paths, but this looks like a side effect of how those are handled in windows.

@machinaut
Copy link
Contributor

Tentatively closing for now, but if other users run into this, please reopen the issue

@rebcabin
Copy link

rebcabin commented Apr 9, 2019

I ran into this by following the install instructions verbatim. I don't have a previously compiled version, so I am blocked.

c1: fatal error C1081: 'C:\Users\bbeckman\AppData\Local\Programs\Python\Python37\lib\site-packages\mujoco_py-2.0.2.0-py3.7.egg\mujoco_py\generated_pyxbld_2.0.2.0_37_windowsextensionbuilder\temp.win-amd64-3.7\Release\Users\bbeckman\AppData\Local\Programs\Python\Python37\lib\site-packages\mujoco_py-2.0.2.0-py3.7.egg\mujoco_py\cymj.obj': file name too long

EDIT: I don's see a clicky-button for "reopening" the issue as invited above. Hope this comment gets noticed!

EDIT 2: [April 9, 2019, 3:22 PM] Beckman, Brian: UNBLOCKED using anaconda
[April 9, 2019, 3:23 PM] Beckman, Brian: conda install mujoco-py
[April 9, 2019, 3:23 PM] Beckman, Brian: command line only not gui. gui didn't find mujoco-py 😊
[April 9, 2019, 3:24 PM] Beckman, Brian: then followed the destructions here: https://github.com/openai/mujoco-py

@airqualityanthony
Copy link

@rebcabin I'm having the same issue here, conda install mujoco-py isn't available.

I can see that the path length is just too big for it to compile. Not sure how I'd change it.

@moonblue333
Copy link

still a bug, file name too long.

@lyuyan9527
Copy link

Here is my tricky solution to this problem
I am installing mujoco_py 2.0.2 on my win10 in Anaconda, the problem is when building the wheel, the temp directory created by mujoco is too long, for which I can't understand both why there is a duplicate in the path generated by the building process and why windows limit the length of a directoy to 260.
Here is my solution:

  1. download the source code of mujoco directly from github and unzip it
  2. cd to the souce code folder, activate your conda environment and run "python setup.py install", this will install the required files to your conda environment
  3. after step2, when you try to import mujoco_py in python, python will do the builing automatically, which will still cause a 'file name too long' problem, but if you check the path it generates here, it no longer exceeds 260 too much, which is around 270 in my case
  4. Here is the tricky part, I changed my anaconda path to just one letter, which will shorten the path directly. For example, I changed my conda path from "D:\ProgramData\Anaconda3" to "D:\P\A", also, I changed my environment's name to a single letter "c" as well(conda activate c)
  5. after step4, remember to change the Path variables in environment variables to make sure your conda still work properly
  6. then just activate your conda environment and start a python console, then just "import mujoco_py" and let the pyhon build
  7. remember to change your conda directory and Path variables back. I was able to run the humanoid example and more time needed to check if there is other problem with my method
    Hope this method works well for those who have the same problem with me

@secondsensei
Copy link

Issue is persisting

@xiaobanni
Copy link

I also encountered this problem.

@pcheng2
Copy link

pcheng2 commented May 26, 2021

I was saved by this repo, please try it if it could solve your problem, gl :)
#298

@csyhy1986
Copy link

Here is my tricky solution to this problem
I am installing mujoco_py 2.0.2 on my win10 in Anaconda, the problem is when building the wheel, the temp directory created by mujoco is too long, for which I can't understand both why there is a duplicate in the path generated by the building process and why windows limit the length of a directoy to 260.
Here is my solution:

  1. download the source code of mujoco directly from github and unzip it
  2. cd to the souce code folder, activate your conda environment and run "python setup.py install", this will install the required files to your conda environment
  3. after step2, when you try to import mujoco_py in python, python will do the builing automatically, which will still cause a 'file name too long' problem, but if you check the path it generates here, it no longer exceeds 260 too much, which is around 270 in my case
  4. Here is the tricky part, I changed my anaconda path to just one letter, which will shorten the path directly. For example, I changed my conda path from "D:\ProgramData\Anaconda3" to "D:\P\A", also, I changed my environment's name to a single letter "c" as well(conda activate c)
  5. after step4, remember to change the Path variables in environment variables to make sure your conda still work properly
  6. then just activate your conda environment and start a python console, then just "import mujoco_py" and let the pyhon build
  7. remember to change your conda directory and Path variables back. I was able to run the humanoid example and more time needed to check if there is other problem with my method
    Hope this method works well for those who have the same problem with me

I confront with the same problem and try to solve it following your instruction. However I don't use Anaconda, I use pip to install my packages, what should I do?

@lyuyan9527
Copy link

lyuyan9527 commented Sep 15, 2021 via email

@Ianlande
Copy link

I found another alternative solution for reference:

Enabling Long Path Support
Windows 10 and later versions can support long paths exceeding 260 characters. This can be enabled by modifying the registry or group policy.

Registry Modification:

  1. Open the Registry Editor (Press Win + R, then type regedit).
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.
  3. Look for the key named LongPathsEnabled. If it doesn’t exist, you can create a new DWORD (32-bit) value.
  4. Set the value of LongPathsEnabled to 1.

Group Policy Modification:

  1. Open the Group Policy Editor (Press Win + R, then type gpedit.msc).
  2. Navigate to Computer Configuration > Administrative Templates > System > Filesystem.
  3. Find and enable the policy Enable Win32 long paths.

After making these changes, it is recommended to restart the computer to ensure the changes take effect.

@Ianlande
Copy link

Ianlande commented Jul 31, 2024

I found another alternative solution for reference:

Enabling Long Path Support Windows 10 and later versions can support long paths exceeding 260 characters. This can be enabled by modifying the registry or group policy.

Registry Modification:

  1. Open the Registry Editor (Press Win + R, then type regedit).
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.
  3. Look for the key named LongPathsEnabled. If it doesn’t exist, you can create a new DWORD (32-bit) value.
  4. Set the value of LongPathsEnabled to 1.

Group Policy Modification:

  1. Open the Group Policy Editor (Press Win + R, then type gpedit.msc).
  2. Navigate to Computer Configuration > Administrative Templates > System > Filesystem.
  3. Find and enable the policy Enable Win32 long paths.

After making these changes, it is recommended to restart the computer to ensure the changes take effect.

I found that it didn't always work. Although no "file name too long" error was reported, the code still failed to compile, possibly due to file names being too long. However, this issue wasn't clearly indicated, and I'm not sure what happened...

Finally, I resolved the issue by creating a shorter file path using the following command:

conda create -p C:\envs\m python=3.10

This created a new environment in a shorter path "C:\envs\m", and I downloaded the Mujoco source code files there. Then, I installed with these commands:

pip install -r requirements.txt
pip install -r requirements.dev.txt
python setup.py install

This approach worked, and the installation was successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests