alpertunga-bile / prompt-generator-comfyui

Custom AI prompt generator node for the ComfyUI
MIT License
72 stars 8 forks source link

ModuleNotFoundError: No module named 'generator.generate' #1

Closed RonGeorge closed 7 months ago

RonGeorge commented 11 months ago

I can't seem to find this module. It prevents loading the node. I cloned from the git.

Traceback (most recent call last): File "D:\AI\ComfyUI\nodes.py", line 1698, in load_custom_node module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "D:\AI\ComfyUI\custom_nodes\prompt-generator-comfyui__init__.py", line 12, in from prompt_generator import PromptGenerator File "D:\AI\ComfyUI\custom_nodes\prompt-generator-comfyui\prompt_generator.py", line 4, in from generator.generate import GenerateArgs, Generator ModuleNotFoundError: No module named 'generator.generate'

alpertunga-bile commented 11 months ago

Hello, thanks for reporting. For experiment (using Windows OS), I freshly install the ComfyUI then clone this repository to custom_nodes and it is working right now. I am adding the steps that I made below for clarity:

ComfyUI commit hash => fb3b7282034a37dbed377055f843c9a9302fdd8c | Github fb3b728 prompt-generator-comfyui commit hash => 7d307d5673b2d4fc2c5bb0ea904a26c42445ea1e | Github 7d307d5

  1. Clone the ComfyUI repository.
  2. Create virtual environment with python -m venv venv command.
  3. Activate the virtual environment with .\venv\Scripts\activate.bat command. (for Windows OS)
  4. Install Pytorch with pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 command.
  5. Install requirements with pip install -r requirements.txt command.
  6. Go to custom_nodes folder with cd custom_nodes command.
  7. Clone the prompt-generator-comfyui.
  8. Go back to base folder.
  9. Run ComfyUI with python main.py command.

Maybe you need to pull the latest version of the ComfyUI and prompt-generator-comfyui. Please check your commit hashes and update if they are not matching then inform me if the issue is going on.

Edit : You can pull the repository with git pull command from where the .git folder is located. Edit 2: I tried the node in the workflow with transformers and onnx model and it seems like working

alpertunga-bile commented 11 months ago

Reopened for feedback

alpertunga-bile commented 11 months ago

I assume that the issue is fixed

RonGeorge commented 11 months ago

I found one anomaly. When I initially installed from the Comfy UI manager, some of the files were not placed correctly. Not sure if or where the typo was. After I uninstalled and then installed via git it worked.

File "D:\AI\ComfyUI\custom_nodes\prompt-generator-comfyui_init.py", line 12, in

alpertunga-bile commented 10 months ago

Thanks for reporting. The issue is fixed in the new commit of the ComfyUI Manager. You may have to reinstall the node from the ComfyUI Manager.

youcanyoubing commented 8 months ago

Thanks for reporting. The issue is fixed in the new commit of the ComfyUI Manager. You may have to reinstall the node from the ComfyUI Manager.

I also have this problem, I installed it from Comfy UI manager, and it didn't work several times, nor did it work when I downloaded and decompressed the past from the web page

alpertunga-bile commented 7 months ago

Hello @youcanyoubing, thanks for reporting. I did a clean setup for the node with ComfyUI Manager and it seems working in my experiment. I had encountered with an issue like this Can't load the Prompt Generator, closing the browser tab and restarting the ComfyUI fixed the issue. Maybe this can solve your issue, if it is not solved please create an issue with an error output.

I used the basicWorkflowWithPromptGenerator.json workflow which is included in this repository.

prompt-generator-comfyui commit : fd448f9 ComfyUI Manager commit : 5938950

alpertunga-bile commented 7 months ago

I assume the issue is fixed for @youcanyoubing

RonGeorge commented 7 months ago

Just to add to this for future reference.

The problem with this error, of misnaming/misplacing the files from ComfyUI Manager happens at the install. When you then try to uninstall via the manager, it does the uninstall correctly, but that means it leaves the incorrect files in place. They don't get removed. Then it will keep reading the errant files no matter how many times you install it normally. The solution is to look for the misnamed files, example: prompt-generator-comfyui_init.py and delete them individually. Then you can install via git and it will work fine. This is probably permanently fixed now though, but just in case someone needs this info in the future.