pip "file:// ... does not appear to be a Python project" in CI
pip was pointed at a directory to install as a project, but that directory has no pyproject.toml or setup.py. Usually the path is wrong, the checkout is shallow, or the working directory is not the project root.
What this error means
pip install . or pip install -e <path> fails immediately with "does not appear to be a Python project: neither setup.py nor pyproject.toml found". Nothing builds because pip found no project to build.
ERROR: file:///home/runner/work/repo does not appear to be a Python project:
neither 'setup.py' nor 'pyproject.toml' found.Common causes
Wrong directory or path
The path given to pip points at the repo root when the project lives in a subdirectory (or vice versa), so no metadata file is present there.
Metadata file missing from the checkout
A sparse/partial checkout, a .dockerignore/.gitignore that excluded pyproject.toml, or a build context that did not copy it leaves the directory without project metadata.
How to fix it
Point pip at the directory that holds the metadata
Confirm where pyproject.toml/setup.py actually is and install from there.
ls pyproject.toml setup.py 2>/dev/null
pip install -e ./packages/my-lib # the dir that contains the metadataMake sure the metadata is in the build context
- Check
.dockerignore/.gitignoredoes not excludepyproject.toml. - Use a full (not shallow/sparse) checkout if the file is missing.
- In Docker,
COPY pyproject.toml setup.py ./beforepip install -e ..
How to prevent it
- Install from the directory that actually contains the project metadata.
- Keep
pyproject.tomlout of ignore files used for the build context. - Verify the file exists in CI before the install step.