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

[Bug]: can't open file '/stable-diffusion-webui/launch.py': [Errno 2] No such file or directory

Open ParityError opened this issue 2 years ago • 10 comments

Is there an existing issue for this?

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

What happened?

Updated and received this error:

can't open file '/stable-diffusion-webui/launch.py': [Errno 2] No such file or directory

Steps to reproduce the problem

$ git pull

remote: Enumerating objects: 127, done.
remote: Counting objects: 100% (116/116), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 127 (delta 67), reused 86 (delta 55), pack-reused 11
Receiving objects: 100% (127/127), 96.91 KiB | 1.27 MiB/s, done.
Resolving deltas: 100% (69/69), completed with 25 local objects.
From https://github.com/AUTOMATIC1111/stable-diffusion-webui
   27e319dc..5c9f2bbb  master     -> origin/master
Updating 27e319dc..5c9f2bbb
Fast-forward
 javascript/extraNetworks.js               |  2 --
 javascript/imageviewer.js                 |  2 +-
 launch.py                                 | 26 +++++++++++++++-----------
 modules/api/api.py                        | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
 modules/api/models.py                     |  2 ++
 modules/mac_specific.py                   |  3 +--
 modules/models/diffusion/uni_pc/uni_pc.py |  2 +-
 modules/sd_vae_approx.py                  |  5 ++++-
 modules/ui.py                             |  3 ++-
 modules/ui_extra_networks.py              |  2 --
 requirements_versions.txt                 |  2 +-
 scripts/xyz_grid.py                       | 15 +++++++++++++++
 style.css                                 |  4 +---
 test/basic_features/extras_test.py        |  8 +++++---
 test/basic_features/img2img_test.py       |  8 +++++---
 test/server_poll.py                       |  6 ++++--
 webui.py                                  | 12 ++++++------
 webui.sh                                  | 28 ++++++++++++++--------------
 18 files changed, 145 insertions(+), 68 deletions(-)

$ ./webui.sh --no-half

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on parityerror user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
/Users/ParityError/stable-diffusion-webui/venv/bin/python3.10: can't open file '/Users/ParityError/stable-diffusion-webui/launch.py': [Errno 2] No such file or directory

The path is set wrong now; my installation is not in the directory that it's looking. I have changed nothing within my environment to cause this error.

What should have happened?

No error.

Commit where the problem happens

5c9f2bbb

What platforms do you use to access the UI ?

MacOS

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

No

List of extensions

None

Console logs

See above.

Additional information

No response

ParityError avatar Mar 12 '23 06:03 ParityError

Seems to be caused by this commit: https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/adf723a9b2a8e83c71219a33a914f5dcd01d88f8

simply git checkout ddc503d1 as a workaround.

NSQY avatar Mar 12 '23 08:03 NSQY

Same happened to me, and I was able to get around it by editing the webui-user.sh to launch the launch.py... Once I got it running though several features seemed broken, specifically inpainting

PhilipHoltzman avatar Mar 12 '23 09:03 PhilipHoltzman

Snipaste_2023-03-12_20-18-03

Yesterday launch.py did not follow the new file in github, so it can be installed successfully. Today, I reinstalled wedui and found that launch.py followed the new file, but wedui could not install it, and reported an error

Tuka1888 avatar Mar 12 '23 12:03 Tuka1888

Still doesnt work for me!

elchupacabrinski avatar Mar 12 '23 15:03 elchupacabrinski

Still doesnt work for me!

move "stable-diffusion-webui" to /Users/account_name and wait fix😂

rggsix avatar Mar 12 '23 15:03 rggsix

The issue here is the launch script now assumes the repo is at the hardcoded path /home/<user>/stable-diffusion-webui if not specified, when the previous behavior was to assume the repo is at the current working directory. IMO the latter is more reasonable than assuming a hardcoded install path anyway and it avoids breaking existing installations.

As a workaround you can replicate the old behavior by setting install_dir to the parent dir of the repo:

install_dir=".." ./webui.sh

feffy380 avatar Mar 12 '23 16:03 feffy380

Yes, the assumption that everyone has the project in /home/stable-diffusion is bad practice. Also it doesn't account for people who have multiple installations.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/webui.sh#L26

this line should probably be changed from:

install_dir="/home/$(whoami)"

to:

install_dir="$(pwd)"

of course you'd need to be in the stabe-diffusion-webui directory when executing the startup script.

Another workaround is to symlink the directory to wherever you have the actual installation, that way you won't have to edit any files/scripts:

$ ln -s <actual installation path> ~/stable-diffusion-webui 

ParityError avatar Mar 12 '23 19:03 ParityError

CDeliCG

ryouzue avatar Mar 19 '23 08:03 ryouzue

I have the same problem on Windows and cant fix it.

venv "C:\Users\armin\stable-diffusion-webui\venv\Scripts\python.exe" C:\Program Files\Python311\python.exe: can't open file 'C:\Windows\System32\launch.py': [Errno 2] No such file or directory

I cant find this one "System32\launch.py" everything else is there! any idea?

Azool2 avatar Mar 26 '23 12:03 Azool2

cd stable-diffusion-webui yunchak@MacBook-Air stable-diffusion-webui % cd stable-diffusion-webui cd: no such file or directory: stable-diffusion-webui yunchak@MacBook-Air stable-diffusion-webui % git checkout ddc503d1 Note: switching to 'ddc503d1'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:

git switch -c

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at ddc503d1 Merge pull request #8509 from vladmandic/fastapi yunchak@MacBook-Air stable-diffusion-webui % git switch -c error: switch `c' requires a value yunchak@MacBook-Air stable-diffusion-webui % git swtich -c stable-diffusion-webui git: 'swtich' is not a git command. See 'git --help'.

The most similar command is switch yunchak@MacBook-Air stable-diffusion-webui % clear

yunchak@MacBook-Air stable-diffusion-webui % git checkout ddc503d1 HEAD is now at ddc503d1 Merge pull request #8509 from vladmandic/fastapi yunchak@MacBook-Air stable-diffusion-webui % cd stable-diffusion-webui cd: no such file or directory: stable-diffusion-webui yunchak@MacBook-Air stable-diffusion-webui % cd stable-diffusion-webui cd: no such file or directory: stable-diffusion-webui yunchak@MacBook-Air stable-diffusion-webui % yunchak@MacBook-Air stable-diffusion-webui % clear

yunchak@MacBook-Air stable-diffusion-webui % cd stable-diffusion-webui cd: no such file or directory: stable-diffusion-webui yunchak@MacBook-Air stable-diffusion-webui %

guys I need help. The file is in the correct directory on the computer and the homebrew is installed correctly. I just could not figure out why I can't run SD since the response is always "no such file or directory"

dsjklgsjdkl avatar Apr 18 '23 04:04 dsjklgsjdkl

It doesn't works because the install script is stupid.
It fails if the stable-diffusion-webui already exists in your home directory.
That case is not handeled properly by install script.
Remove the stable-diffusion-webui folder from your home directory before install, or clone the repo to another folder and then copy content to stable-diffusion-webui folder before install.

Flashwalker avatar Apr 25 '23 09:04 Flashwalker

I have a slightly different problem. I was able to run launch.py previously and draw. today due to my bad memory I can't find the folder for the original install, and ended up installing it again. while doing this, somehow, the launch.py is associated with web browser file type. when I run the lauch.py, it basically opens a browser page and then nothing. can someone please help?

seand168 avatar May 01 '23 02:05 seand168