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

FileNotFoundError: Could not find module 'C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.dll' #1524

Closed
nitinmukesh opened this issue Feb 19, 2025 · 1 comment

Comments

@nitinmukesh
Copy link

System Info

  • 🤗 Diffusers version: 0.33.0.dev0
  • Platform: Windows-10-10.0.26100-SP0
  • Running on Google Colab?: No
  • Python version: 3.10.11
  • PyTorch version (GPU?): 2.5.1+cu124 (True)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Huggingface_hub version: 0.28.1
  • Transformers version: 4.46.3
  • Accelerate version: 1.4.0.dev0
  • PEFT version: not installed
  • Bitsandbytes version: 0.45.3.dev0
  • Safetensors version: 0.5.2
  • xFormers version: 0.0.29.post1
  • Accelerator: NVIDIA GeForce RTX 4060 Laptop GPU, 8188 MiB
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Reproduction

Install from source and try to use 4bit quantized model in pipeline.

No error during installation

(venv) C:\aitest\SkyReels-V1>pip install git+https://github.com/bitsandbytes-foundation/bitsandbytes.git
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting git+https://github.com/bitsandbytes-foundation/bitsandbytes.git
  Cloning https://github.com/bitsandbytes-foundation/bitsandbytes.git to c:\users\nitin\appdata\local\temp\pip-req-build-jzb_2yk5
  Running command git clone --filter=blob:none --quiet https://github.com/bitsandbytes-foundation/bitsandbytes.git 'C:\Users\nitin\AppData\Local\Temp\pip-req-build-jzb_2yk5'
  Resolved https://github.com/bitsandbytes-foundation/bitsandbytes.git to commit 8ed7d97b4901b4f01f9ac04262e3a34d1cb6941a
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.17 in c:\aitest\skyreels-v1\venv\lib\site-packages (from bitsandbytes==0.45.3.dev0) (2.2.3)
Requirement already satisfied: torch<3,>=2.0 in c:\aitest\skyreels-v1\venv\lib\site-packages (from bitsandbytes==0.45.3.dev0) (2.5.1+cu124)
Requirement already satisfied: sympy==1.13.1 in c:\aitest\skyreels-v1\venv\lib\site-packages (from torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (1.13.1)
Requirement already satisfied: filelock in c:\aitest\skyreels-v1\venv\lib\site-packages (from torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (3.17.0)
Requirement already satisfied: fsspec in c:\aitest\skyreels-v1\venv\lib\site-packages (from torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (2025.2.0)
Requirement already satisfied: networkx in c:\aitest\skyreels-v1\venv\lib\site-packages (from torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (3.4.2)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\aitest\skyreels-v1\venv\lib\site-packages (from torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (4.12.2)
Requirement already satisfied: jinja2 in c:\aitest\skyreels-v1\venv\lib\site-packages (from torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (3.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\aitest\skyreels-v1\venv\lib\site-packages (from sympy==1.13.1->torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (1.3.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\aitest\skyreels-v1\venv\lib\site-packages (from jinja2->torch<3,>=2.0->bitsandbytes==0.45.3.dev0) (3.0.2)
Building wheels for collected packages: bitsandbytes
  Building wheel for bitsandbytes (pyproject.toml) ... done
  Created wheel for bitsandbytes: filename=bitsandbytes-0.45.3.dev0-cp310-cp310-win_amd64.whl size=91196 sha256=672a2973985d8d79b25c2a6837137def6b26697651d17e2969666f73e0b8aebd
  Stored in directory: C:\Users\nitin\AppData\Local\Temp\pip-ephem-wheel-cache-dbo1kxgu\wheels\8d\f8\a6\09a9f480857782e6d6243392c70f34f7d26994e37dd03e8834
Successfully built bitsandbytes
Installing collected packages: bitsandbytes
  Attempting uninstall: bitsandbytes
    Found existing installation: bitsandbytes 0.45.0
    Uninstalling bitsandbytes-0.45.0:
      Successfully uninstalled bitsandbytes-0.45.0
Successfully installed bitsandbytes-0.45.3.dev0

(venv) C:\aitest\SkyReels-V1>python hunyuan_bug.py
Could not find the bitsandbytes CUDA binary at WindowsPath('C:/aitest/SkyReels-V1/venv/lib/site-packages/bitsandbytes/libbitsandbytes_cuda124.dll')
Could not load bitsandbytes native library: Could not find module 'C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Traceback (most recent call last):
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\cextension.py", line 85, in <module>
    lib = get_native_library()
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\cextension.py", line 72, in get_native_library
    dll = ct.cdll.LoadLibrary(str(binary_path))
  File "C:\Program Files\Python310\lib\ctypes\__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "C:\Program Files\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.dll' (or one of its dependencies). Try using the full path with constructor syntax.

CUDA Setup failed despite CUDA 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/bitsandbytes-foundation/bitsandbytes/issues

Expected behavior

Installing pre-built wheel of earlier version works fine but from source not working.

@nitinmukesh
Copy link
Author

(venv) C:\aitest\SkyReels-V1>python -m bitsandbytes
Could not find the bitsandbytes CUDA binary at WindowsPath('C:/aitest/SkyReels-V1/venv/lib/site-packages/bitsandbytes/libbitsandbytes_cuda124.dll')
Could not load bitsandbytes native library: Could not find module 'C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Traceback (most recent call last):
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\cextension.py", line 85, in <module>
    lib = get_native_library()
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\cextension.py", line 72, in get_native_library
    dll = ct.cdll.LoadLibrary(str(binary_path))
  File "C:\Program Files\Python310\lib\ctypes\__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "C:\Program Files\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.dll' (or one of its dependencies). Try using the full path with constructor syntax.

CUDA Setup failed despite CUDA 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/bitsandbytes-foundation/bitsandbytes/issues

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++ BUG REPORT INFORMATION ++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++
CUDA specs: CUDASpecs(highest_compute_capability=(8, 9), cuda_version_string='124', cuda_version_tuple=(12, 4))
PyTorch settings found: CUDA_VERSION=124, Highest Compute Capability: (8, 9).
Library not found: C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda124.dll. Maybe you need to compile it from source?
If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION`,
for example, `make CUDA_VERSION=113`.

The CUDA version for the compile might depend on your conda install, if using conda.
Inspect CUDA version via `conda list | grep cuda`.
To manually override the PyTorch CUDA version please see: https://github.com/TimDettmers/bitsandbytes/blob/main/docs/source/nonpytorchcuda.mdx
The directory listed in your path is found to be non-existent: \NITS
The directory listed in your path is found to be non-existent: C:\Users\nitin\miniconda3\Library\mingw-w64\bin
The directory listed in your path is found to be non-existent: C:\Users\nitin\miniconda3\Library\usr\bin
The directory listed in your path is found to be non-existent: C:\Users\nitin\AppData\Roaming\Python\Python311\Scripts
The directory listed in your path is found to be non-existent: C:\Users\nitin\.dotnet\tools
The directory listed in your path is found to be non-existent: C:\Program Files (x86)\GnuWin32\bin
The directory listed in your path is found to be non-existent: C:\Users\nitin\AppData\Local\Programs\Ollama
Found duplicate CUDA runtime files (see below).

We select the PyTorch default CUDA runtime, which is 12.4,
but this might mismatch with the CUDA version that is needed for bitsandbytes.
To override this behavior set the `BNB_CUDA_VERSION=<version string, e.g. 122>` environmental variable.

For example, if you want to use the CUDA version 122,
    BNB_CUDA_VERSION=122 python ...

OR set the environmental variable in your .bashrc:
    export BNB_CUDA_VERSION=122

In the case of a manual override, make sure you set LD_LIBRARY_PATH, e.g.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.2,
* Found CUDA runtime at: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin\cudart64_12.dll
* Found CUDA runtime at: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\cudart64_12.dll
* Found CUDA runtime at: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\cudart64_110.dll
* Found CUDA runtime at: C:\Windows\system32\nvcuda.dll
* Found CUDA runtime at: C:\Windows\system32\nvcudadebugger.dll
* Found CUDA runtime at: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\cudart64_65.dll
* Found CUDA runtime at: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\cudart64_12.dll
* Found CUDA runtime at: C:\WINDOWS\system32\nvcuda.dll
* Found CUDA runtime at: C:\WINDOWS\system32\nvcudadebugger.dll
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++ DEBUG INFO END ++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Checking that the library is importable and CUDA is callable...
Couldn't load the bitsandbytes library, likely due to missing binaries.
Please ensure bitsandbytes is properly installed.

For source installations, compile the binaries with `cmake -DCOMPUTE_BACKEND=cuda -S .`.
See the documentation for more details if needed.

Trying a simple check anyway, but this will likely fail...
Traceback (most recent call last):
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\diagnostics\main.py", line 66, in main
    sanity_check()
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\diagnostics\main.py", line 40, in sanity_check
    adam.step()
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\torch\optim\optimizer.py", line 487, in wrapper
    out = func(*args, **kwargs)
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\optim\optimizer.py", line 291, in step
    self.update_step(group, p, gindex, pindex)
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\optim\optimizer.py", line 521, in update_step
    F.optimizer_update_32bit(
  File "C:\aitest\SkyReels-V1\venv\lib\site-packages\bitsandbytes\functional.py", line 1571, in optimizer_update_32bit
    optim_func = str2optimizer32bit[optimizer_name][0]
NameError: name 'str2optimizer32bit' is not defined
Above we output some debug information.
Please provide this info when creating an issue via https://github.com/TimDettmers/bitsandbytes/issues/new/choose
WARNING: Please be sure to sanitize sensitive info from the output before posting it.

(venv) C:\aitest\SkyReels-V1>pip list
Package            Version
------------------ ------------
accelerate         1.4.0.dev0
bitsandbytes       0.45.3.dev0
certifi            2025.1.31
charset-normalizer 3.4.1
colorama           0.4.6
diffusers          0.33.0.dev0
filelock           3.17.0
fsspec             2025.2.0
huggingface-hub    0.28.1
idna               3.10
imageio            2.36.1
imageio-ffmpeg     0.5.1
importlib_metadata 8.6.1
Jinja2             3.1.5
MarkupSafe         3.0.2
mpmath             1.3.0
networkx           3.4.2
ninja              1.11.1.3
numpy              2.2.3
nvtx               0.2.10
opencv-python      4.10.0.84
optimum            1.24.0
optimum-quanto     0.2.6
packaging          24.2
para_attn          0.1.dev187
pillow             11.1.0
pip                23.0.1
psutil             7.0.0
PyYAML             6.0.2
regex              2024.11.6
requests           2.32.3
safetensors        0.5.2
sageattention      1.0.6
setuptools         65.5.0
sympy              1.13.1
tokenizers         0.20.3
torch              2.5.1+cu124
torchao            0.9.0+cpu
torchaudio         2.5.1+cu124
torchvision        0.20.1+cu124
tqdm               4.67.1
transformers       4.46.3
triton             3.0.0
typing_extensions  4.12.2
urllib3            2.3.0
wheel              0.45.1
xformers           0.0.29.post1
zipp               3.21.0

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

No branches or pull requests

1 participant