Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComfyUI errors after install the core requirements since Version 1.13.1, tested also with Version 1.14.0 #404

Open
forest-hermit opened this issue Feb 11, 2024 · 19 comments
Labels
linux Linux related

Comments

@forest-hermit
Copy link

forest-hermit commented Feb 11, 2024

Logs:

2024-02-09 12:45:35,280 INFO Total VRAM 7940 MB, total RAM 31773 MB
2024-02-09 12:45:35,280 INFO Set vram state to: NORMAL_VRAM
2024-02-09 12:45:35,280 INFO Device: cuda:0 NVIDIA GeForce RTX 4060 Laptop GPU : cudaMallocAsync
2024-02-09 12:45:35,280 INFO VAE dtype: torch.bfloat16
2024-02-09 12:45:35,300 INFO Using pytorch cross attention
2024-02-09 12:45:36,040 INFO 
2024-02-09 12:45:36,040 ERROR Traceback (most recent call last):
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/main.py", line 76, in <module>
    import execution
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/execution.py", line 11, in <module>
    import nodes
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/nodes.py", line 21, in <module>
    import comfy.samplers
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/samplers.py", line 1, in <module>
    from .k_diffusion import sampling as k_diffusion_sampling
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/k_diffusion/sampling.py", line 3, in <module>
    from scipy import integrate
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/__init__.py", line 134, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/__init__.py", line 94, in <module>
    from ._quadrature import *
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/_quadrature.py", line 9, in <module>
    from scipy.special import roots_legendre
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/__init__.py", line 781, in <module>
    from ._support_alternative_backends import (
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/_support_alternative_backends.py", line 6, in <module>
    from scipy._lib._array_api import array_namespace, is_cupy, is_torch, is_numpy
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/_lib/_array_api.py", line 15, in <module>
    from numpy.testing import assert_
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/__init__.py", line 11, in <module>
    from ._private.utils import *
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1253, in <module>
    _SUPPORTS_SVE = check_support_sve()
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1247, in check_support_sve
    output = subprocess.run(cmd, capture_output=True, text=True)
  File "/usr/lib/python3.10/subprocess.py", line 505, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.10/subprocess.py", line 1154, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.10/subprocess.py", line 2059, in _communicate
    stdout = self._translate_newlines(stdout,
  File "/usr/lib/python3.10/subprocess.py", line 1031, in _translate_newlines
    data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 62: invalid continuation byte

2024-02-09 12:46:42,575 INFO Total VRAM 7940 MB, total RAM 31773 MB
2024-02-09 12:46:42,575 INFO Set vram state to: NORMAL_VRAM
2024-02-09 12:46:42,575 INFO Device: cuda:0 NVIDIA GeForce RTX 4060 Laptop GPU : cudaMallocAsync
2024-02-09 12:46:42,575 INFO VAE dtype: torch.bfloat16
2024-02-09 12:46:42,575 INFO Using pytorch cross attention
2024-02-09 12:46:43,076 INFO 
2024-02-09 12:46:43,076 ERROR Traceback (most recent call last):
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/main.py", line 76, in <module>
    import execution
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/execution.py", line 11, in <module>
    import nodes
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/nodes.py", line 21, in <module>
    import comfy.samplers
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/samplers.py", line 1, in <module>
    from .k_diffusion import sampling as k_diffusion_sampling
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/k_diffusion/sampling.py", line 3, in <module>
    from scipy import integrate
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/__init__.py", line 134, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/__init__.py", line 94, in <module>
    from ._quadrature import *
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/_quadrature.py", line 9, in <module>
    from scipy.special import roots_legendre
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/__init__.py", line 781, in <module>
    from ._support_alternative_backends import (
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/_support_alternative_backends.py", line 6, in <module>
    from scipy._lib._array_api import array_namespace, is_cupy, is_torch, is_numpy
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/_lib/_array_api.py", line 15, in <module>
    from numpy.testing import assert_
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/__init__.py", line 11, in <module>
    from ._private.utils import *
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1253, in <module>
    _SUPPORTS_SVE = check_support_sve()
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1247, in check_support_sve
    output = subprocess.run(cmd, capture_output=True, text=True)
  File "/usr/lib/python3.10/subprocess.py", line 505, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.10/subprocess.py", line 1154, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.10/subprocess.py", line 2059, in _communicate
    stdout = self._translate_newlines(stdout,
  File "/usr/lib/python3.10/subprocess.py", line 1031, in _translate_newlines
    data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 62: invalid continuation byte
@Acly
Copy link
Owner

Acly commented Feb 12, 2024

It fails to import a rather basic/popular package (numpy). I tried to check what it's trying to do, and it looks like it runs lscpu command to check for some hardware support. The output can't be read due to encoding issues, which is very strange on Linux (usually everything is utf8).
Try running lscpu, see if it gives a hint.

@forest-hermit
Copy link
Author

forest-hermit commented Feb 12, 2024

It gave the following output:

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  16
  On-line CPU(s) list:   0-15
Vendor ID:               GenuineIntel
  Model name:            12th Gen Intel(R) Core(TM) i7-12650H
    CPU family:          6
    Model:               154
    Thread(s) per core:  2
    Core(s) per socket:  10
    Socket(s):           1
    Stepping:            3
    CPU(s) scaling MHz:  28%
    CPU max MHz:         4700,0000
    CPU min MHz:         400,0000
    BogoMIPS:            5376,00
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pa
                         t pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall 
                         nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_
                         good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq 
                         pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg f
                         ma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline
                         _timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid
                         _fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpri
                         ority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 er
                         ms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsave
                         opt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida 
                         arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req h
                         fi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdir
                         i movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_
                         capabilities
Virtualization features: 
  Virtualization:        VT-x
Caches (sum of all):     
  L1d:                   416 KiB (10 instances)
  L1i:                   448 KiB (10 instances)
  L2:                    9,5 MiB (7 instances)
  L3:                    24 MiB (1 instance)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-15
Vulnerabilities:         
  Gather data sampling:  Not affected
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Mmio stale data:       Not affected
  Retbleed:              Not affected
  Spec rstack overflow:  Not affected
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitiza
                         tion
  Spectre v2:            Mitigation; Enhanced / Automatic IBRS, IBPB conditional, RSB fil
                         ling, PBRSB-eIBRS SW sequence
  Srbds:                 Not affected
  Tsx async abort:       Not affected

@Acly
Copy link
Owner

Acly commented Feb 12, 2024

Hm, it looks perfectly fine. Not sure why the encoding matters, but you can check output of locale command to see what you are using.

@forest-hermit
Copy link
Author

locale output:

LANG=es_ES.UTF-8
LANGUAGE=es:en_US
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

@Acly
Copy link
Owner

Acly commented Feb 12, 2024

Looks okay also. Do you get the error also when running the server from the command line?

cd ~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server
venv/bin/python3 -s ComfyUI/main.py

the plugin uses following command to enforce UTF-8, maybe it's related

venv/bin/python3 -s -Xutf8 ComfyUI/main.py

@forest-hermit
Copy link
Author

It's weird because it worked well with the older versions

xxx@xxx:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/bin$ python3 -s ComfyUI/main.py
python3: can't open file '/home/xxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/bin/ComfyUI/main.py': [Errno 2] No such file or directory

@Acly
Copy link
Owner

Acly commented Feb 12, 2024

If you're inside venv/bin the relative location for ComfyUI would be ../../ComfyUI/main.py

Yes it's strange, but newer plugin versions also use a newer ComfyUI, and the import that is causing issues may have been added recently.

@xelaxefensor
Copy link

Hey,
Got the same issue on version 1.14.0.

Logs:

2024-02-12 20:24:04,275 INFO Total VRAM 7966 MB, total RAM 31952 MB
2024-02-12 20:24:04,275 INFO Set vram state to: NORMAL_VRAM
2024-02-12 20:24:04,275 INFO Device: cuda:0 NVIDIA GeForce RTX 3070 : cudaMallocAsync
2024-02-12 20:24:04,275 INFO VAE dtype: torch.bfloat16
2024-02-12 20:24:04,316 INFO Using pytorch cross attention
2024-02-12 20:24:05,156 INFO 
2024-02-12 20:24:05,156 ERROR Traceback (most recent call last):
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/main.py", line 76, in <module>
    import execution
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/execution.py", line 11, in <module>
    import nodes
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/nodes.py", line 21, in <module>
    import comfy.samplers
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/samplers.py", line 1, in <module>
    from .k_diffusion import sampling as k_diffusion_sampling
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/k_diffusion/sampling.py", line 3, in <module>
    from scipy import integrate
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/__init__.py", line 134, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/__init__.py", line 94, in <module>
    from ._quadrature import *
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/_quadrature.py", line 9, in <module>
    from scipy.special import roots_legendre
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/__init__.py", line 781, in <module>
    from ._support_alternative_backends import (
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/_support_alternative_backends.py", line 6, in <module>
    from scipy._lib._array_api import array_namespace, is_cupy, is_torch, is_numpy
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/_lib/_array_api.py", line 15, in <module>
    from numpy.testing import assert_
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/__init__.py", line 11, in <module>
    from ._private.utils import *
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1253, in <module>
    _SUPPORTS_SVE = check_support_sve()
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1247, in check_support_sve
    output = subprocess.run(cmd, capture_output=True, text=True)
  File "/usr/lib/python3.10/subprocess.py", line 505, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.10/subprocess.py", line 1154, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.10/subprocess.py", line 2059, in _communicate
    stdout = self._translate_newlines(stdout,
  File "/usr/lib/python3.10/subprocess.py", line 1031, in _translate_newlines
    data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 47: invalid continuation byte

Running it through command line, enforcing the encoding or not, returns this:

Total VRAM 7966 MB, total RAM 31952 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using pytorch cross attention
Traceback (most recent call last):
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/main.py", line 76, in <module>
    import execution
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/execution.py", line 11, in <module>
    import nodes
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/nodes.py", line 20, in <module>
    import comfy.diffusers_load
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/diffusers_load.py", line 3, in <module>
    import comfy.sd
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/sd.py", line 13, in <module>
    from . import model_detection
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/model_detection.py", line 1, in <module>
    import comfy.supported_models
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/supported_models.py", line 5, in <module>
    from . import sd1_clip
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/sd1_clip.py", line 3, in <module>
    from transformers import CLIPTokenizer
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/transformers/__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/transformers/dependency_versions_check.py", line 16, in <module>
    from .utils.versions import require_version, require_version_core
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/transformers/utils/__init__.py", line 20, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

@Acly
Copy link
Owner

Acly commented Feb 12, 2024

@SkeletoMukit it somehow didn't even get as far as the plugin log, so still unclear if -Xutf8 is a problem. Did you run with -s? I'm not sure why it can't find 'packaging' module now, even more confusing...

@xelaxefensor
Copy link

@Acly Yes, I ran it with -s, copy-pastet your code.

@Acly
Copy link
Owner

Acly commented Feb 13, 2024

You can also try without -s, maybe it will avoid the ModuleNotFound. If not try installing it with

venv/bin/python3 -m pip install packaging

Another thing to try would be setting system locale/language to english, see if it changes anything. I tried setting my ubuntu to spanish but still can't reproduce this error though.

@xelaxefensor
Copy link

xelaxefensor commented Feb 13, 2024

Fixed starting it from command line

Tried installing packaging as you said. Which returned this error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
matplotlib 3.8.2 requires pyparsing>=2.3.1, which is not installed.

So I installed it with venv/bin/python3 -m pip install pyparsing==2.3.1
Now I can start it from command line and connect to it in Krita. Tried generating an image and it works perfectly.

Starting it with the enforced encoding venv/bin/python3 -s -Xutf8 ComfyUI/main.py works too.

Starting it within Krita doesn't work. Outputs the same logs as before.

Whole terminal fix:

xela@xela-PC:~$ cd ~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 ComfyUI/main.py
Total VRAM 7966 MB, total RAM 31952 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using pytorch cross attention
Traceback (most recent call last):
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/main.py", line 76, in <module>
    import execution
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/execution.py", line 11, in <module>
    import nodes
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/nodes.py", line 20, in <module>
    import comfy.diffusers_load
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/diffusers_load.py", line 3, in <module>
    import comfy.sd
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/sd.py", line 13, in <module>
    from . import model_detection
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/model_detection.py", line 1, in <module>
    import comfy.supported_models
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/supported_models.py", line 5, in <module>
    from . import sd1_clip
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/sd1_clip.py", line 3, in <module>
    from transformers import CLIPTokenizer
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/transformers/__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/transformers/dependency_versions_check.py", line 16, in <module>
    from .utils.versions import require_version, require_version_core
  File "/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/transformers/utils/__init__.py", line 20, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 -m pip install packaging
Collecting packaging
  Downloading packaging-23.2-py3-none-any.whl (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 kB 1.9 MB/s eta 0:00:00
Installing collected packages: packaging
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
matplotlib 3.8.2 requires pyparsing>=2.3.1, which is not installed.
Successfully installed packaging-23.2

[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 -m pip install pyparsing
Collecting pyparsing
  Downloading pyparsing-3.1.1-py3-none-any.whl (103 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.1/103.1 kB 3.0 MB/s eta 0:00:00
Installing collected packages: pyparsing
Successfully installed pyparsing-3.1.1

[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 -m pip install pyparsing=2.3.1
ERROR: Invalid requirement: 'pyparsing=2.3.1'
Hint: = is not a valid operator. Did you mean == ?

[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 -m pip install pyparsing==2.3.1
Collecting pyparsing==2.3.1
  Downloading pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.8/61.8 kB 2.0 MB/s eta 0:00:00
Installing collected packages: pyparsing
  Attempting uninstall: pyparsing
    Found existing installation: pyparsing 3.1.1
    Uninstalling pyparsing-3.1.1:
      Successfully uninstalled pyparsing-3.1.1
Successfully installed pyparsing-2.3.1

[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 -m pip install packaging
Requirement already satisfied: packaging in ./venv/lib/python3.10/site-packages (23.2)

[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip
xela@xela-PC:~/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server$ venv/bin/python3 ComfyUI/main.py
Total VRAM 7966 MB, total RAM 31952 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using pytorch cross attention
****** User settings have been changed to be stored on the server instead of browser storage. ******
****** For multi-user setups add the --multi-user CLI argument to enable multiple user profiles. ******
[comfyui_controlnet_aux] | INFO -> Using ckpts path: /home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts
[comfyui_controlnet_aux] | INFO -> Using symlinks: False
[comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider']
Downloading: "https://download.pytorch.org/models/mobilenet_v2-b0353104.pth" to /home/xela/.cache/torch/hub/checkpoints/mobilenet_v2-b0353104.pth
/home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/dwpose.py:26: UserWarning: DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly
  warnings.warn("DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly")

Import times for custom nodes:
   0.0 seconds: /home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/comfyui-tooling-nodes
   0.0 seconds: /home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
   0.0 seconds: /home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/comfyui-inpaint-nodes
   0.0 seconds: /home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale
   3.2 seconds: /home/xela/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/custom_nodes/comfyui_controlnet_aux

Starting server

To see the GUI go to: http://127.0.0.1:8188

@Acly
Copy link
Owner

Acly commented Feb 13, 2024

Thanks for testing. I suspect it has something to do with the environment the server process is started from.

Which Linux are you using? And how did you install Krita?

It would be interesting if the AppImage version of Krita has the same issue. If you want to try, download from krita.org, run and set the same resource path (Settings > Configure Krita > General > Resources), maybe it picks it up automatically. That should allow it to access the plugin and test it.

@xelaxefensor
Copy link

I am using Linux Mint 21.3 Cinnamon with changed kernel to 6.5.0-17-generic.
Installed Krita 5.2.2 through Mint's GUI software manager as a Flatpak.

I tried installing the AppImage also version 5.2.2 and yes it works with the same resource path. :D
Very strange

Also tried granting the Flatpak version every permission i could in Flatseal(just a random thought) and it didn't change a thing.

@forest-hermit
Copy link
Author

age version of Krita has the same issue. If you want to try, download from krita.org, run and set the same resource path (Settings > Configure Krita > General > Resources), maybe it picks it up automatically. That should allow it to access the plugin and test it.

In my case I installed Krita with Flatpak, and this is my system:

Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.0-17-generic (64-bit)
Graphics Platform: X11
Processors: 16 × 12th Gen Intel® Core™ i7-12650H
Memory: 31.0 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 4060 Laptop GPU/PCIe/SSE2
Manufacturer: Acer
Product Name: Nitro AN515-58
System Version: V2.10

@Acly Acly added the linux Linux related label Feb 14, 2024
@Acly
Copy link
Owner

Acly commented Feb 15, 2024

I tried the Flatpak on my laptop (Fedora), but couldn't reproduce it there either.

I noticed that when installing the server from Flatpak-Krita, it will use a Python that comes from the Flatpak environment, not your system Python (not even sure if that's accessible at all). In my case the venv wasn't even usable outside the Flatpak context.

For now I can only recommend using the AppImage as a workaround. There are some other issues like #344 that probably don't have a solution because installing things from within a Flatpak app is kind of against its design.

@forest-hermit
Copy link
Author

Testing the latest version with a Krita flatpak:

2024-02-22 17:01:53,116 INFO Total VRAM 7940 MB, total RAM 31773 MB
2024-02-22 17:01:53,116 INFO Set vram state to: NORMAL_VRAM
2024-02-22 17:01:53,116 INFO Device: cuda:0 NVIDIA GeForce RTX 4060 Laptop GPU : cudaMallocAsync
2024-02-22 17:01:53,116 INFO VAE dtype: torch.bfloat16
2024-02-22 17:01:53,156 INFO Using pytorch cross attention
2024-02-22 17:01:53,876 INFO 
2024-02-22 17:01:53,877 ERROR Traceback (most recent call last):
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/main.py", line 76, in <module>
    import execution
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/execution.py", line 11, in <module>
    import nodes
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/nodes.py", line 21, in <module>
    import comfy.samplers
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/samplers.py", line 1, in <module>
    from .k_diffusion import sampling as k_diffusion_sampling
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/ComfyUI/comfy/k_diffusion/sampling.py", line 3, in <module>
    from scipy import integrate
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/__init__.py", line 134, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/__init__.py", line 94, in <module>
    from ._quadrature import *
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/integrate/_quadrature.py", line 9, in <module>
    from scipy.special import roots_legendre
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/__init__.py", line 781, in <module>
    from ._support_alternative_backends import (
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/special/_support_alternative_backends.py", line 6, in <module>
    from scipy._lib._array_api import array_namespace, is_cupy, is_torch, is_numpy
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/scipy/_lib/_array_api.py", line 15, in <module>
    from numpy.testing import assert_
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/__init__.py", line 11, in <module>
    from ._private.utils import *
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1253, in <module>
    _SUPPORTS_SVE = check_support_sve()
  File "/home/xxxx/.var/app/org.kde.krita/data/krita/pykrita/ai_diffusion/.server/venv/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1247, in check_support_sve
    output = subprocess.run(cmd, capture_output=True, text=True)
  File "/usr/lib/python3.10/subprocess.py", line 505, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.10/subprocess.py", line 1154, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.10/subprocess.py", line 2059, in _communicate
    stdout = self._translate_newlines(stdout,
  File "/usr/lib/python3.10/subprocess.py", line 1031, in _translate_newlines
    data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 62: invalid continuation byte

Testing it with Krita Appimage (not related with this bug report):

2024-02-22 17:05:11,852 INFO Extension initialized, Version: 1.14.1, Python: 3.10.7 (main, Nov 29 2023, 15:11:32) [GCC 11.4.0]
2024-02-22 17:05:12,624 INFO Connecting to http://127.0.0.1:8188
2024-02-22 17:05:20,369 INFO Installation started in /home/xxxx/.local/share/krita/pykrita/ai_diffusion/.server
2024-02-22 17:05:20,374 INFO Creating venv in /home/xxxx/.local/share/krita/pykrita/ai_diffusion/.server/venv
2024-02-22 17:05:20,374 INFO Executing /usr/bin/python3.11 -m venv venv
2024-02-22 17:05:20,498 INFO The virtual environment was not created successfully because ensurepip is not
2024-02-22 17:05:20,498 INFO available.  On Debian/Ubuntu systems, you need to install the python3-venv
2024-02-22 17:05:20,499 INFO package using the following command.
2024-02-22 17:05:20,499 INFO 
2024-02-22 17:05:20,499 INFO apt install python3.11-venv
2024-02-22 17:05:20,499 INFO 
2024-02-22 17:05:20,499 INFO You may need to use sudo with that command.  After installing the python3-venv
2024-02-22 17:05:20,499 INFO package, recreate your virtual environment.
2024-02-22 17:05:20,499 INFO 
2024-02-22 17:05:20,499 INFO Failing command: /home/xxxx/.local/share/krita/pykrita/ai_diffusion/.server/venv/bin/python3.11
2024-02-22 17:05:20,499 INFO 
2024-02-22 17:05:20,558 ERROR Error during installation: Process exited with code 1
Traceback (most recent call last):
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 264, in install
    await self._install(cb)
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 131, in _install
    await install_if_missing(python_dir, self._create_venv, cb)
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 562, in install_if_missing
    await try_install(path, installer, *args)
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 557, in try_install
    raise e
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 552, in try_install
    await installer(*args)
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 179, in _create_venv
    await _execute_process("Python", venv_cmd, self.path, cb)
  File "/home/xxxx/.local/share/krita/pykrita/ai_diffusion/server.py", line 546, in _execute_process
    raise Exception(f"Error during installation: {errlog}")
Exception: Error during installation: Process exited with code 1
2024-02-22 17:05:20,559 ERROR Installation failed

@Acly
Copy link
Owner

Acly commented Feb 24, 2024

Yes I tried to clear the environment of outside influence for flatpak, but it didn't help (I also didn't have much hope that it would).

The AppImage should work if you apt install python3.11-venv

@forest-hermit
Copy link
Author

Yes I tried to clear the environment of outside influence for flatpak, but it didn't help (I also didn't have much hope that it would).

The AppImage should work if you apt install python3.11-venv

Thanks now I could use it via Appimage meanwhile the Flatpak one is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Linux related
Projects
None yet
Development

No branches or pull requests

3 participants