deforum-art / sd-webui-deforum

Deforum extension for AUTOMATIC1111's Stable Diffusion webui
https://deforum.github.io
Other
2.7k stars 390 forks source link

ModuleNotFoundError: No module named 'deforum_helpers' on LastBen's A1111 colab #163

Closed if-ai closed 1 year ago

if-ai commented 1 year ago

Hi I am having this error when running on Colab


Error loading script: deforum.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 195, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui/scripts/deforum.py", line 12, in <module>
    import deforum_helpers.args as deforum_args
ModuleNotFoundError: No module named 'deforum_helpers'
kabachuha commented 1 year ago

I have an idea why it's happening

the webui and its extensions are stored in different folders, so they have different sys.path

the webui stays in GColab directly, whereas the extension is stored on GDrive

The hard part may be to get the drive name (e.g 'MyDrive') correctly, but I'll try to come up with a solution

if-ai commented 1 year ago

Yes, that looks like it is the issue. Thank you.

On Thu, 22 Dec 2022, 14:56 kabachuha, @.***> wrote:

I have an idea why it's happening

the webui and its extensions are stored in different folders, so they have different sys.path

the webui stays in GColab directly, whereas the extension is stored on GDrive

The hard part may be to get the drive name (e.g 'MyDrive') correctly, but I'll try to come up with a solution

— Reply to this email directly, view it on GitHub https://github.com/deforum-art/deforum-for-automatic1111-webui/issues/163#issuecomment-1362935953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUFQXR2NSYBNOT5IIHRBTWORTYPANCNFSM6AAAAAATGTMQ5Q . You are receiving this because you authored the thread.Message ID: @.*** com>

kabachuha commented 1 year ago

Try it now

if-ai commented 1 year ago

It must be another thing cos' I have the same error and I already updated and check I have the new file as you can see chrome_GdHg7PYKZu

if-ai commented 1 year ago

chrome_glMZkd8WbV

kabachuha commented 1 year ago

@jvoxel add

print(sys.path)
print(os.getcwd())

on top of the file just after import sys, os and message that it will output

if-ai commented 1 year ago

okay here is the new msg

['/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui', '/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion', '/usr/local/lib/python3.8/dist-packages/git/ext/gitdb', '/content/gdrive/MyDrive/sd/stable-diffusion-webui', '/content/gdrive/MyDrive/sd/stable-diffusion-webui', '/env/python', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.8/dist-packages/IPython/extensions', '/content/gdrive/MyDrive/sd/stablediffusion', '/content/gdrive/MyDrive/sd/stablediffusion/src/taming-transformers', '/content/gdrive/MyDrive/sd/stablediffusion/src/codeformer', '/content/gdrive/MyDrive/sd/stablediffusion/src/blip', '/usr/local/lib/python3.8/dist-packages/gitdb/ext/smmap', '/tmp/tmp8365kq47']
/content/gdrive/MyDrive/sd/stablediffusion
Error loading script: deforum.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 195, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui/scripts/deforum.py", line 20, in <module>
    import deforum_helpers.args as deforum_args
ModuleNotFoundError: No module named 'deforum_helpers'
kabachuha commented 1 year ago

Hmm

/content/gdrive/MyDrive/sd/stablediffusion

the environment is named stablediffusion here for some reason instead of stable-diffusion-webui

but the path above are still pointing to '/content/gdrive/MyDrive/sd/stable-diffusion-webui'

And if you comment out the check for colab (also removing the spaces in front of .append line), so the path will be appended anyway?

if-ai commented 1 year ago

I have to go to bed, sorry but I will try that tomorrow thank you.

if-ai commented 1 year ago

I deleted the whole SD folder from my drive and started again had the same problem then commented out the append Colab lines had the same problem then moved the extensions folder into the stablediffusion folder now is showing on gradio I am going to try render something thanks

cerarslan commented 1 year ago

Same for me

if-ai commented 1 year ago

I desisted of using the colab because now I have tensor size errors and a message of two cuda etc.. I don't know what is going on. I think is lastTBen's must have misconfigured something, it was working well a week ago

Funofabot commented 1 year ago

This causes an error on local as well. Its bunk and we need to fix this. I literally cloned the repo and it killed deforum for me. :SAD:

Funofabot commented 1 year ago

Installing from the extension tab fixed it....

Funofabot commented 1 year ago

Simply cloning it created the error. So my suggestion to you, is that you install Deforum for webui in webui extension tab.

Funofabot commented 1 year ago

change these lines to fix it

import deforum_helpers.args as deforum_args import deforum_helpers.settings as deforum_settings

to

import scripts.deforum_helpers.args as deforum_args import scripts.deforum_helpers.settings as deforum_settings

see if that fixes colab issues. Cant test it on my end. But it worked to fix that error on local install

cerarslan commented 1 year ago

I will try tomorrow thx mate

adbrasi commented 1 year ago

I had the same problem, so I used this and it worked perfectly (also fixes the Dreambooth error): !pip install git+https://github.com/huggingface/transformers and !pip install git+https://github.com/huggingface/diffusers

mbaxter commented 1 year ago

import scripts.deforum_helpers.args as deforum_args import scripts.deforum_helpers.settings as deforum_settings

This worked for me - thanks @Funofabot

Kevin6Lomax commented 1 year ago

working like a charm!!! thanks a lot @kabachuha

yyahav commented 1 year ago

Hi! Good thing this issue remains open. Even after the detach fix with the following change:

import scripts.deforum_helpers.args as deforum_args import scripts.deforum_helpers.settings as deforum_settings

It still showes that error on Colab. The pip install of transformers and diffusers didn't work as well (tbh I can't see how these are related to the sys.path issue)

@kabachuha you are correct that it's weird to have two folders created, I can see that in my drive:

image

Some scripts are there instead of in /stable-diffusion-webui:

image

Anyways, to make Deforum tab appear in Colab, I had to add these to the script before the import:

sys.path.append("/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui/scripts") sys.path.append("/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui/scripts/deforum_helpers")

Main deforum stuff

import scripts.deforum_helpers.args as deforum_args ...

Now the Deforum tab shows in Colab and it renders without issues. Thanks!

hithereai commented 1 year ago

Seems like all got it working. If needed please open a new issue. Closing.