diffusers 安装

Python3.8

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

目录

使用报错:cannot import name 'FluxControlNetPipeline' from 'diffusers'

解决方法:

pshuman 依赖版本:

cuda12.2版本不兼容;

方案一:安装支持 CUDA 12.x 的预编译版本

安装了cuda11.8版本

方案二:从源码编译(确保已安装正确版本的 CUDA 工具链)

方案三:使用兼容性更好的分支版本

3. 环境修复步骤

确保 CUDA 路径正确

验证安装bitsandbytes

用的方法1 继续报错:


pip install -r ./requirements.txt -i https://mirrors.ivolces.com/pypi/simple/

使用报错:cannot import name 'FluxControlNetPipeline' from 'diffusers'

解决方法:

pip install diffusers -U -i https://pypi.tuna.tsinghua.edu.cn/simple

pshuman 依赖版本:

pip install diffusers==0.27.2

cuda12.2版本不兼容;

python -c "from diffusers import ConfigMixin, ModelMixin"

报错:

Multiple distributions found for package optimum. Picked distribution: optimum

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please run

python -m bitsandbytes

 and submit this information together with your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
================================================================================
bin /nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda122_nocublaslt.so
False
/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: /nas/lbg/envs/comfyui did not contain ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] as expected! Searching further paths...
  warn(msg)
CUDA SETUP: CUDA runtime path found: /usr/local/cuda/lib64/libcudart.so
CUDA SETUP: Highest compute capability among GPUs detected: 7.0
CUDA SETUP: Detected CUDA version 122
/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: WARNING: Compute capability < 7.5 detected! Only slow 8-bit matmul is supported for your GPU!
  warn(msg)
CUDA SETUP: Required library version not found: libbitsandbytes_cuda122_nocublaslt.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes_cpu.so...

================================================ERROR=====================================
CUDA SETUP: CUDA detection failed! Possible reasons:
1. CUDA driver not installed
2. CUDA not installed
3. You have multiple conflicting CUDA libraries
4. Required library not pre-compiled for this bitsandbytes release!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
CUDA SETUP: The CUDA version for the compile might depend on your conda install. Inspect CUDA version via `conda list | grep cuda`.
================================================================================

CUDA SETUP: Something unexpected happened. Please compile from source:
git clone git@github.com:TimDettmers/bitsandbytes.git
cd bitsandbytes
CUDA_VERSION=122_nomatmul
python setup.py install
CUDA SETUP: Setup Failed!
Traceback (most recent call last):
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 883, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/nas/lbg/envs/comfyui/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/models/modeling_utils.py", line 40, in <module>
    from ..quantizers import DiffusersAutoQuantizer, DiffusersQuantizer
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/quantizers/__init__.py", line 19, in <module>
    from .auto import DiffusersAutoQuantizer
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/quantizers/auto.py", line 22, in <module>
    from .bitsandbytes import BnB4BitDiffusersQuantizer, BnB8BitDiffusersQuantizer
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/quantizers/bitsandbytes/__init__.py", line 2, in <module>
    from .utils import dequantize_and_replace, dequantize_bnb_weight, replace_with_bnb_linear
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/quantizers/bitsandbytes/utils.py", line 32, in <module>
    import bitsandbytes as bnb
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/__init__.py", line 6, in <module>
    from . import cuda_setup, utils, research
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/research/__init__.py", line 1, in <module>
    from . import nn
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/research/nn/__init__.py", line 1, in <module>
    from .modules import LinearFP8Mixed, LinearFP8Global
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/research/nn/modules.py", line 8, in <module>
    from bitsandbytes.optim import GlobalOptimManager
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/optim/__init__.py", line 6, in <module>
    from bitsandbytes.cextension import COMPILED_WITH_CUDA
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 20, in <module>
    raise RuntimeError('''
RuntimeError: 
        CUDA Setup failed despite GPU being available. Please run the following command to get more information:

        python -m bitsandbytes

        Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
        to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
        and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 874, in __getattr__
    value = getattr(module, name)
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 873, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 885, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.models.modeling_utils because of the following error (look up to see its traceback):

        CUDA Setup failed despite GPU being available. Please run the following command to get more information:

        python -m bitsandbytes

        Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
        to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
        and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues

方案一:安装支持 CUDA 12.x 的预编译版本

pip uninstall bitsandbytes -y
pip install git+https://github.com/TimDettmers/bitsandbytes.git@main
pip install git+https://github.com/TimDettmers/bitsandbytes.git

可以安装,但是继续报错,

安装了cuda11.8版本

cuda安装 含cudnn conda 2025_conda安装cuda-CSDN博客

方案二:从源码编译(确保已安装正确版本的 CUDA 工具链)

git clone https://github.com/TimDettmers/bitsandbytes.git
cd bitsandbytes
CUDA_VERSION=122 make cuda12x
python setup.py install

方案三:使用兼容性更好的分支版本

pip install https://github.com/jllllll/bitsandbytes-rocm/releases/download/0.41.1/bitsandbytes-0.41.1-py3-none-any.whl

3. 环境修复步骤

确保 CUDA 路径正确

export CUDA_HOME=/usr/local/cuda-12.2
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export PATH=$CUDA_HOME/bin:$PATH

验证安装bitsandbytes

python -c "import bitsandbytes; print(bitsandbytes.__version__)"
用的方法1 继续报错:

bitsandbytes library load error: Configured CUDA binary not found at /nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda124.so
 If you are using Intel CPU/XPU, please install intel_extension_for_pytorch to enable required ops
Traceback (most recent call last):
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 318, in <module>
    lib = get_native_library()
  File "/nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 282, in get_native_library
    raise RuntimeError(f"Configured {BNB_BACKEND} binary not found at {cuda_binary_path}")
RuntimeError: Configured CUDA binary not found at /nas/lbg/envs/comfyui/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda124.so

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI算法网奇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值