zylon-ai/private-gpt · error · ValueError
No distributions found in {package_dir}
Error message
No distributions found in {package_dir} What it means
Raised by the main index builder in scripts/build_pip_index.py when the package directory, after filtering for .whl and .tar.gz files, contains zero distributions. The script deliberately fails instead of emitting an empty index page, because an empty simple index usually indicates the artifacts were never copied or the wrong directory was passed.
Source
Thrown at scripts/build_pip_index.py:118
output_dir = output_dir.resolve()
output_dir.mkdir(parents=True, exist_ok=True)
simple_dir = output_dir / "simple"
if simple_dir.exists():
for path in sorted(simple_dir.rglob("*"), reverse=True):
if path.is_file():
path.unlink()
elif path.is_dir():
path.rmdir()
simple_dir.mkdir(exist_ok=True)
distributions = [
read_distribution(path)
for path in sorted(package_dir.iterdir())
if path.is_file() and (path.suffix == ".whl" or path.name.endswith(".tar.gz"))
]
if not distributions:
raise ValueError(f"No distributions found in {package_dir}")
grouped: dict[str, list[Distribution]] = defaultdict(list)
canonical_names: dict[str, str] = {}
for distribution in distributions:
grouped[distribution.normalized_name].append(distribution)
canonical_names.setdefault(distribution.normalized_name, distribution.name)
package_links = []
artifact_links = []
for normalized_name in sorted(grouped):
canonical_name = canonical_names[normalized_name]
project_dir = simple_dir / normalized_name
project_dir.mkdir(parents=True, exist_ok=True)
file_links = []
for distribution in sorted(
grouped[normalized_name], key=lambda item: item.filename
):View on GitHub (pinned to 4a030776a3)
Solutions
- Build first, then index: run uv build / python -m build and confirm .whl/.tar.gz files exist in the scanned directory
- Check for extension mismatches or broken symlinks with ls -la on the package dir
- Pass or configure the correct package directory path to the script
- If the directory is intentionally empty, skip running the index builder (guard in CI)
Example fix
# before python scripts/build_pip_index.py --dir dist-empty/ # ValueError: No distributions found in dist-empty # after uv build python scripts/build_pip_index.py --dir dist/
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def package_dir_ready(package_dir: Path) -> bool:
return any(
p.is_file() and (p.suffix == ".whl" or p.name.endswith(".tar.gz"))
for p in package_dir.iterdir()
)
# skip or fail with a clear message when False before building the index Type guard
null
Try / catch
try:
build_index(package_dir, out)
except ValueError as e:
if "No distributions found" in str(e):
raise SystemExit("build artifacts first: uv build, then rerun")
raise Prevention
- Chain build and index steps in one CI job so artifacts exist before indexing
- Assert the dist dir contains at least one .whl/.tar.gz as a CI gate
- Use the same dist/ path in both the build step and the index script configuration
- Fail CI early on empty builds instead of running downstream steps
When it happens
Trigger: Running build_pip_index.py before any artifacts were placed in the expected folder; passing an output/dist directory path that contains only source files; artifacts named with non-matching extensions (see error 432) so the filter excludes everything; a build step that failed silently before the index step.
Common situations: CI pipelines where 'uv build' output dir differs from the dir the index script scans; artifacts cleaned by a prior step; first run on a fresh checkout with no build executed yet; pointing the script at a directory of symlinks that are not is_file()-true (broken links).
Related errors
- Distribution metadata is missing Name
- Unsupported distribution format: {path.name}
- Unable to read PKG-INFO from {path}
- Failed to update project version in pyproject.toml
- Postgres node store dependencies are not installed. Install
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/3b305b27be050ec3.
Report an issue: GitHub.