I believe I'm having a python related problem when trying to setup xformers for stable diffusion
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I believe I'm having a python related problem when trying to setup xformers for stable diffusion
Would anyone be able to she some light on what issue Python is having here and how I might go about fixing it?
I am trying to get the xformers library installed into stable-diffusion and I cannot seem to make it work. I am pretty sure it's related to me using Linux Mint and perhaps the wrong python version.
Code:
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$ python launch.py
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
Commit hash: 685f9631b56ff8bd43bce24ff5ce0f9a0e9af490
Installing xformers
Traceback (most recent call last):
File "/home/wh33t/stable-diffusion-webui/launch.py", line 294, in <module>
prepare_environment()
File "/home/wh33t/stable-diffusion-webui/launch.py", line 230, in prepare_environment
run_pip("install xformers", "xformers")
File "/home/wh33t/stable-diffusion-webui/launch.py", line 78, in run_pip
return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
File "/home/wh33t/stable-diffusion-webui/launch.py", line 49, in run
raise RuntimeError(message)
RuntimeError: Couldn't install xformers.
Command: "/home/wh33t/stable-diffusion-webui/venv/bin/python" -m pip install xformers --prefer-binary
Error code: 1
stdout: Collecting xformers
Using cached xformers-0.0.13.tar.gz (292 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
stderr: error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-e730ilkj/xformers_2804a3da417644c5a5451c004d0ea051/setup.py", line 239, in <module>
ext_modules=get_extensions(),
File "/tmp/pip-install-e730ilkj/xformers_2804a3da417644c5a5451c004d0ea051/setup.py", line 157, in get_extensions
raise RuntimeError(
RuntimeError: CUTLASS submodule not found. Did you forget to run `git submodule update --init --recursive` ?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$
Any tips greatly appreciated. I have searched around and tried many things to fix this but cannot seem to get it working.
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$ sudo pip3 install git+https://github.com/facebookresearch/xformers.git#egg=xformers
[sudo] password for wh33t:
sudo: pip3: command not found
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$
I've pretty much tried all the first 3 pages of google search results. None of them "just fix" the issue, which is why I'm trying to understand what the actual underlying problem is. I believe it's related specifically to Linux Mint and how it uses Python.
no, it is not linux mint, but a python or xformers related issue.
You can try python3 -m pip install .... instead of pip3 install. Or just you need to install pip3. (python3-pip or something similar is the name of the package)
no, it is not linux mint, but a python or xformers related issue.
You can try python3 -m pip install .... instead of pip3 install. Or just you need to install pip3. (python3-pip or something similar is the name of the package)
So the automatic1111 stable diffusion setup is just flawed like this?
no, it is not linux mint, but a python or xformers related issue.
You can try python3 -m pip install .... instead of pip3 install. Or just you need to install pip3. (python3-pip or something similar is the name of the package)
I installed pip3 as suggested. Here is the output now
Code:
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$ sudo pip3 install git+https://github.com/facebookresearch/xformers.git#egg=xformers
Collecting xformers
Cloning https://github.com/facebookresearch/xformers.git to /tmp/pip-install-msdzlpgi/xformers_7aaee2db4dbc422e86932e9f70da646b
Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/xformers.git /tmp/pip-install-msdzlpgi/xformers_7aaee2db4dbc422e86932e9f70da646b
Resolved https://github.com/facebookresearch/xformers.git to commit 7835679ed1d91837de3b2e0391098469a8a8b6d6
Running command git submodule update --init --recursive -q
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-msdzlpgi/xformers_7aaee2db4dbc422e86932e9f70da646b/setup.py", line 20, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$
I presume torch is referring to pytorch? I'm pretty sure I have that setup already.
Update: I ran the same command again without using sudo and it seemed to install. But it still errors using when I try to launch it with xformers.
I've got a post over the Mint Forums, so at least I know I'm not the only one and I do think this is somehow related to Linuxmint.
just one comment: using pip as root and as user are different: it will use a different repo (or venv). That's why probably I would try to sudo pip3 install torch.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.