LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-13-2022, 11:15 AM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Red face 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.
 
Old 12-13-2022, 12:24 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
probably this? https://github.com/AUTOMATIC1111/sta...ent-1276993118
 
Old 12-13-2022, 01:28 PM   #3
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by pan64 View Post
Code:
(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.
 
Old 12-13-2022, 03:28 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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)
 
Old 12-13-2022, 03:51 PM   #5
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by pan64 View Post
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?

I will try to install pip3.
 
Old 12-13-2022, 03:55 PM   #6
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by pan64 View Post
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.

Last edited by wh33t; 12-13-2022 at 09:52 PM.
 
Old 12-14-2022, 12:46 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
First open source realistic image generator: stable diffusion hazel General 9 01-30-2023 11:22 AM
Stable Diffusion - amazing machine learning program to create pictures or wallpapers. ////// General 4 09-11-2022 04:32 AM
Diffusion (Rmst ) (Routing tables, reinforcement messages, ) AnasAmer Linux - Software 1 05-22-2015 10:02 PM
publish command is not working in rmstsource + diffusion + ns2 AnasAmer Linux - Software 0 08-27-2011 07:10 PM
weight throwing protocol using ns2 code,diffusion based protocol using ns2 code rajrupa Linux - Networking 1 05-27-2010 03:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration