receyuki / comfyui-prompt-reader-node

The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader
MIT License
289 stars 22 forks source link

[BUG] - Failed to install #69

Closed lIlIlI11111111 closed 6 months ago

lIlIlI11111111 commented 6 months ago

Description

I tried to install via the ComfyUI manager, and while the terminal said that it worked, it showed up as (IMPORT FAILED) in the manager. I have also tried installing it manually, as well as deleting and reinstalling my venv, and neither of these approaches worked. I assumed that perhaps the manager was just mistaken, but when I tried to add a prompt reader node, there was no such node in any dialogue box. Here is the output text in the terminal after I tried installing with the manager:

Install custom node 'SD Prompt Reader'
Install: ['https://github.com/receyuki/comfyui-prompt-reader-node']
Download: git clone 'https://github.com/receyuki/comfyui-prompt-reader-node'
100%|██████████████████████████████████| 1154.0/1154.0 [00:04<00:00, 250.04it/s]
Install: pip packages

## ComfyUI-Manager: EXECUTE => ['/media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/venv/bin/python', '-m', 'pip', 'install', 'piexif']
 [!] WARNING: You are using pip version 22.0.4; however, version 24.0 is available.
[!] You should consider upgrading via the '/media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/venv/bin/python -m pip install --upgrade pip' command.
Installation was successful.
After restarting ComfyUI, please refresh the browser.
FETCH DATA from: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI-Manager/.cache/1514988643_custom-node-list.json
FETCH DATA from: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI-Manager/.cache/1742899825_extension-node-map.json

Reproduction steps

1) Be on Linux Mint 2) Install ComfyUI 3) Install Comfy manager 4) Search for "Prompt reader" 5) Click install 6) Error

Image file

image

receyuki commented 6 months ago

This is weird, I've never seen anything like this before. When you launch ComfyUI through your terminal, if a custom node fails to import, it should display the corresponding reason for the error. Can you find the content related to comfyui-prompt-reader-node in the terminal's log and post it here?

lIlIlI11111111 commented 6 months ago

It's not all that verbose, just an "Invalid syntax" error

## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2024-05-13 07:35:20.283261
** Platform: Linux
** Python version: 3.9.13 (main, Aug 25 2022, 23:26:10) 
[GCC 11.2.0]
** Python executable: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/venv/bin/python
** Log path: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/comfyui.log

Prestartup times for custom nodes:
   0.6 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI-Manager

Total VRAM 12001 MB, total RAM 32017 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4070 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using pytorch cross attention
WAS Node Suite: OpenCV Python FFMPEG support is enabled
WAS Node Suite Warning: `ffmpeg_bin_path` is not set in `/media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/was-node-suite-comfyui/was_suite_config.json` config file. Will attempt to use system ffmpeg binaries if available.
WAS Node Suite: Finished. Loaded 211 nodes successfully.

    "The secret to getting ahead is getting started." - Mark Twain

### Loading: ComfyUI-Manager (V2.27.2)
### ComfyUI Revision: 2166 [c3341228] | Released on '2024-05-07'
Efficiency Nodes: Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...Success!
Traceback (most recent call last):
  File "/media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/nodes.py", line 1876, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui-prompt-reader-node/__init__.py", line 1, in <module>
    from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui-prompt-reader-node/nodes.py", line 611
    match hash_type:
          ^
SyntaxError: invalid syntax

Cannot import /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui-prompt-reader-node module for custom nodes: invalid syntax (nodes.py, line 611)

Import times for custom nodes:
   0.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui-tooling-nodes
   0.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui_controlnet_aux
   0.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/websocket_image_save.py
   0.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale-6ea48202a76ccf5904ddfa85f826efa80dd50520
   0.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui-inpaint-nodes
   0.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts
   0.0 seconds (IMPORT FAILED): /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/comfyui-prompt-reader-node
   0.1 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
   0.4 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/ComfyUI-Manager
   2.3 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/efficiency-nodes-comfyui
   7.0 seconds: /media/myUsername/26aaaf3e-1911-426f-b540-8c9564bf3d/8_AI/StableDiffThings/ComfyUI/custom_nodes/was-node-suite-comfyui

Starting server

Here's what I see around line 611 in my nodes.py, with the "match hash_type" being exactly 611

@staticmethod
    def calculate_hash(name, hash_type):
        match hash_type:
            case "model":
                hash_dict = SDPromptSaver.model_hash_dict
                file_name = folder_paths.get_full_path("checkpoints", name)
            case "vae":
                hash_dict = SDPromptSaver.vae_hash_dict
                file_name = folder_paths.get_full_path("vae", name)
            case "lora":
                hash_dict = SDPromptSaver.lora_hash_dict
                file_name = folder_paths.get_full_path("loras", name)
            case "ti":
                hash_dict = SDPromptSaver.ti_hash_dict
                file_name = folder_paths.get_full_path("embeddings", name)
            case _:
                return ""
receyuki commented 6 months ago

Ah, I get it now, I've explained the reason here https://github.com/receyuki/comfyui-prompt-reader-node/issues/41#issuecomment-1879788963 Although it may be a bit of a hassle, I still recommend you reinstall ComfyUI using Python 3.10+ to prevent similar issues with other custom nodes.

lIlIlI11111111 commented 6 months ago

Oh thanks. Yep, that fixed it.