Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: .cmd don't launch #920

Closed
1 task done
Yrbashazar opened this issue Sep 9, 2022 · 37 comments
Closed
1 task done

[Bug]: .cmd don't launch #920

Yrbashazar opened this issue Sep 9, 2022 · 37 comments
Labels
bug Something isn't working

Comments

@Yrbashazar
Copy link

What happened?

.cmd don't launch

Version

0.0.1 (Default)

What browsers are you seeing the problem on?

Chrome

Where are you running the webui?

Windows

Custom settings

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Yrbashazar Yrbashazar added the bug Something isn't working label Sep 9, 2022
@kwaad2
Copy link

kwaad2 commented Sep 9, 2022

Running it in the command prompt, I'm getting this error.

< was unexpected at this time.

@mykeehu
Copy link

mykeehu commented Sep 9, 2022

Same here, under Windows

@DvST8x
Copy link

DvST8x commented Sep 9, 2022

Same, here's a bit more details:

/p first_line= 0<environment.yaml
was unexpected at this time.

@codedealer
Copy link
Collaborator

@hafiidz seems to be related to your changes in the cmd files

@mykeehu
Copy link

mykeehu commented Sep 9, 2022

I've temporarily reverted to the original state, and added the new lines in a comment


:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter 
:: set /p first_line=< environment.yaml  
:: for /f "tokens=2 delims=:" %%i in ("%first_line%") do set untrimmed_conda_env_name=%%i
:: remove whitespaces
:: for /f "tokens=* delims= " %%a in ("%untrimmed_conda_env_name%") do set conda_env_name=%%a
:: echo Environment name is set as %conda_env_name% as per environment.yaml

set conda_env_name=ldo

@PxlCode
Copy link

PxlCode commented Sep 9, 2022

starting again 👍

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

I couldn't reproduce the error in my local PC, but there might be some differences in order execution.
I am rewriting this to be more explicit with quotes below.

set /p "first_line=" < "environment.yaml" can somebody with this problem test this for me. @PxlCode , @mykeehu , @DvST8x , @Yrbashazar .

Will send PR if this fully resolved the problem.

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Send a draft, appreciate everyone's help to test.

Please also share you OS version. I am quite curious on how this were to happen.

@DvST8x
Copy link

DvST8x commented Sep 9, 2022

@hafiidz Thanks for your work on the fix but the draft has the same error.

I'm running Windows 11 10.0.25188.1000
The only thing that could be different about my setup that I can think of is Conda is on the C: drive and the SD files are on the D: drive.

@entusiastaIA
Copy link

Hi there... I just made an account to try help with this. I am no programmer but I test things. I needed some time to understand that I had to edit webui.cmd instead of environment.yaml... so there you can see my (lack of) knowledge.

Any way. Copypasting @mykeehu lines ad the begining of webui.cmd allowed me to launch AI again and play.
Reverting to a fresh downloaded webui.cmd and changing @hafiidz line kept the problem.

OS is Windows 10 Home

@entusiastaIA
Copy link

@hafiidz Thanks for your work on the fix but the draft has the same error.

I'm running Windows 11 10.0.25188.1000 The only thing that could be different about my setup that I can think of is Conda is on the C: drive and the SD files are on the D: drive.

I do Have Conda on C: and SD on K: too.

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Mine is also on different disk, so that shouldn't be the issue.
Could you please share the full picture of the CMD?

@codedealer , could you please help to revert both #860 & #895 from master while I am doing more detailed check in the dev branch. Hard to fix something that I unfortunately couldn't reproduce. My sincerest apologies.

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

> was unexpected at this time. To double confirm, the error code is > or < ya?

@entusiastaIA
Copy link

How do I know the error code? without reverting the changes cmd just opens and closes itself without telling anything.

With the whole picture do you mean the whole lines of code inside it?

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Please add pause to the line after.
For example, copy and replace the first 8 lines with this

@echo off

:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter 
set /p "first_line="< "environment.yaml"
for /f "tokens=2 delims=:" %%i in ("%first_line%") do set untrimmed_conda_env_name=%%i
for /f "tokens=* delims= " %%a in ("%untrimmed_conda_env_name%") do set conda_env_name=%%a
echo Environment name is set as %conda_env_name% as per environment.yaml
pause

And screenshot those. You can screenshot and paste (CTRL+V) in the comment box

@DvST8x
Copy link

DvST8x commented Sep 9, 2022

@hafiidz

Hope this helps
https://i.imgur.com/7vAf2dG.jpg

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

@hafiidz

Hope this helps i.imgur.com/7vAf2dG.jpg

Is it possible for you to try with this.

@echo off

:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter 
set /p "first_line="< "environment.yaml"
for /f "tokens=2 delims=:" %%i in ("%first_line%") do set untrimmed_conda_env_name=%%i
for /f "tokens=* delims= " %%a in ("%untrimmed_conda_env_name%") do set conda_env_name=%%a
echo Environment name is set as %conda_env_name% as per environment.yaml
pause

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Weird that the wording changes to set /p first line = 0 <environment.yaml

Not sure where that comes from.

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

And, you can just paste your screencap in the comment box here. I also just learn this yesterday. Github automatically upload picture here after a few seconds.

@DvST8x
Copy link

DvST8x commented Sep 9, 2022

Same exact error with your last request.

@entusiastaIA
Copy link

Even with the change it closes after launching, so nothing to show you there... here screencap of the code inside should I be messing something.
Captura

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Is it possible for you to double click the webui.cmd instead of calling from another command line?
Curious if that plays any role.

Sorry for a lot of question. Couldn't really reproduce this myself unfortunately. Huhu.

@entusiastaIA
Copy link

entusiastaIA commented Sep 9, 2022

On the contrary, thank you for developing this AI.

I usually double click cmd. There is only a little difference if I right click execute it as a administrator: It opens says some words and closes. gonna try read them in time...

Spec not found: invalid name, try the format: user/package

haha took me 6 tries

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Really appreciate your hard work to help me test. This is collaborative Open Source work. I just help with external side part for now. Mostly other team members are doing the hard part.

Could you please try another option.
set /p "%%first_line=" < "environment.yaml"

@entusiastaIA
Copy link

entusiastaIA commented Sep 9, 2022

BTW, I was using this branch because of the deepfry problem: https://github.com/xaedes/stable-diffusion-webui/tree/mask-restore-665

But have downloaded the whole master branch to do the tests, there's no difference. The code reverted works the new code closes on opening

On my way! (My thanks extends to the whole team, of course)

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

And thanks to use for error reporting and testing. Every contribution helps.

@entusiastaIA
Copy link

For now is frozen there...

Captura

@entusiastaIA
Copy link

Captura

@pozibrothers
Copy link

pozibrothers commented Sep 9, 2022

The problem is related to how newlines are treated in the environment.yaml file. I have git configured to change all newline characters to LF and it was causing the problem as the Windows script was not stopping the for-each line loop when finding an LF character.

If anyone is having this issue, open the environment.yaml file in VSCode, click on the lower right side on the LF text, change it to CRLF and save the file. Then run the webui.cmd command again.

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

We will revert the changes for now. Will continue to debug this further before we restore the automated environment set.

The problem is related to how newlines are treated in the environment.yaml file. I have git configured to change all newline characters to LF and it was causing the problem as the Windows script was not stopping the for each line loop when finding an LF character.

If anyone is having this issue, open the environment.yaml file in vscode, click on the lower right side on the LF text, change it to CRLF and save the file. Then run the webui.cmd command again.

Oh my god. Thanks!!! I think this is it. Able to reproduce the error. Will try to check the best way to handle this when restoring this feature.

@DvST8x
Copy link

DvST8x commented Sep 9, 2022

Confirming @pozibrothers fix works.
I made the same change in Notepad++

Thanks, good job.

@entusiastaIA
Copy link

If I didn't understand a word of what he said is alright to revert for now or should I try to understand it?

Thanks by the way.

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

If I didn't understand a word of what he said is alright to revert for now or should I try to understand it?

Thanks by the way.

Are you in master branch? If so, just sync back to this master branch, the revert has been done there. If you are in dev, please perform fix by @mykeehu , i.e. manually revert the changes by commenting and adding the old line.

:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter 
:: set /p first_line=< environment.yaml  
:: for /f "tokens=2 delims=:" %%i in ("%first_line%") do set untrimmed_conda_env_name=%%i
:: remove whitespaces
:: for /f "tokens=* delims= " %%a in ("%untrimmed_conda_env_name%") do set conda_env_name=%%a
:: echo Environment name is set as %conda_env_name% as per environment.yaml

set conda_env_name=ldm

@hafiidz
Copy link
Contributor

hafiidz commented Sep 9, 2022

Need to take some rest first. Will be off for the rest of the day. Thanks again everyone who submit report, tested and found the actual root cause. Really appreciate it.

@kwaad2
Copy link

kwaad2 commented Sep 9, 2022

We will revert the changes for now. Will continue to debug this further before we restore the automated environment set.

The problem is related to how newlines are treated in the environment.yaml file. I have git configured to change all newline characters to LF and it was causing the problem as the Windows script was not stopping the for each line loop when finding an LF character.
If anyone is having this issue, open the environment.yaml file in vscode, click on the lower right side on the LF text, change it to CRLF and save the file. Then run the webui.cmd command again.

Oh my god. Thanks!!! I think this is it. Able to reproduce the error. Will try to check the best way to handle this when restoring this feature.

Yes. I will confirm as well, this fixed it.

@DarkAndBlue
Copy link

DarkAndBlue commented Sep 11, 2022

https://stackoverflow.com/a/20631625
worked for me

So instead of:

set /p first_line=< environment.yaml

this:

for /F "delims=" %%i in (environment.yaml) do (  
  set first_line=%%i
  goto BREAK1
)
:BREAK1

@hafiidz
Copy link
Contributor

hafiidz commented Sep 12, 2022

for /F "delims=" %%i in (environment.yaml) do (
set first_line=%%i
goto BREAK1
)
:BREAK1

Awesome, really appreciate your help @DarkAndBlue.

@codedealer or @ZeroCool940711 , appreciate if you could have a look and incorporate this fix, I am unfortunately stuck with another unrelated issue couldn't fully test this until next week.

prsyahmi added a commit to prsyahmi/stable-diffusion-webui that referenced this issue Sep 13, 2022
- Allow reading environment.yaml file in either LF or CRLF
- Only update environment if environment.yaml changes
- Remove custom_conda_path to discourage changing source file
- Fix unable to launch webui due to frontend module missing (Sygil-Dev#605)
prsyahmi added a commit to prsyahmi/stable-diffusion-webui that referenced this issue Sep 13, 2022
- Allow reading environment.yaml file in either LF or CRLF
- Only update environment if environment.yaml changes
- Remove custom_conda_path to discourage changing source file
- Fix unable to launch webui due to frontend module missing (Sygil-Dev#605)
codedealer pushed a commit that referenced this issue Sep 13, 2022
- Allow reading environment.yaml file in either LF or CRLF
- Only update environment if environment.yaml changes
- Remove custom_conda_path to discourage changing source file
- Fix unable to launch webui due to frontend module missing (#605)
@hlky hlky closed this as completed in a797312 Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants