mirror of
https://github.com/unslothai/unsloth
synced 2026-04-21 13:37:39 +00:00
Fix bitsandbytes ROCm install by using pip instead of uv (#4966)
* Fix bitsandbytes ROCm install by using pip instead of uv * Also use pip for PyPI fallback path in _install_bnb_rocm The original fix correctly switched the pre-release wheel install from uv to pip, but left the PyPI fallback path on uv. If uv breaks bnb on ROCm, the fallback would hit the same issue. Move pip bootstrap before the branch so both paths use pip consistently. * Harden pip bootstrap: try ensurepip first, warn on failure - Try ensurepip --upgrade before falling back to uv pip install pip. ensurepip works offline and does not need PyPI, making the bootstrap robust when the network or index is unavailable. - If both ensurepip and uv fail, emit a visible warning instead of silently swallowing the error (which previously led to a cryptic "No module named pip" downstream). - Use run_maybe_quiet so --verbose users see bootstrap output. - Update comment to document the actual root cause: uv rejects the wheel because filename version and metadata version disagree. * Add --isolated to pip install calls in _install_bnb_rocm uv pip install ignores pip.conf and PIP_* env vars, but python -m pip reads them. Without --isolated, users with PIP_INDEX_URL pointing to a private mirror that does not carry bitsandbytes would see the PyPI fallback fail where it previously worked under uv. --isolated restores parity with the old uv behavior. * Drop --isolated from PyPI fallback in _install_bnb_rocm --isolated suppresses PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, and pip.conf. This is correct for the pre-release path (hardcoded GitHub URL, no index consulted), but breaks the PyPI fallback for users in corporate or air-gapped environments whose only route to bitsandbytes is a private mirror configured via those mechanisms. Keep --isolated on the direct-URL pre-release install; drop it from the index-dependent fallback. * Drop --isolated from pre-release pip install, fix warning wording --isolated suppresses pip.conf cert/proxy/CA settings in addition to index config. For the direct GitHub URL, index config is irrelevant but cert/proxy settings matter in corporate SSL-inspection environments. Without this fix, users with pip.conf-based CA bundles get a TLS error on the pre-release download and silently fall back to the broken PyPI version -- the exact outcome the PR is trying to prevent. Also fix the fallback warning: "unreachable" is too specific since the pre-release install can fail for reasons other than network reachability. --------- Co-authored-by: Daniel Han <danielhanchen@gmail.com>
This commit is contained in:
parent
a0b9d14081
commit
5b8dbdc3c2
1 changed files with 12 additions and 3 deletions
15
install.sh
15
install.sh
|
|
@ -112,15 +112,24 @@ _install_bnb_rocm() {
|
|||
_bnb_whl_url=""
|
||||
;;
|
||||
esac
|
||||
# uv rejects the continuous-release_main bitsandbytes wheel because the
|
||||
# filename version (1.33.7rc0) does not match the embedded metadata version
|
||||
# (0.50.0.dev0). pip accepts the mismatch, so bootstrap pip and use it.
|
||||
if ! "$_venv_py" -m pip --version >/dev/null 2>&1; then
|
||||
if ! run_maybe_quiet "$_venv_py" -m ensurepip --upgrade; then
|
||||
run_maybe_quiet uv pip install --python "$_venv_py" pip || \
|
||||
substep "[WARN] could not bootstrap pip; bitsandbytes install will likely fail" "$C_WARN"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$_bnb_whl_url" ]; then
|
||||
substep "installing bitsandbytes for AMD ROCm (pre-release, PR #1887)..."
|
||||
if run_install_cmd "$_label (pre-release)" uv pip install --python "$_venv_py" \
|
||||
if run_install_cmd "$_label (pre-release)" "$_venv_py" -m pip install \
|
||||
--force-reinstall --no-cache-dir --no-deps "$_bnb_whl_url"; then
|
||||
return 0
|
||||
fi
|
||||
substep "[WARN] bnb pre-release unreachable; falling back to PyPI (4-bit decode broken on ROCm)" "$C_WARN"
|
||||
substep "[WARN] bnb pre-release install failed; falling back to PyPI (4-bit decode broken on ROCm)" "$C_WARN"
|
||||
fi
|
||||
run_install_cmd "$_label (pypi fallback)" uv pip install --python "$_venv_py" \
|
||||
run_install_cmd "$_label (pypi fallback)" "$_venv_py" -m pip install \
|
||||
--force-reinstall --no-cache-dir --no-deps "bitsandbytes>=0.49.1"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue