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

Something wrong with pip?

Open N-SPC700 opened this issue 2 years ago • 18 comments

I'm probably missing something terribly obvious, but running webui-user.bat gives me this:

venv "E:\StableDiffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: f421f2af2df41a86af1aea1e82b4c32a2d143385
Installing torch and torchvision
Traceback (most recent call last):
  File "E:\StableDiffusion\stable-diffusion-webui\launch.py", line 168, in <module>
    prepare_enviroment()
  File "E:\StableDiffusion\stable-diffusion-webui\launch.py", line 118, in prepare_enviroment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
  File "E:\StableDiffusion\stable-diffusion-webui\launch.py", line 32, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install torch.
Command: "E:\StableDiffusion\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
Error code: 1
stdout: <empty>
stderr: E:\StableDiffusion\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip


Press any key to continue . . .

The thing that perplexes me is that I do have the correct python version installed, and pip is installed and up to date. I wonder what I'm missing?

N-SPC700 avatar Oct 12 '22 07:10 N-SPC700

I've met the problem and I install torch (and other packages) manually by using 'pip install torch'

Redrocer avatar Oct 12 '22 10:10 Redrocer

I see. Thank you for the response. That's quite annoying to have to deal with, but it seems like it'll sufficiently do for now.

N-SPC700 avatar Oct 12 '22 11:10 N-SPC700

Update: I installed torch (and the other programs) using that method; the program seems to have successfully installed, but it doesn't seem that the batch file (and/or the programs it calls) picked up on that. I don't know what else is going on here. Maybe a system restart is in order.

N-SPC700 avatar Oct 12 '22 18:10 N-SPC700

Do you have a direct link and/or more info on how to install torch manually by using 'pip install torch'? Thanks ahead!

ww-project avatar Oct 12 '22 22:10 ww-project

Do you have a direct link and/or more info on how to install torch manually by using 'pip install torch'? Thanks ahead!

just input 'pip install torch' in cmd.exe if you have python in PATH

Redrocer avatar Oct 12 '22 23:10 Redrocer

Ok, that worked, great! And by that, I mean it downloaded and got installed. But does that mean I don't need to doubleclick the webui-user.bat file anymore and should just continue with the others steps? Cause I clicked it and got the same error message again (despite being installed as seen in my screengrab). In other words, does webui-user.bat has other steps to complete past the torch install? Thanks again! : ) ai-sd-torch install-message01

ww-project avatar Oct 13 '22 01:10 ww-project

Ok, that worked, great! And by that, I mean it downloaded and got installed. But does that mean I don't need to doubleclick the webui-user.bat file anymore and should just continue with the others steps? Cause I clicked it and got the same error message again (despite being installed as seen in my screengrab). In other words, does webui-user.bat has other steps to complete past the torch install? Thanks again! : ) ai-sd-torch install-message01

I don't know... What happened when you doubleclick the .bat file?

Redrocer avatar Oct 13 '22 01:10 Redrocer

I don't know... What happened when you doubleclick the .bat file?

I doubleclicked the webui-user.bat file and it still gets stuck at the installing of the torch and doesn't move on to the next steps... So is there a way to "skip" that torch install step and let it pursue the other ones after *if that's even possible or functional to do so. Or I should do something else like download it and install from here as written in the error message? --> https://download.pytorch.org/whl/cu113 image

ww-project avatar Oct 13 '22 01:10 ww-project

I don't know... What happened when you doubleclick the .bat file?

I doubleclicked the webui-user.bat file and it still gets stuck at the installing of the torch and doesn't move on to the next steps... So is there a way to "skip" that torch install step and let it purse the other ones after *if that's even possible or functional to do so. Or I should do something else like download it and install from here as written in the error message? --> https://download.pytorch.org/whl/cu113 image

First i have to say i haven't met the situation before so my answer may not be useful. maybe you can find a solution for 'No module named pip' on the internet... i dont know either. maybe you can also install torchvision manually? you may change the folder to your working folder and try this : pip install -r requirements_versions.txt I have no better ways sorry.

Redrocer avatar Oct 13 '22 02:10 Redrocer

I don't know... What happened when you doubleclick the .bat file?

I doubleclicked the webui-user.bat file and it still gets stuck at the installing of the torch and doesn't move on to the next steps... So is there a way to "skip" that torch install step and let it pursue the other ones after *if that's even possible or functional to do so. Or I should do something else like download it and install from here as written in the error message? --> https://download.pytorch.org/whl/cu113 image

Click into the command prompt (anywhere in the black area), then press escape. Sometimes the command prompt will suspend an install. Not sure why.

Else, then install Torch manually, then run the bat to have everything else done. Torch can be finicky

mrvirus9898 avatar Oct 14 '22 03:10 mrvirus9898

OK will try that and see. Through other google searches yesterday, I began to believe it might have something to do with my CUDA (since an old version), so I downloaded the latest and will install soon. Will give an update whatever happens! Thanks for the suggestions in the meantime!

ww-project avatar Oct 14 '22 03:10 ww-project

Click into the command prompt (anywhere in the black area), then press escape. Sometimes the command prompt will suspend an install. Not sure why.

Else, then install Torch manually, then run the bat to have everything else done. Torch can be finicky

So I looked into installing Torch and Torchvision separately from the site ( https://pytorch.org/get-started/locally/ ), but it says to include a command line which differs from the CUDA version I have (There's only 3 choices, 10.2 11.3 or 11.6 )... And unless I'm mistaken, it looks impossible to update my CUDA as the NVIDIA info page says "These instructions are intended to be used on a clean installation of a supported platform." Should I still update it regardeless, Is there any way around this?! How to solve these issues?! Sorry, this is all brand new to me. All ideas are appreciated! image

I also tried to do Redrocer's suggestion by using the command "pip install -r requirements_versions.txt" in my L:__Stable Diffusion\stable-diffusion-webui>pip install -r requirements_versions.txt (if that is the working folder you speak of) , and while it installed many things (see txt file attached here), I nonetheless got struck with the same error message after.... COMMAND RESULTS pip install -r requirements_versions.txt

Torch definitely seems to be installed, as seen in this other screengrab: image

ww-project avatar Oct 18 '22 03:10 ww-project

Update: I installed torch (and the other programs) using that method; the program seems to have successfully installed, but it doesn't seem that the batch file (and/or the programs it calls) picked up on that. I don't know what else is going on here. Maybe a system restart is in order.

Did you find a solution after all? I'm still stuck as you can see in my previous post...

ww-project avatar Oct 18 '22 03:10 ww-project

I haven't figured out a single thing since then. I've literally installed all prerequisites/dependencies before due to a previous version, and I simply updated, with the new version being in its own folder. I don't know anything past "it's not picking anything up about pip/torch/etc", unfortunately.

N-SPC700 avatar Oct 18 '22 07:10 N-SPC700

I was having the exact same error on my windows machine and this is how I worked around it: 1) stopped using the .bat files entirely; 2) opened a CMD and navigated into the project's directory; 3) installed all dependencies with python.exe -m pip requirements_versions.txt; 4) then ran python.exe launch.py; and everything worked fine... I then got some unrelated cuda errors but fixed them by downgrading cuda to 10.2 then uninstalling torch installing it again running python.exe launch.py.

But then it became inconvenient to manually open the CMD and pass cli args (such as --no-half-vae) from the command line every time so I made a new simple .bat file with nothing but python.exe launch.py --no-half-vae and it works now (--no-half-vae obviously not needed but that's what I use).

clokken avatar Oct 19 '22 20:10 clokken

Hi clokken,

I'm sorry to be such a newbie when it comes to CMD actions (I'm not a coder), but if I gathered correctly what you meant on step 3, this is what I'm getting... Have I done something wrong already? image

ww-project avatar Oct 19 '22 21:10 ww-project

Hi clokken,

I'm sorry to be such a newbie when it comes to CMD actions (I'm not a coder), but if I gathered correctly what you meant on step 3, this is what I'm getting... Have I done something wrong already? image

Sorry for the late reply, but I think it was supposed to be python.exe -m pip install requirements_versions.txt or maybe python.exe -m pip install -r requirements_versions.txt. I don't really remember. Hope you have already worked around this problem anyways.

clokken avatar Nov 06 '22 22:11 clokken

I just ran into this error after updating python, deleting venv and running webui.sh again worked for me.

gmorenz avatar Nov 10 '22 18:11 gmorenz

this is an old issue which is fixed and no longer seems relevant, if this issue is related to future issues, please refer to this previous one.

ClashSAN avatar May 02 '23 17:05 ClashSAN