adieyal / comfyui-dynamicprompts

ComfyUI custom nodes for Dynamic Prompts
MIT License
188 stars 20 forks source link

No module named 'comfyui_dynamicprompts' #1

Closed AhmedGit closed 10 months ago

AhmedGit commented 11 months ago

Not working.

ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts__init__.py", line 1, in from comfy_dynamicprompts.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS ModuleNotFoundError: No module named 'comfy_dynamicprompts'

adieyal commented 11 months ago

Could you give it another go and let me know if it works?

AhmedGit commented 11 months ago

it's installed correctly now, but on the output level, I don't think it doesn't work. I have this wildcard named "children_animals_minimal", in the webui it generates the image grid attached. but for the ComfyUI it generated strange images "three of them attached" as if it takes the file name as prompt, not its content.

This is the list included in the wild card: fox cat squirrel frog duck sheep owl rat rabbit crocodile

webui

ComfyUI_00036_ ComfyUI_00031_ ComfyUI_00035_

adieyal commented 11 months ago

Have a look in the console to see what the prompt is. Where is your wildcard folder? Perhaps it can't find it.

AhmedGit commented 11 months ago

I have used it where wildcards folder is in "ComfyUI/wildcards" or "ComfyUI/custom_nodes/comfyui-dynamicprompts/wildcards", non of them worked. I also removed nested folders and used the wildcard file directly in the wildcard folder root, and didn't work either.

adieyal commented 11 months ago

Are you getting any useful output in the console?

AhmedGit commented 11 months ago

This is the wildcard I use, testList containing these values (dog, cat, owl)

Console No values found for wildcard testList Prompt: testList

AhmedGit commented 11 months ago

Should I install any other wildcard custom nodes with it to work like "lordgasmic wildcards" custom node, or "lilly1987 simple wildcard for ComfyUI"?

adieyal commented 11 months ago

No, it should just work. To test, I did the following

  1. mkdir ComfyUI/wildcards
  2. Then I copied children_animals_minimal.txt into the wildcards folder
  3. Finally I used a RandomPrompts node with this prompt {red|green|blue} __children_animals_minimal__

see the attached workflow. Can you try those exact steps and let me know if it still doesn't work? ComfyUI_00002_

workflow.zip

AhmedGit commented 11 months ago

tried it, and this is what I get:

Console: 
got prompt
Prompt: green __children_animals_minimal__

(The prompt has the double underscores, but it is not showing here due to formatting of the comment section)

image: ComfyUI_00079_

adieyal commented 11 months ago

looks like you're missing a double underscore in your prompt, it should be {red|green|blue} __children_animals_minimal__

but I think you're using:

{red|green|blue} _children_animals_minimal_

[EDIT - just noticed that you updated your comment]

AhmedGit commented 11 months ago

Screenshot 2023-08-02 101303

adieyal commented 11 months ago

can you show me the contents of ComfyUI/wildcards

AhmedGit commented 11 months ago

testList.txt folder children_animals_minimal.txt

adieyal commented 11 months ago

I just had a look at your original issue:

ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts_init_.py", line 1, in
from comfy_dynamicprompts.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
ModuleNotFoundError: No module named 'comfy_dynamicprompts'

It looks like you have two ComfyUI directories. The wildcards directory should be parallel to custom_nodes or inside the extension's directory

i.e.

ComfyUI/
├─ wildcards # (option 1)
├─ custom_nodes/
│  ├─ comfui_dynamicprompts/
│  │  ├─ wildcards # (option 2)

Is that perhaps the problem?

AhmedGit commented 11 months ago

I have tried both options. Option 1 doesn't give this error "No values found for wildcard", but doesn't list the values in the file. Option 2 gives the above error in the console.

So, the current configuration is that Im using option 1 with wildcards folder on the same level as custom_nodes folder.

adieyal commented 11 months ago

To help me debug, could you please download this file and change the extension to .py then copy it over comfy_dynamicprompts/nodes/sampler.py

Generate your prompt again and then paste the output you see in the console.

sampler.txt

AhmedGit commented 11 months ago

Have tested it. With the default wildcards locations it didn't work, and gave error that wildcards folder is NoneType.

When I created a folder called "wildcards" inside the comfy_dynamicprompts/nodes/wildcards location besides the sampler.py file, it worked, and now dynamic prompt works.

Im using windows 11.

AhmedGit commented 11 months ago

Also please add the option to refresh the wildcards folder, as it doesnot detect newly added files on the fly. I need to restart ComfyUI to read new files added.

thanks.

adieyal commented 11 months ago

Thanks for figuring that out. I'll look into why that's happening, perhaps simply search in every directory starting with the root until I find a wildcards folder.

AhmedGit commented 11 months ago

Great efforts. Best wishes.

adieyal commented 10 months ago

Closing this issue in favour of #8.