pip "WARNING: The scripts ... are installed in '...' which is not on PATH"
pip installed a package’s console scripts into a bin directory that is not on PATH. The install succeeds, but the command it provides "is not found" in a later step.
What this error means
pip prints a yellow warning that scripts were installed in a directory not on PATH (often ~/.local/bin). A subsequent step then fails with "command not found" when calling that tool by name.
WARNING: The scripts pytest and py.test are installed in
'/home/runner/.local/bin' which is not on PATH.
Consider adding this directory to PATH ...
# later step:
pytest: command not foundCommon causes
User install targets ~/.local/bin
A --user install (or an implicit one - see "Defaulting to user installation") puts entry-point scripts under ~/.local/bin, which minimal images do not add to PATH.
A venv bin not exported between steps
Scripts live in the venv’s bin, but a later CI step in a fresh shell never put that bin on PATH, so the command resolves nowhere.
How to fix it
Add the script directory to PATH
On GitHub Actions, append the directory to $GITHUB_PATH so every later step sees it.
- run: |
pip install --user pytest
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- run: pytestOr invoke via the interpreter
Calling the tool as a module avoids PATH entirely and always targets the right interpreter.
python -m pytestHow to prevent it
- Install into a venv and put its
binon the job PATH once. - Prefer
python -m <tool>over the bare console script in CI. - Avoid
--userinstalls unless you also export~/.local/bin.