melMass / comfy_mtb

Animation oriented nodes pack for ComfyUI
MIT License
427 stars 49 forks source link

[bug] Typing errors on Python < 3.10 #79

Closed p0mad closed 1 year ago

p0mad commented 1 year ago

Describe the bug

Loading: ComfyUI-Impact-Pack (Subpack: V0.2)

Traceback (most recent call last): File "/home/jovyan/workspace/Control/nodes.py", line 1694, in load_custom_node module_spec.loader.exec_module(module) File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/init.py", line 18, in from .utils import here File "/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/utils.py", line 262, in def pil2tensor(image: Image.Image | List[Image.Image]) -> torch.Tensor: TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'

Cannot import /home/jovyan/workspace/Control/custom_nodes/comfy_mtb module for custom nodes: unsupported operand type(s) for |: 'type' and '_GenericAlias' Registered sys.path: ['/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/custom_pycocotools', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/custom_midas_repo', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/init.py', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/custom_detectron2', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/custom_mmpkg', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src/custom_oneformer', '/home/jovyan/workspace/Control/custom_nodes/comfyui_controlnet_aux/src', '/home/jovyan/workspace/Control/custom_nodes/ComfyUI_Comfyroll_CustomNodes/comfy', '/opt/saturncloud/envs/saturn/lib/python3.9/site-packages/git/ext/gitdb', '/home/jovyan/workspace/Control/custom_nodes/ComfyUI_Comfyroll_CustomNodes/comfy', '/home/jovyan/workspace/Control/custom_nodes/ComfyUI_Comfyroll_CustomNodes/comfy', '/home/jovyan/workspace/Control/comfy', '/home/jovyan/workspace/Control', '/opt/saturncloud/envs/saturn/lib/python39.zip', '/opt/saturncloud/envs/saturn/lib/python3.9', '/opt/saturncloud/envs/saturn/lib/python3.9/lib-dynload', '/opt/saturncloud/envs/saturn/lib/python3.9/site-packages', '/tmp/tmpkd7gfiv7', '../..', '/home/jovyan/workspace/Control/custom_nodes/ComfyUI-Impact-Pack/modules', '/home/jovyan/workspace/Control/custom_nodes/ComfyUI-Impact-Pack/subpack', '/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/extern', '/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/extern/frame_interpolation', '/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/extern/GFPGAN', '/home/jovyan/workspace/Control/custom_nodes']

Reproduction

No response

Expected behavior

No response

Platform and versions

Latest comfy

Console output

No response

Additional context

No response

p0mad commented 1 year ago

@melMass @dougwhite

melMass commented 1 year ago

What python version and what comfy mode: embedded/venv/Colab?

This typing issue: def pil2tensor(image: Image.Image | List[Image.Image]) was reported before but the person never followed up (#61)

melMass commented 1 year ago

Yep I just updated it's not an issue with a comfy update

p0mad commented 1 year ago

python --version

Python 3.9.16

p0mad commented 1 year ago

I'm using Cloud with T4 GPU. Its jupyterNotebook !python main.py

p0mad commented 1 year ago

@melMass You have not updated the Repo! the last update is for 48H ago! [ at least what i can see] Comfy got update just yesterday.

p0mad commented 1 year ago

its also the same on ENV

melMass commented 1 year ago

You have not updated the Repo! the last update is for 48H ago! [ at least what i can see] Comfy got update just yesterday.

Your title was "a comfy update broke mtb" that's not true, I updated comfy to its latest commit to confirm

Python 3.9 is the issue if you read what I linked.

I will remove some of these typings although 3.10 should really be the minimum for comfy, nightly already uses 3.11.

melMass commented 1 year ago

No need to tag people I already told you

p0mad commented 1 year ago

Its Working on Py3.10! Thanks

p0mad commented 1 year ago

But my env is not stable! @melMass Can you please guide me through the installation of COMFYUI and MTB using a Ubuntu 22.04 Cloud images?

my workstation has a 16GB VRAM [T4 GPU], 16GB RAM, ... which is on Ubuntu 22.04 server.

I'm not sure how is the correct way of installing Nvidia Driver, CUDA, Cudnn, toolkit!

Is it just enough to have Nvidia driver and then use Conda ENV to create the nessasary packages like cuda, cudnn?

Would you please do conda env export > environment.yml and put the file here for me to install packages accordingly?

Thanks Kind regards

dougwhite commented 1 year ago

@p0mad, when i set this up i started with a decade of linux server admin, two decades of software engineering, and 6 months of reading and understanding how stable diffusion stack works... I still found it highly confusing and difficult.

I'm definitely not an expert at python / conda, and not sure the scope of your request about exporting environment.yml etc... but I'm fairly certain I know this type of question:

Can you please guide me through the installation of COMFYUI and MTB using a Ubuntu 22.04 Cloud images?

You don't realise it, but what you are asking is:

Can you compress decades of experience and learning into a simple one or two step guide that lets me run this highly complicated tech stack on my own very particular custom setup without having to go through any of the hard work or spending any time reading and understanding the individual parts and pieces?

This is not something @melMass could do, and not something they should do.

My advice, go back and read the documentation. Avoid straying from recommended requirements / setups. Learn the pieces slowly and thoroughly, tinker with the code yourself. Walk before you run.

If you want to hit the ground running with stable diffusion but don't have the time or desire to understand the tech, then why not try something like https://rundiffusion.com (supports comfy ui).

Again, maybe I'm just grumpily responding because i was randomly tagged in a github thread... but after reading the above thread it seems to me that you either need to go back and read documentation, or offer to pay @melMass to set up the custom environment you wish to have.

p0mad commented 1 year ago

@dougwhite So you recommend spending 10 years on how to setup an Environment???[Gooosh, you lost half of your life]

I have installed the Comfy using and ENV with python 3.9.6 { as A111 and other comfy Nodes accepts} and it works prefectly! but when i came to the MTB node, i found it a great tool but it lacks for supporting Python 3.9.6 [ < 3.10]. So i tried to run a second ENV using python 3.10 and then again installing all the dependencies for Comfy and CN nodes , ... but when it came again to the MTB in combination with WAS node, it always through an error... like: Traceback (most recent call last): File "/home/jovyan/workspace/Control/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 "/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/init.py", line 183, in from .endpoint import endlog File "/home/jovyan/workspace/Control/custom_nodes/comfy_mtb/endpoint.py", line 9, in import requirements ModuleNotFoundError: No module named 'requirements , Some other ones

So i kindly asked the @melMass to give me some hints on how to correctly setup and ENV which supports his/her Repo.

In your 10+ years of your carrier life, you have not faced with any issue to call others for some help??????? If you have done your HARD WORK to do the right thing, instead of BLAMMING me, Do the hard work and send the ENV setup usable for this repo!

Also any other simple tricks would be much appritiated to setup this env

Thanks

yuqii65535 commented 1 year ago

Hey @p0mad, I went and did the HARD WORK to try and source you the absolute most fool proof approach you could try to get yourself up and running:

https://github.com/AbdBarho/stable-diffusion-webui-docker https://blog.roboflow.com/use-the-gpu-in-docker/ https://github.com/ltdrdata/ComfyUI-Manager

If you are still not having any luck I found some other resources that may help:

https://www.amazon.com.au/Linux-Dummies-Richard-Blum/dp/1119704251 https://www.amazon.com.au/Python-Dummies-Stef-Maruch/dp/0471778648 https://www.amazon.com/Docker-Dummies-world-Benjamin-Young/dp/1521284148 https://www.amazon.com.au/Cloud-Computing-Dummies-Judith-Hurwitz/dp/1119546656 https://www.amazon.com.au/GitHub-For-Dummies/dp/8126530774

Good luck!

melMass commented 1 year ago

The issue threads on this repo are wild 😅 !

Thanks for everyone's input.

@p0mad Usually the issue tracker is meant to report specific issues. Your initial issue was about using python 3.9, then 2 days later a combo of extensions you use probably introduce some bugs unrelated to that initial issue. These should not be "user" tickets as it makes it harder to browse the issue tracker to find related issues. I'd say 60% of the issues reported in this repo are duplicates.

Now for your specific issue, it's because you did not use the install script, tbh it should not be needed so I'll find a way to avoid that in the future for now you can just do (in the venv you made):

python -m pip install requirements-parser

I'll close this but feel free to open a new issue