[GH-ISSUE #5] cannot import name '_C' from partially initialized module 'comfy_kitchen.backends.cuda #2

Open
opened 2026-10-26 22:18:59 +00:00 by bsakaguchi · 13 comments
Owner

Originally created by @lyh111901886 on GitHub (Jan 6, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/5

Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': "cannot import name '_C' from partially initialized module 'comfy_kitchen.backends.cuda' (most likely due to a circular import) (E:\AI\ComfyUI_Mie_V7.0\python_embeded\Lib\site-packages\comfy_kitchen\backends\cuda\init.py)", 'capabilities': []}

Originally created by @lyh111901886 on GitHub (Jan 6, 2026). Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/5 Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': "cannot import name '_C' from partially initialized module 'comfy_kitchen.backends.cuda' (most likely due to a circular import) (E:\\AI\\ComfyUI_Mie_V7.0\\python_embeded\\Lib\\site-packages\\comfy_kitchen\\backends\\cuda\\__init__.py)", 'capabilities': []}
Author
Owner

@contentis commented on GitHub (Jan 6, 2026):

Could you try installing comfy-kitchen[cublas]?

<!-- gh-comment-id:3714277409 --> @contentis commented on GitHub (Jan 6, 2026): Could you try installing comfy-kitchen[cublas]?
Author
Owner

@ailthrim commented on GitHub (Jan 6, 2026):

Could you try installing comfy-kitchen[cublas]?

That didn't solve it for me. Renaming the _C.abi3.pyd file doesn't fix it either.

Same exact error.

Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': "cannot import name '_C' from partially initialized module 'comfy_kitchen.backends.cuda' (most likely due to a circular import) (C:\\ComfyUI\\python_embeded\\Lib\\site-packages\\comfy_kitchen\\backends\\cuda\\__init__.py)", 'capabilities': []}
Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}
<!-- gh-comment-id:3714324973 --> @ailthrim commented on GitHub (Jan 6, 2026): > Could you try installing comfy-kitchen[cublas]? That didn't solve it for me. Renaming the _C.abi3.pyd file doesn't fix it either. Same exact error. ``` Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']} Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': "cannot import name '_C' from partially initialized module 'comfy_kitchen.backends.cuda' (most likely due to a circular import) (C:\\ComfyUI\\python_embeded\\Lib\\site-packages\\comfy_kitchen\\backends\\cuda\\__init__.py)", 'capabilities': []} Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']} ```
Author
Owner

@contentis commented on GitHub (Jan 6, 2026):

Could you share:

  • python version
  • torch + cuda version
  • GPU
<!-- gh-comment-id:3714376377 --> @contentis commented on GitHub (Jan 6, 2026): Could you share: - python version - torch + cuda version - GPU
Author
Owner

@patientx commented on GitHub (Jan 6, 2026):

same thing here and I have and amd gpu using rocm. Hopefully this whole thing isn't nvidia centered and if that is so all the models comfy would support in the future also won't use this as base since we can already use / load / generate 99% of the models with base comfy setup with our amd gpus.

<!-- gh-comment-id:3714402976 --> @patientx commented on GitHub (Jan 6, 2026): same thing here and I have and amd gpu using rocm. Hopefully this whole thing isn't nvidia centered and if that is so all the models comfy would support in the future also won't use this as base since we can already use / load / generate 99% of the models with base comfy setup with our amd gpus.
Author
Owner

@contentis commented on GitHub (Jan 6, 2026):

same thing here and I have and amd gpu using rocm. Hopefully this whole thing isn't nvidia centered and if that is so all the models comfy would support in the future also won't use this as base since we can already use / load / generate 99% of the models with base comfy setup with our amd gpus.

You'll not be able to run CUDA compiled code on AMD. But this shouldn't be an issue - if a backend is not available (e.g. CUDA) it'll fallback in order CUDA->Triton->Eager by default. You can also set the priority manually and or disbale backends. It should not break any compatability - with the worst case being fallback to the torch-eager / default behaviour.

<!-- gh-comment-id:3714420733 --> @contentis commented on GitHub (Jan 6, 2026): > same thing here and I have and amd gpu using rocm. Hopefully this whole thing isn't nvidia centered and if that is so all the models comfy would support in the future also won't use this as base since we can already use / load / generate 99% of the models with base comfy setup with our amd gpus. You'll not be able to run CUDA compiled code on AMD. But this shouldn't be an issue - if a backend is not available (e.g. CUDA) it'll fallback in order CUDA->Triton->Eager by default. You can also set the priority manually and or disbale backends. It should not break any compatability - with the worst case being fallback to the torch-eager / default behaviour.
Author
Owner

@ailthrim commented on GitHub (Jan 6, 2026):

Could you share:

  • python version
  • torch + cuda version
  • GPU

Absolutely.

  • Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)]
  • PyTorch: 2.9.1+cu130
  • GPU: RTX 4070 Ti 12 GB (SM89)

Also, I compiled comfy-kitchen from source using CUDA 13.0 Toolkit and it built fine, but same issue related to "import _C".

<!-- gh-comment-id:3714720475 --> @ailthrim commented on GitHub (Jan 6, 2026): > Could you share: > > * python version > * torch + cuda version > * GPU Absolutely. - Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)] - PyTorch: 2.9.1+cu130 - GPU: RTX 4070 Ti 12 GB (SM89) Also, I compiled comfy-kitchen from source using CUDA 13.0 Toolkit and it built fine, but same issue related to "import _C".
Author
Owner

@twri commented on GitHub (Jan 6, 2026):

Probably same issue as #4.

<!-- gh-comment-id:3714940906 --> @twri commented on GitHub (Jan 6, 2026): Probably same issue as #4.
Author
Owner

@contentis commented on GitHub (Jan 6, 2026):

Could you share:

  • python version
  • torch + cuda version
  • GPU

Absolutely.

  • Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)]
  • PyTorch: 2.9.1+cu130
  • GPU: RTX 4070 Ti 12 GB (SM89)

Also, I compiled comfy-kitchen from source using CUDA 13.0 Toolkit and it built fine, but same issue related to "import _C".

Could you try using this and see if it fixes the issue: https://github.com/Comfy-Org/comfy-kitchen/pull/8
You can also just replace the cuda/init.py to test in your current install.

<!-- gh-comment-id:3715031022 --> @contentis commented on GitHub (Jan 6, 2026): > > Could you share: > > > > * python version > > * torch + cuda version > > * GPU > > Absolutely. > > * Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)] > * PyTorch: 2.9.1+cu130 > * GPU: RTX 4070 Ti 12 GB (SM89) > > Also, I compiled comfy-kitchen from source using CUDA 13.0 Toolkit and it built fine, but same issue related to "import _C". Could you try using this and see if it fixes the issue: https://github.com/Comfy-Org/comfy-kitchen/pull/8 You can also just replace the cuda/__init__.py to test in your current install.
Author
Owner

@tuolaku commented on GitHub (Jan 6, 2026):

the same issue.

Python 3.13.9
PyTorch:2.9.1+cu130
显卡:RTX 5090D(SM120)

<!-- gh-comment-id:3715339213 --> @tuolaku commented on GitHub (Jan 6, 2026): the same issue. Python 3.13.9 PyTorch:2.9.1+cu130 显卡:RTX 5090D(SM120)
Author
Owner

@brendanwallison commented on GitHub (Jan 6, 2026):

I was getting this error. After using the most recent hotfix, the error shifted.

Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': 'DLL load failed while importing _C: The specified module could not be found.', 'capabilities': []}

Python version: 3.13.5
pytorch version: 2.9.1+cu130
ComfyUI version: 0.7.0
GPU: RTX 3090

<!-- gh-comment-id:3716216424 --> @brendanwallison commented on GitHub (Jan 6, 2026): I was getting this error. After using the most recent hotfix, the error shifted. Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': 'DLL load failed while importing _C: The specified module could not be found.', 'capabilities': []} Python version: 3.13.5 pytorch version: 2.9.1+cu130 ComfyUI version: 0.7.0 GPU: RTX 3090
Author
Owner

@contentis commented on GitHub (Jan 6, 2026):

I was getting this error. After using the most recent hotfix, the error shifted.

Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': 'DLL load failed while importing _C: The specified module could not be found.', 'capabilities': []}

Python version: 3.13.5
pytorch version: 2.9.1+cu130
ComfyUI version: 0.7.0
GPU: RTX 3090

Can you check if cublas is installed using pip freeze?

<!-- gh-comment-id:3716364525 --> @contentis commented on GitHub (Jan 6, 2026): > I was getting this error. After using the most recent hotfix, the error shifted. > > Found comfy_kitchen backend cuda: {'available': False, 'disabled': False, 'unavailable_reason': 'DLL load failed while importing _C: The specified module could not be found.', 'capabilities': []} > > Python version: 3.13.5 > pytorch version: 2.9.1+cu130 > ComfyUI version: 0.7.0 > GPU: RTX 3090 Can you check if cublas is installed using pip freeze?
Author
Owner

@Vanlams commented on GitHub (Jan 7, 2026):

Found comfy_kitchen backend cuda: {'available': False, 'disabled': True, 'unavailable_reason': 'DLL load failed while importing _C: 找不到指定的模块。', 'capabilities': []}

How can I solve this problem? I compiled comfy_kitchen, but it still doesn't work. Even after upgrading comfy_kitchen to 0.2.3, the problem persists.

Checkpoint files will always be loaded safely.
Total VRAM 24576 MB, total RAM 65457 MB
pytorch version: 2.9.1+cu128
xformers version: 0.0.33.post2
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
Using async weight offloading with 2 streams
Enabled pinned memory 29455.0
working around nvidia conv3d memory bug.
Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}
Found comfy_kitchen backend cuda: {'available': False, 'disabled': True, 'unavailable_reason': 'DLL load failed while importing _C: 找不到指定的模块。', 'capabilities': []}
Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
Using xformers attention
Python version: 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)]
ComfyUI version: 0.7.0
ComfyUI frontend version: 1.35.9
[Prompt Server] web root: E:\Stable-Diffusion\ComfyUI\python_embeded\Lib\site-packages\comfyui_frontend_package\static
Total VRAM 24576 MB, total RAM 65457 MB
pytorch version: 2.9.1+cu128
xformers version: 0.0.33.post2
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
Using async weight offloading with 2 streams
Enabled pinned memory 29455.0

<!-- gh-comment-id:3717580598 --> @Vanlams commented on GitHub (Jan 7, 2026): **Found comfy_kitchen backend cuda: {'available': False, 'disabled': True, 'unavailable_reason': 'DLL load failed while importing _C: 找不到指定的模块。', 'capabilities': []}** ### How can I solve this problem? I compiled comfy_kitchen, but it still doesn't work. Even after upgrading comfy_kitchen to 0.2.3, the problem persists. Checkpoint files will always be loaded safely. Total VRAM 24576 MB, total RAM 65457 MB pytorch version: 2.9.1+cu128 xformers version: 0.0.33.post2 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync Using async weight offloading with 2 streams Enabled pinned memory 29455.0 working around nvidia conv3d memory bug. Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']} Found comfy_kitchen backend cuda: {'available': False, 'disabled': True, 'unavailable_reason': 'DLL load failed while importing _C: 找不到指定的模块。', 'capabilities': []} Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']} Using xformers attention Python version: 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] ComfyUI version: 0.7.0 ComfyUI frontend version: 1.35.9 [Prompt Server] web root: E:\Stable-Diffusion\ComfyUI\python_embeded\Lib\site-packages\comfyui_frontend_package\static Total VRAM 24576 MB, total RAM 65457 MB pytorch version: 2.9.1+cu128 xformers version: 0.0.33.post2 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync Using async weight offloading with 2 streams Enabled pinned memory 29455.0
Author
Owner

@ailthrim commented on GitHub (Jan 7, 2026):

Could you share:

  • python version
  • torch + cuda version
  • GPU

Absolutely.

  • Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)]
  • PyTorch: 2.9.1+cu130
  • GPU: RTX 4070 Ti 12 GB (SM89)

Also, I compiled comfy-kitchen from source using CUDA 13.0 Toolkit and it built fine, but same issue related to "import _C".

Could you try using this and see if it fixes the issue: #8 You can also just replace the cuda/init.py to test in your current install.

I updated to the latest version of comfy-kitchen 0.2.3, built from source. It appears to be working properly now. Have yet to actually test the fp8 performance however. Thanks. Also, pytest PASSED essentially every test except for 8 but that's because my 4070 Ti doesn't support nvfp4. All good!

Found comfy_kitchen backend triton: {'available': True, 'disabled': True,
 'unavailable_reason': None,
 'capabilities': ['apply_rope', 'apply_rope1',
 'dequantize_nvfp4', 'dequantize_per_tensor_fp8',
 'quantize_nvfp4', 'quantize_per_tensor_fp8']}  

Found comfy_kitchen backend eager: {'available': True, 'disabled': False,
 'unavailable_reason': None,
 'capabilities': ['apply_rope', 'apply_rope1',
 'dequantize_nvfp4', 'dequantize_per_tensor_fp8',
 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}  

Found comfy_kitchen backend cuda: {'available': True, 'disabled': False,
 'unavailable_reason': None,
 'capabilities': ['apply_rope', 'apply_rope1',
 'dequantize_nvfp4', 'dequantize_per_tensor_fp8',
 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}
<!-- gh-comment-id:3717769944 --> @ailthrim commented on GitHub (Jan 7, 2026): > > > Could you share: > > > > > > * python version > > > * torch + cuda version > > > * GPU > > > > > > Absolutely. > > > > * Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)] > > * PyTorch: 2.9.1+cu130 > > * GPU: RTX 4070 Ti 12 GB (SM89) > > > > Also, I compiled comfy-kitchen from source using CUDA 13.0 Toolkit and it built fine, but same issue related to "import _C". > > Could you try using this and see if it fixes the issue: [#8](https://github.com/Comfy-Org/comfy-kitchen/pull/8) You can also just replace the cuda/**init**.py to test in your current install. I updated to the latest version of comfy-kitchen 0.2.3, built from source. It appears to be working properly now. Have yet to actually test the fp8 performance however. Thanks. Also, pytest PASSED essentially every test except for 8 but that's because my 4070 Ti doesn't support nvfp4. All good! ``` Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']} Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']} Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']} ```
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-kitchen#2
No description provided.