Fix Colab huggingface-hub conflict and pip bootstrap on uv venvs
- colab.py / setup.sh: relax == pins to >= when installing studio.txt on Colab so huggingface-hub does not clobber Colab's bundled version (which breaks transformers is_offline_mode import) - install_python_stack.py: when uv is unavailable and pip is missing (uv-created venvs), bootstrap via ensurepip before attempting upgrade
This commit is contained in:
parent
b4310b8cd1
commit
06b2ac61f4
3 changed files with 42 additions and 7 deletions
|
|
@ -373,10 +373,25 @@ def install_python_stack() -> int:
|
|||
],
|
||||
)
|
||||
else:
|
||||
run(
|
||||
"Upgrading pip",
|
||||
[sys.executable, "-m", "pip", "install", "--upgrade", "pip"],
|
||||
)
|
||||
# pip may not exist yet (uv-created venvs omit it). Try ensurepip
|
||||
# first, then upgrade. Only fall back to a direct upgrade when pip
|
||||
# is already present.
|
||||
_has_pip = subprocess.run(
|
||||
[sys.executable, "-m", "pip", "--version"],
|
||||
stdout = subprocess.DEVNULL,
|
||||
stderr = subprocess.DEVNULL,
|
||||
).returncode == 0
|
||||
|
||||
if not _has_pip:
|
||||
run(
|
||||
"Bootstrapping pip via ensurepip",
|
||||
[sys.executable, "-m", "ensurepip", "--upgrade"],
|
||||
)
|
||||
else:
|
||||
run(
|
||||
"Upgrading pip",
|
||||
[sys.executable, "-m", "pip", "install", "--upgrade", "pip"],
|
||||
)
|
||||
|
||||
# 3. Core packages: unsloth-zoo + unsloth (or custom package name)
|
||||
if skip_base:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue