Skip to content

install.sh --local / Studio setup fails with error: File not found: <truncated path> when the repo is cloned into a directory path containing a space #6503

Closed

Description

@Abdul-Moiz31

Environment

macOS (Darwin 25.x), Apple Silicon/CPU-only torch path (no NVIDIA/AMD GPU detected)
uv 0.10.9
Repo cloned at a path containing a space, e.g. /Users/me/Documents/Open Source/unsloth
Steps to reproduce

Clone the repo into any folder whose path has a space in it.
Run ./install.sh --local
What happens
PyTorch install fails immediately:
gpu            none (CPU-only)
               installing PyTorch (https://download.pytorch.org/whl/cpu)...
error          install PyTorch failed (exit code 2)
error: File not found: `/Users/me/Documents/Open`

The actual uv command line being run (confirmed via set -x) is completely clean and contains no path with a space:

uv pip install --python /Users/me/.unsloth/studio/unsloth_studio/bin/python 'torch>=2.6,<2.11.0' torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
Running that exact command from a directory with no space in its path succeeds. Running it from the space-containing directory fails the same way — so it looks like uv is doing some project-root discovery from cwd (this repo's pyproject.toml has dynamic = ["version"], which needs metadata resolution) and mishandles the space internally.

Workaround attempt: symlinking the repo to a space-free path (ln -s ".../Open Source/unsloth" ~/unsloth-link) fixes the install.sh-driven steps, since pwd there returns the logical (non-resolved) symlink path. But the next stage — Studio setup via studio/install_python_stack.py — hits the same failure again, because:

SCRIPT_DIR = Path(__file__).resolve().parent # studio/install_python_stack.py:1406
.resolve() follows the symlink back to the real, space-containing path, which then gets passed to uv as a -c argument.

Found what looks like the actual known root cause already in the code, at studio/install_python_stack.py:1310:

def _uv_safe_path(path: object) -> str:
    # uv 0.11.x: `-c <path with space>` truncates at the space; use 8.3 short form.
    s = str(path)
    if not IS_WINDOWS or " " not in s:
        return s
    try:
    ...  # uses Windows GetShortPathNameW to get a space-free 8.3 short path

So this uv bug (truncating a path at the first space when passed via -c) is already known and worked around — but only for Windows (via the 8.3 short-path trick). There's no equivalent fallback for macOS/Linux, where the function just returns the space-containing path unchanged, hitting the same bug.

Question:

is there a recommended way for macOS/Linux users with a space in their install path to work around this today (env var, flag, etc.)? And would a PR extending _uv_safe_path() to non-Windows platforms be welcome — e.g. by copying the constraints/requirements file to a temp path without spaces before invoking uv, since macOS/Linux has no 8.3-short-path equivalent? Happy to put one together if it's the right direction.

Activity

  1. danielhanchen commented on Jun 25, 2026

    @danielhanchen
    Member

    Both halves of this are now fixed on main:

    • Studio Python installer side (install_python_stack.py, mlx_repair.py): the -c / -r / UV_OVERRIDE truncation, fixed in Make _uv_safe_path space-safe on macOS/Linux (#6503) #6534.
    • Shell installer side (install.sh): on Apple Silicon, install.sh exported UV_OVERRIDE pointing at the bundled overrides-darwin-arm64.txt. uv splits UV_OVERRIDE on whitespace, so a repo cloned under a path with a space truncated the value and every later uv call (including the clean PyTorch step) aborted with error: File not found: <truncated>. That export is gated on macOS arm64, which is why it only showed up there and looked like a clean command under set -x. Fixed in Installer: make UV_OVERRIDE space-safe on Apple Silicon (#6503) #6639 by copying the overrides file into a space-free temp dir and pointing uv at the copy.

    Verified on real macOS runners (uv 0.10.9 and 0.11.24) that a repo under a path containing a space now installs cleanly. Closing as resolved; please reopen if any spaced-path case still fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions