facebookresearch / xformers

Hackable and optimized Transformers building blocks, supporting a composable construction.
https://facebookresearch.github.io/xformers/
Other
8.69k stars 622 forks source link

fatal error C1083: Cannot open compiler generated file: '': Invalid argument #365

Open harshil-sanghvi opened 2 years ago

harshil-sanghvi commented 2 years ago

❓ Questions and Help While executing 'pip install xformers', I get the error as attached below. I already enabled longpath from regedit. Please help me in resolving the error.

C:\Users\Harshil Sanghvi\AppData\Local\Temp\pip-install-cy8q7xfw\xformers_06605d5ac8334cc2a1d5005993c148de\xformers\components\attention\csrc\attention.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe' failed with exit code 1 Error in atexit._run_exitfuncs: Traceback (most recent call last): File "C:\Users\Harshil Sanghvi\AppData\Local\Programs\Python\Python39\lib\site-packages\colorama\ansitowin32.py", line 59, in closed return stream.closed ValueError: underlying buffer has been detached [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for xformers error: subprocess-exited-with-error

Mystfit commented 2 years ago

I'm also receiving this error when attempting to compile on windows with long paths enabled. I've set the TORCH_CUDA_ARCH_LIST environment variable to 8.6 for my RTX 3080.

I'm using Python 3.9.7 (provided with Unreal Engine) and torch 1.13.0+cu117

Puhek commented 1 year ago

Same issue, on Win11.

C:\Users\marko\AppData\Local\Temp\pip-install-0ejnx_pq\xformers_d26f85c33b514e0aafd7da798d8f7637\xformers\components\attention\csrc\attention.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 1 error: subprocess-exited-with-error

Any clues?

pampersrocker commented 1 year ago

Might be related for having too long paths when installing via pip. Issue was solved on my machine when cloning the repo and building in a much shorter path (L:\Projects\xformers in my case.). Setting long path support on windows does not seem to have an effect for the MSVC compiler (cl.exe)

bansan85 commented 1 year ago

Absolutely, I had to set TMP and TEMP variables to c:\temp and it fix it.

369hiper commented 2 months ago

After 48hour of tackling with the above issue. I found out that xtransformers won't give this error with python 3.10.

When I installed 3.10 I started getting another error which said Could not build wheels due to some cuda error as xformers has a sub dependency transformers depend upon cuda.

Go to xformer git repo and install the xformer version which is compatible with your current cuda installation 12.4 for me. Latest available is 12.6