butaixianran / Stable-Diffusion-Webui-Civitai-Helper

Stable Diffusion Webui Extension for Civitai, to manage your model much more easily.
2.37k stars 286 forks source link

Fails to load or show up No module named 'scripts.ch_lib' #268

Closed Delcos closed 4 months ago

Delcos commented 5 months ago

Have you read document?

Yes

Have you checked console log window's msg?

Yes

Describe Issue

When installing any branch onto the newest release of Webui (as of 1/25/2024 10:54 am), it gives this error and Helper doesn't show in the tabs space. This is using a fresh install of everything, including OS. All of the files are included and placed where they should be.

Console log's msg or screenshot for function issue


*** Error loading script: civitai_helper.py Traceback (most recent call last): File "/home/del/stable-diffusion-webui/modules/scripts.py", line 469, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/home/del/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/del/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/scripts/civitai_helper.py", line 20, in from scripts.ch_lib import model ModuleNotFoundError: No module named 'scripts.ch_lib'


butaixianran commented 5 months ago

I have no such problem. It looks like you didn't restart your sd webui after installing this addon.

As the document said, you need to restart the whole sd webui, not just click the "Reload UI" button.


If you still has this issue after restart the whole sd webui, do following steps:

moesie commented 4 months ago

I have the same issue, it happens even after

*** Error loading script: civitai_helper.py
    Traceback (most recent call last):
      File "C:\stable-diffusion-webui-forge\modules\scripts.py", line 544, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "C:\stable-diffusion-webui-forge\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "C:\stable-diffusion-webui-forge\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\civitai_helper.py", line 13, in <module>
        from scripts.ch_lib import model
    ModuleNotFoundError: No module named 'scripts.ch_lib'

---
*** Error loading script: sections.py
    Traceback (most recent call last):
      File "C:\stable-diffusion-webui-forge\modules\scripts.py", line 544, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "C:\stable-diffusion-webui-forge\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "C:\stable-diffusion-webui-forge\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\sections.py", line 6, in <module>
        from scripts.ch_lib import model
    ModuleNotFoundError: No module named 'scripts.ch_lib'
moesie commented 4 months ago

fixed the issue for myself by adding an empty init.py to the scripts folder (it is missing). @butaixianran FYI, you might want to add this to the next release?

butaixianran commented 4 months ago

fixed the issue for myself by adding an empty init.py to the scripts folder (it is missing). @butaixianran FYI, you might want to add this to the next release?

script folder is under webui's management, there is no need to add init.py to that folder at all.

Also, you are not using this extension. You are using another fork of this project.

In your error message, the error happens on a file scripts\sections.py. This project doesn't have that file. And this project will never put another script file under scripts folder, which will be a mess since this project already has a folder for library.

And this extension does not support Forge.

moesie commented 4 months ago

Thanks for your response and thanks for creating this awesome extension.

I had the issue both with this extension and with the fork at https://github.com/blue-pen5805/Stable-Diffusion-Webui-Civitai-Helper , which I installed in an initial attempt to make it run.

I can just say that adding init.py made it work for me. If that makes sense is beyond my ability to interpret, it is what it is.

I however gather from your response that the issue was rooted in the way Forge manages the script folder and will open a corresponding issue with the Forge dev.

Thanks again.