Pull requests / #3285

#3285 [Other] Honor STRATA_INSTALL_DIR when locating gguf-py

open · @hulkbig · 0 comments · View on GitHub

Setup & installModels & quantsWindowsLinux

Description

## Problem and result

When `STRATA_INSTALL_DIR` points to an existing Control installation, standalone tools still fail to find its `third_party/llama.cpp/gguf-py` directory unless `STRATA_GGUF_PY` is also set. Control-mode setup writes that dependency beneath its install home, but `_paths.py` only checks the explicit GGUF override, source tree and development tree.

The helper now checks the configured install directory. An isolated reproduction using empty temporary directories goes from the reported missing-gguf-py `SystemExit` to returning the installed path.

## Related discussion

Refs #3269. This implements the report's suggestion to check `$STRATA_INSTALL_DIR/third_party/llama.cpp/gguf-py`.

## Approach

Keep `STRATA_GGUF_PY` first, then check `STRATA_INSTALL_DIR`, followed by the existing source/development fallbacks. A candidate still needs a `gguf` directory. With `STRATA_INSTALL_DIR` unset or empty, the existing lookup order is unchanged.

The new stdlib-only tests load `_paths.py` directly and use temporary directory trees and process-local environment patches. They require no gguf package or model files.

## Validation

Linux x86_64, Python 3.12.14. Base: `e88ee39d1d6be6e3364183af3b39b62a7ed6f211`. Tested candidate tree: `20c39f7e709d092363fb5918e70695ab1b5b8eac`.

**Passed:**

- `python3 -I -S -B tools/test_paths.py -v`: 10/10 on the candidate.
- `python3 -I -S -B -m unittest discover -s tools -p test_paths.py -v`: 10/10 on the candidate.
- `git diff --cached --check`: clean.

**Failed:**

- The identical test file alongside the unmodified base helper, run with `python3 -I -S -B tools/test_paths.py -v`: 7 passed, 1 assertion failure and 2 `SystemExit` errors. All three failures concern the configured install directory: finding it alone, selecting it before source/development copies, and falling back to it from an absent explicit GGUF path.
- No failures on the candidate.

**Not run:**

- `iq_pack.py`, setup, actual gguf imports, model conversion, packaged-Control integration or the full repository suite.
- Windows/macOS execution and backend builds. No backend code changed.

## Limits

`STRATA_INSTALL_DIR` must be set. This does not automatically discover a default per-user installation when the variable is absent, so it does not claim to fix every unpacked-package case in #3269. Setup already supplies `STRATA_GGUF_PY` to its preparation subprocesses; this change concerns standalone discovery.

AI-assisted implementation and test preparation.

Related on this site

Quick links to related pages.