xformers icon indicating copy to clipboard operation
xformers copied to clipboard

Cant install xformers

Open OkGamez313 opened this issue 1 year ago • 2 comments

❓ Questions and Help

It keeps giving me an error.

error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [20 lines of output] Traceback (most recent call last): File "C:\Users\jayde\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\jayde\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jayde\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jayde\AppData\Local\Temp\pip-build-env-_3mis0w8\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jayde\AppData\Local\Temp\pip-build-env-_3mis0w8\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires self.run_setup() File "C:\Users\jayde\AppData\Local\Temp\pip-build-env-_3mis0w8\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\jayde\AppData\Local\Temp\pip-build-env-_3mis0w8\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 23, in ModuleNotFoundError: No module named 'torch' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

(I dont know the proper way to put the error in)

Can Anyone Help?

OkGamez313 avatar Mar 19 '24 23:03 OkGamez313

Hi, You need to install PyTorch first, before you can install xFormers.

danthe3rd avatar Mar 20 '24 12:03 danthe3rd

You're also trying to build xformers, when you should probably just pull the prebuilt wheel along with torch when you install it unless you have a very large amount of ram (for the default build settings). Building through the automatic build process in python is begging for problems regardless, if you have some reason to build it yourself it's better to clone the repo here and build it using its scripting so you have more control over the parameters and can get reasonable error messages if something goes wrong. Prebuilt wheels are matched with torch versions and available for windows and linux, just use the torch install command from their website but add xformers to the module list.

Edit: Since you're on Windows you'd need at minimum the Windows SDK command line build tools installed, preferably just install Visual Studio 2022 Community, then the CUDA SDK needs to be installed either way to get the integration so .cu files build properly, and whatever torch version you're building against needs to be installed in the system python. If you're already set up for C++ / CUDA development it's relatively quick but if not (and especially if you can't troubleshoot C++ errors, nvcc errors, or CMake errors) you're better off not picking this particular project as your first attempt at building anything. The CUDA integration with VS tools can be buggy, and if you don't read the instructions carefully the flash-attention-2 part of the build will use 256GB of ram with one architecture selected.

NeedsMoar avatar Mar 24 '24 07:03 NeedsMoar