nunchaku icon indicating copy to clipboard operation
nunchaku copied to clipboard

[Bug] ImportError: DLL load failed while importing _C, what might cause this error

Open deepfree2023 opened this issue 8 months ago • 1 comments

Checklist

  • [x] 1. I have searched for related issues and FAQs (https://github.com/mit-han-lab/nunchaku/discussions/262) but was unable to find a solution.
  • [x] 2. The issue persists in the latest version.
  • [x] 3. Please note that without environment information and a minimal reproducible example, it will be difficult for us to reproduce and address the issue, which may delay our response.
  • [x] 4. If your report is a question rather than a bug, please submit it as a discussion at https://github.com/mit-han-lab/nunchaku/discussions/new/choose. Otherwise, this issue will be closed.
  • [x] 5. If this is related to ComfyUI, please report it at https://github.com/mit-han-lab/ComfyUI-nunchaku/issues.
  • [x] 6. I will do my best to describe the issue in English.

Describe the Bug

Traceback (most recent call last): File "K:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2153, in load_custom_node module_spec.loader.exec_module(module) File "", line 940, in exec_module File "", line 241, in call_with_frames_removed File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-nunchaku_init.py", line 2, in from .nodes.lora import NunchakuFluxLoraLoader File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-nunchaku\nodes\lora_init_.py", line 1, in from .flux import NunchakuFluxLoraLoader File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-nunchaku\nodes\lora\flux.py", line 5, in from nunchaku.lora.flux import to_diffusers File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\nunchaku_init_.py", line 1, in from .models import NunchakuFluxTransformer2dModel, NunchakuSanaTransformer2DModel, NunchakuT5EncoderModel File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\nunchaku\models_init_.py", line 1, in from .text_encoders.t5_encoder import NunchakuT5EncoderModel File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\nunchaku\models\text_encoders\t5_encoder.py", line 9, in from .linear import W4Linear File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\nunchaku\models\text_encoders\linear.py", line 8, in from ..._C.ops import gemm_awq, gemv_awq ImportError: DLL load failed while importing _C: 找不到指定的程序。

Environment

win10, python 3.11, 2.8.0.dev20250414+cu126, cuda 12.6

Reproduction Steps

run run_nvidia_gpu.bat for comfyui

deepfree2023 avatar Apr 15 '25 20:04 deepfree2023

Likely an incompatible rotch version. In my case using a different version of torch and torcvision helped (but I'm using torch 2.8 nightly)

aoleg avatar Apr 15 '25 23:04 aoleg

Likely an incompatible rotch version. In my case using a different version of torch and torcvision helped (but I'm using torch 2.8 nightly)

Thanks, I'm using torch 2.8 nightly too, and updated it to the recent version. Nunchaku is OK with older torch 2.8 nightly version(0405 e.g.), but recent HiDreamSampler reports error with older torch 2.8 nightly.

deepfree2023 avatar Apr 16 '25 05:04 deepfree2023

Move to previous version of torch totally helps, thanks!

🚀 here wheels for my setup

python -m pip install "https://download.pytorch.org/whl/nightly/cu128/torch-2.8.0.dev20250405%2Bcu128-cp312-cp312-win_amd64.whl" "https://download.pytorch.org/whl/nightly/cu128/torchvision-0.22.0.dev20250406%2Bcu128-cp312-cp312-win_amd64.whl"

you can find your wheels here.

qanelph avatar Apr 16 '25 07:04 qanelph

Move to previous version of torch totally helps, thanks!

🚀 here wheels for my setup

python -m pip install "https://download.pytorch.org/whl/nightly/cu128/torch-2.8.0.dev20250405%2Bcu128-cp312-cp312-win_amd64.whl" "https://download.pytorch.org/whl/nightly/cu128/torchvision-0.22.0.dev20250406%2Bcu128-cp312-cp312-win_amd64.whl"

you can find your wheels here.

Thank you, your method is very effective. The current NVIDIA drivers are not stable.

Wangyue787 avatar Apr 20 '25 10:04 Wangyue787

Getting the same error on win11 with a blackwell gpu. Environment has:

python version: 3.13.2 torch version: 2.8.0.dev20250419+cu128 cuda version (torch): 12.8 torchvision version: 0.22.0.dev20250420+cu128 transformers version: 4.51.3 diffusers version: 0.33.1 accelerate version: 1.6.0 protobuf version: 6.30.2 sentencepiece version: 0.2.0 huggingface_hub version: 0.30.2

Installed nunchaku from nunchaku-0.2.0+torch2.8-cp313-cp313-win_amd64.whl Should be working, right?

EDIT: I even built it following the instructions. The build completed and installed without any issue, but the problem remains.

"ImportError: DLL load failed while importing _C: The specified procedure could not be found."

merc4derp avatar Apr 21 '25 11:04 merc4derp

Our Torch 2.8 wheels are not compatible with your current installation because Torch 2.8 is a nightly build that changes frequently. In this case, we recommend compiling Nunchaku from source.

To help you with the process, we’ve provided step-by-step tutorial videos in both English and Chinese.

You can also follow the corresponding text guide in our documentation: docs/setup_windows.md.

lmxyy avatar Apr 25 '25 19:04 lmxyy