stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Uninstallable with fedora 37 / Python 3.11.1

Open tfrum opened this issue 1 year ago • 17 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

When the install script goes to install pytorch you get the following error:

ERROR: Could not find a version that satisfies the requirement torchvision==0.14.1+cu117 (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3) ERROR: No matching distribution found for torchvision==0.14.1+cu117

This is because the version of pytorch being used is not supported in newer versions of Python. Using an older version should work, in theory, but using applications like pyenv to set a supported global version of python doesn't affect the installer. Installing pytorch locally doesn't communicate that dependency to the installation since the installer uses pip.

Basically it's just a pytorch problem. There might be something that the stable-diffusion-webui devs can do, but I ran into deadends trying to just get the installer to see and use my other python versions.

Steps to reproduce the problem

Be on current Fedora or other system with newer versions of python.

What should have happened?

Successful installation of the application.

Commit where the problem happens

Current as of 2/23/2023.

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

None.

List of extensions

None.

Console logs

None.

Additional information

No response

tfrum avatar Feb 24 '23 06:02 tfrum

yeah, as expected it shouldn't work with 3.11

ClashSAN avatar Feb 24 '23 06:02 ClashSAN

yeah, as expected it shouldn't work with 3.11

Are they expecting to commit support at some point, or a workaround for installations with newer versions of python? I expected the installer to simple grab a supported version of python and use an environment.

tfrum avatar Feb 24 '23 06:02 tfrum

  1. python3.10 -m venv venv
  2. activate venv enviornment
  3. check python version.
  4. python launch.py

ClashSAN avatar Feb 24 '23 07:02 ClashSAN

  1. python3.10 -m venv venv
  2. activate venv enviornment
  3. check python version.
  4. python launch.py

I suppose after the installer failing to acknowledge pyenv and pip3 virtual environments I didn't think to try the regular built in option--I'm only an occasional python user through data science.

This does work and probably should be added as a workaround in the installation guide--3.11 isn't exactly niche at this point since we're a third of the way to 3.12.

tfrum avatar Feb 24 '23 08:02 tfrum

its a more manual method, but it's listed on AMD installation page. you could always help out, if you see some trouble with the guide I'll post the edits to the wiki

The different guides for different systems are less maintained, because most of us test with Windows+NVIDIA, brkirch tests with mac, and it seems AMD and linux system scripts are not checked as often.

ClashSAN avatar Feb 24 '23 08:02 ClashSAN

its a more manual method, but it's listed on AMD installation page. you could always help out, if you see some trouble with the guide I'll post the edits to the wiki

The different guides for different systems are less maintained, because most of us test with Windows+NVIDIA, brkirch tests with mac, and it seems AMD and linux system scripts are not checked as often.

Will do. I'll try and submit an update when I have the chance.

tfrum avatar Feb 24 '23 08:02 tfrum

i still can't get it to work and it continues to use 3.11.2, fedora linux

NKkrisz avatar Mar 11 '23 17:03 NKkrisz

i still can't get it to work and it continues to use 3.11.2, fedora linux

Are you successfully entering the virtual environment? To activate the virtual environment do:

source venv/bin/activate

Then you can run the script from that terminal.

tfrum avatar Mar 11 '23 19:03 tfrum

i still can't get it to work and it continues to use 3.11.2, fedora linux

Are you successfully entering the virtual environment? To activate the virtual environment do:

source venv/bin/activate

Then you can run the script from that terminal.

I think I tried that but it still didn't work, decided to try this instead.

NKkrisz avatar Mar 11 '23 19:03 NKkrisz

i still can't get it to work and it continues to use 3.11.2, fedora linux

Are you successfully entering the virtual environment? To activate the virtual environment do: source venv/bin/activate Then you can run the script from that terminal.

I think I tried that but it still didn't work, decided to try this instead.

I have that, too, but it's not as powerful of a tool. Could you post your terminal outputs, starting from the beginning? We're on the same OS and version so you shouldn't have had an issue.

tfrum avatar Mar 12 '23 00:03 tfrum

To temporarily address this issue, I have created a simple script for my personal use, which I have also made available on Github. The script automatically generates a virtual environment and provides some installation assistance in case of any issues. While it is not fully polished and very basic, it may be useful for individuals who only use Python occasionally.

https://github.com/martin-rizzo/FedoraDiffusionLauncher

martin-rizzo avatar Mar 15 '23 15:03 martin-rizzo

Just in case anyone stumbles into this:

It is possible to run on python 3.11.2, but requires getting your hands dirty and making non-trivial changes.

  1. Install the nightly version of torch et. al.
  2. You have to build sentencepiece from source to use it with 3.11. This isn't too hard on fedora, but is absolute hell on windows.
  3. Numba does not currently work with python 3.11. Until they get their act together, we have to remove it as a dependency. The only package we need which currently requires numba is facexlib, which uses numba to jit this one "iou" function. You can git clone facexlib, remove the numba import and @jit decorator from the file I linked, then remove numba from facexlib's requirements. Once you pip install your modified facexlib, you can install gfpgan and realesrgan as normal.
  4. Build xformers from source.

With all this, my webui will actually launch, but things are a little wonky (buttons and stuff are the wrong size/position) but this may be due to gradio version differences.

ZeroBomb avatar Mar 19 '23 16:03 ZeroBomb

Just in case anyone stumbles into this:

It is possible to run on python 3.11.2, but requires getting your hands dirty and making non-trivial changes.

  1. Install the nightly version of torch et. al.
  2. You have to build sentencepiece from source to use it with 3.11. This isn't too hard on fedora, but is absolute hell on windows.
  3. Numba does not currently work with python 3.11. Until they get their act together, we have to remove it as a dependency. The only package we need which currently requires numba is facexlib, which uses numba to jit this one "iou" function. You can git clone facexlib, remove the numba import and @jit decorator from the file I linked, then remove numba from facexlib's requirements. Once you pip install your modified facexlib, you can install gfpgan and realesrgan as normal.
  4. Build xformers from source.

With all this, my webui will actually launch, but things are a little wonky (buttons and stuff are the wrong size/position) but this may be due to gradio version differences.

Now wheel for sentencepiece can be found in action-ci, which includes windows platform.

With pytorch2.0 and opt-sdp, xformers is not that essential anymore.

XZiar avatar Apr 04 '23 06:04 XZiar

Same problem here, can't install on Fedora 37 due to python3.11.

So I created a container with Toolbox and a Fedora 36 image (Python3.10), but now it crashes every time right after finishing downloading Torch, after downloading 1.8GB... It's the 3rd time this morning it happens, it does not resume download or anything, it just crashes again and again every time it reaches 100%.

Has any Fedora user ever managed to get it working ?

cronvel avatar Apr 14 '23 09:04 cronvel

I have, see outline above.

ZeroBomb avatar Apr 15 '23 21:04 ZeroBomb

Alternatively, and if anybody is interested and willing, the solution that worked for my case is to install python3.10 and set that as default version for python3 using alternatives command, deleted venv folder and installation worked fine.

Not a python expert but there were my steps:

  1. sudo dnf install python3.10
  2. sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
  3. sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
  4. sudo alternatives --config python3 then select python3.10
  5. check new default python3 -V . It should print 3.10
  6. delete venv folder if it shows some errors regarding pip or something. I think because it was built for 3.11 from previous run. I could be wrong.
  7. rerun ./webui.sh

The nice thing is that 3.11 is still there when I need it and can easily switch default version. Hope this helps.

akositey avatar Apr 25 '23 15:04 akositey

Alternatively, and if anybody is interested and willing, the solution that worked for my case is to install python3.10 and set that as default version for python3 using alternatives command, deleted venv folder and installation worked fine.

Not a python expert but there were my steps:

1. `sudo dnf install python3.10`

2. `sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1`

3. `sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2`

4. `sudo alternatives --config python3` then select python3.10

5. check new default `python3 -V` . It should print 3.10

6. delete venv folder if it shows some errors regarding pip or something. I think because it was built for 3.11 from previous run. I could be wrong.

7. rerun `./webui.sh`

The nice thing is that 3.11 is still there when I need it and can easily switch default version. Hope this helps.

No need to change alternatives. Just install python3.10 and in webui-user.sh change command for python to python3.10 or something like that. Also, you should remove venv folder if it was created before with wrong python version.

kuriot avatar May 06 '23 22:05 kuriot