bmaltais / kohya_ss

Apache License 2.0
9.65k stars 1.24k forks source link

"No module named 'global_state'" in gui.bat #2814

Open AndreR opened 2 months ago

AndreR commented 2 months ago

Whenever I run gui.bat on my Windows 11 machine, get the following error:

PS P:\AI\kohya_ss\kohya_ss> .\gui.bat
18:34:13-251402 INFO     Kohya_ss GUI version: v24.1.7
git: 'submodule' is not a git command. See 'git --help'.
18:34:15-681950 ERROR    Error during Git operation: Command '['git', 'submodule', 'update', '--init', '--recursive',
                         '--quiet']' returned non-zero exit status 1.
18:34:15-684952 INFO     nVidia toolkit detected
18:34:19-214034 INFO     Torch 2.1.2+cu118
18:34:20-358960 INFO     Torch backend: nVidia CUDA 11.8 cuDNN 8700
18:34:20-361959 INFO     Torch detected GPU: NVIDIA GeForce RTX 4090 VRAM 24564 Arch (8, 9) Cores 128
18:34:20-362971 INFO     Python version is 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit
                         (AMD64)]
18:34:20-363961 INFO     Verifying modules installation status from requirements_pytorch_windows.txt...
18:34:20-365963 INFO     Verifying modules installation status from requirements_windows.txt...
18:34:20-367965 INFO     Verifying modules installation status from requirements.txt...
Traceback (most recent call last):
  File "P:\AI\kohya_ss\kohya_ss\venv\lib\site-packages\easygui\boxes\utils.py", line 29, in <module>
    import tkinter as tk  # python3
ModuleNotFoundError: No module named 'tkinter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "P:\AI\kohya_ss\kohya_ss\venv\lib\site-packages\easygui\boxes\utils.py", line 36, in <module>
    import Tkinter as tk  # python2
ModuleNotFoundError: No module named 'Tkinter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "P:\AI\kohya_ss\kohya_ss\venv\lib\site-packages\easygui\boxes\button_box.py", line 15, in <module>
    from . import utils as ut
  File "P:\AI\kohya_ss\kohya_ss\venv\lib\site-packages\easygui\boxes\utils.py", line 43, in <module>
    raise ImportError("Unable to find tkinter package.")
ImportError: Unable to find tkinter package.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "P:\AI\kohya_ss\kohya_ss\kohya_gui.py", line 4, in <module>
    from kohya_gui.class_gui_config import KohyaSSGUIConfig
  File "P:\AI\kohya_ss\kohya_ss\kohya_gui\class_gui_config.py", line 2, in <module>
    from .common_gui import scriptdir
  File "P:\AI\kohya_ss\kohya_ss\kohya_gui\common_gui.py", line 5, in <module>
    from easygui import msgbox, ynbox
  File "P:\AI\kohya_ss\kohya_ss\venv\lib\site-packages\easygui\__init__.py", line 34, in <module>
    from .boxes.button_box import buttonbox
  File "P:\AI\kohya_ss\kohya_ss\venv\lib\site-packages\easygui\boxes\button_box.py", line 18, in <module>
    import global_state
ModuleNotFoundError: No module named 'global_state'

All mentioned modules should be installed:

PS P:\AI\kohya_ss\kohya_ss> pip install tk
Requirement already satisfied: tk in p:\ai\forge ai image generator\system\python\lib\site-packages (0.1.0)
PS P:\AI\kohya_ss\kohya_ss> pip install --upgrade easygui
Requirement already satisfied: easygui in p:\ai\forge ai image generator\system\python\lib\site-packages (0.98.3)

How can I fix that?

kopyl commented 1 month ago

Same thing. The gui does not run because of this

Rocketman1105 commented 2 weeks ago

It looks like tkinter isn't handled by pip for some reason. You have to have it installed as a package on your system, for the right version of python. On ubuntu that was: sudo apt-get install python3.10-tk There is probably a manual install of some kind you will need to do on windows.

driqeks commented 15 hours ago

I have the same issue