lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.29k stars 808 forks source link

run.bat: TypeError: expected string or bytes-like object #1203

Open IgorAherne opened 2 months ago

IgorAherne commented 2 months ago

Downloaded webui_forge_cu124_torch24.7z Running update.bat and then run.bat. run.bat cmd window instantly produces an error:

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f2.0.1v1.10.1-previous-306-g2f0555f7
Commit hash: 2f0555f7dc3f2d06b3a3cc238a4fa2b72e11e28d
Traceback (most recent call last):
  File "C:\_myDrive\repos\forge-aug-2024\webui\launch.py", line 51, in <module>
    main()
  File "C:\_myDrive\repos\forge-aug-2024\webui\launch.py", line 39, in main
    prepare_environment()
  File "C:\_myDrive\repos\forge-aug-2024\webui\modules\launch_utils.py", line 472, in prepare_environment
    if not requirements_met(requirements_file):
  File "C:\_myDrive\repos\forge-aug-2024\webui\modules\launch_utils.py", line 357, in requirements_met
    if packaging.version.parse(version_required) != packaging.version.parse(version_installed):
  File "C:\Users\Igor\AppData\Roaming\Python\Python310\site-packages\packaging\version.py", line 54, in parse
    return Version(version)
  File "C:\Users\Igor\AppData\Roaming\Python\Python310\site-packages\packaging\version.py", line 198, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object
Press any key to continue . . .
IgorAherne commented 2 months ago

Hm, deleted and unpacked zip again, ~but can't seem to reproduce it.~ edit: it's occurring again

I think it started happening after I terminated the run.bat window during Installing requirements stage, or earlier.

Tom-Neverwinter commented 2 months ago

did you run the environment.bat file?

I just made this a few minutes ago, maybe this version of the run.bat can help? https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/1216

IgorAherne commented 2 months ago

maybe this version of the run.bat can help?

Thank you, I tried running it but getting the same error. It started occurring again :(

image

IgorAherne commented 2 months ago

Added debug print statements into launch_utils.py requirements_met()

The debug shows that:

  1. most packages are installed
  2. The script attempted to install tqdm==4.66.1, which was not previously installed or had a different version.
  3. The main error occurred when trying to handle the protobuf package: ` ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'c:\_mydrive\repos\forge-aug-2024\system\python\lib\site-packages\protobuf-3.20.0.dist-info\METADATA'`

Here is the full debug log with the protobuf error log.txt

@lllyasviel

kerizane commented 2 months ago

Try deleting this folder:

c:\_mydrive\repos\forge-aug-2024\system\python\lib\site-packages\protobuf-3.20.0.dist-info

mperez96 commented 2 months ago

Got the same error. Some days ago I cloned the repo and did the instalation as was before and that one is running fine, but this downloaded version is giving me this precise error:( image

Edit: Redid all the instalation since I didn't have 7zip, I extracted it with idk what(lol) but what I did was

  1. Run update.bat
  2. run environment.bat
  3. run run.bat

And it downloaded what it needed. I just waited until everything was downloaded to place the models in the respective folder, since it was something I did prior running run.bat before, not so sure if it changed something

mferris77 commented 2 months ago

Hi all - I encountered this problem as well. I suppose just doing a clean reinstall would have been faster but it wouldn't help solve this issue for others so I'm sharing some additional info.

I already had Automatic1111 models installed so after I ran Forge (run.bat) the first time, it worked as expected and the interface loaded in my browser. I then updated webui-user.bat to point to my existing model folders, killed the process (ctrl+c) and reran run.bat - got the same exact error as in the above screenshot.

In trying to find the cause, I ran environment.bat and then just to be sure where python was running from I ran 'pip -V' and oddly got this error:

Fatal error in launcher: Unable to create process using '"D:\webui-forge\system\python\python.exe" "C:\DEV\SD\webui_forge_cu121_torch231\system\python\Scripts\pip.exe" -V': The system cannot find the file specified.

That first path is not from my system - I don't even have a D drive on this computer. I then searched for 'D:\webui-forge' in the entire folder structure via VS Code and the only two hits I got were commented lines in system\python\scripts\numba and system\python\scripts\pygrun. I checked my system path and D:\webui-forge is not included in there either.

I then tried to run python -m pip install --upgrade pip and got this error:

WARNING: Error parsing dependencies of protobuf: [Errno 2] No such file or directory: 'c:\\dev\\sd\\webui_forge_cu121_torch231\\system\\python\\lib\\site-packages\\protobuf-3.20.0.dist-info\\METADATA'

When I look in the site-packages folder, I see a folder for both protobuf 3.20 as well as protobuf 4.25.4. The 3.20 folder contains only 1 file named 'REQUESTED' and has 0 bytes. The 4.25.4 folder has 5 files including the METADATA file. So it seems like something upgraded or reinstalled protobuf during the initial installation process.

I then deleted the 3.20.0 protobuf folder and ran python -m pip install --upgrade protobuf==3.20.0 which uninstalled 4.25.4 and install 3.20.0 but got the following pip dependency error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
onnx 1.14.1 requires protobuf>=3.20.2, but you have protobuf 3.20.0 which is incompatible.
mediapipe 0.10.14 requires protobuf<5,>=4.25.3, but you have protobuf 3.20.0 which is incompatible.

I also noticed a lot of packages pointing to a custom setup involving v4.25.4 and a google package, so maybe onnx and/or mediapipe might be the culprit here?

In any event, after running the above, I then ran 'run.bat' again and it loaded without issue (other than a FutureWarning involving 'TRANSFORMERS_CACHE' being deprecated in favor of 'HF_HOME'.)

Hopefully these additional details will be helpful to someone else!