---
source: https://iinventedlight.com/library/notes/github-actions-setup-python.md
title: "setup-python can install Python and cache pip, pipenv, or poetry packages"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (GitHub Docs); MIT (actions/setup-python (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Building and testing Python, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; actions/setup-python (GitHub), setup-python advanced usage, MIT (https://raw.githubusercontent.com/actions/setup-python/main/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-16). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: GitHub Actions setup-python"
tags: [github-actions, setup-python, cache, pip]
client: Librarian
sources:
  - id: S1
    title: "Building and testing Python"
    publisher: GitHub Docs
    url: https://docs.github.com/en/actions/tutorials/build-and-test-code/python
    accessed: 2026-11-16
    license: "CC-BY-4.0"
  - id: S2
    title: "setup-python advanced usage"
    publisher: actions/setup-python (GitHub)
    url: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md
    accessed: 2026-11-16
    license: "MIT"
---
# setup-python can install Python and cache pip, pipenv, or poetry packages
**Answer:** GitHub-hosted runners have a tools cache with pre-installed software, which includes Python and PyPy. The `actions/setup-python` action finds a specific version of Python from the tools cache and adds the binaries to `PATH`.

## Package caching

Advanced usage documents Caching packages. Examples set `python-version: '3.13'` with `cache: 'pip'`. Other examples use `cache: 'pipenv'` and `cache: 'poetry'`. `cache-dependency-path` can list file paths or wildcard patterns such as `**/requirements-dev.txt`.

A tutorial workflow uses `python-version: "3.13"` and then installs dependencies with pip.

## See also

- [github-actions-caching](https://iinventedlight.com/library/notes/github-actions-caching/)
- [github-actions-workflow-basics](https://iinventedlight.com/library/notes/github-actions-workflow-basics/)
- [github-actions-concurrency](https://iinventedlight.com/library/notes/github-actions-concurrency/)
- [github-actions-artifacts](https://iinventedlight.com/library/notes/github-actions-artifacts/)

## Claims

- id: C1
  claim: GitHub-hosted runners have a tools cache that includes Python and PyPy.
  source: S1
  evidence: "hosted runners have a tools cache with pre-installed software, which includes Python and PyPy."

- id: C2
  claim: The tutorial uses actions/setup-python with python-version 3.13.
  source: S1
  evidence: "python-version: \"3.13\""

- id: C3
  claim: setup-python advanced usage has a Caching packages section.
  source: S2
  evidence: "## Caching packages"

- id: C4
  claim: You can set cache to pip next to python-version.
  source: S2
  evidence: "cache: 'pip'"

## Sources

- [S1] Building and testing Python. GitHub Docs. https://docs.github.com/en/actions/tutorials/build-and-test-code/python . License: CC-BY-4.0. Accessed 2026-11-16.

- [S2] setup-python advanced usage. actions/setup-python (GitHub). https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md . License: MIT. Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Building and testing Python, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; actions/setup-python (GitHub), setup-python advanced usage, MIT (https://raw.githubusercontent.com/actions/setup-python/main/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
