liveBook · Manning

Requirements.txt

As explained in Build Applications with Local AI Models on a Mac

A requirements.txt file is a dependency specification file that lists packages and the versions required by a Python project.

A requirements.txt file records installed packages and their exact versions so a Python environment can be recreated or shared. Generate it with `pip freeze > requirements.txt`; share this file instead of the virtual environment folder. section 6.5 section 6.7

python3.13 -m venv .venv       #1
source .venv/bin/activate   #2
pip install -r requirements.txt   #3

Recreate the environment by creating and activating a virtual environment, then asking pip to install the listed packages. section 6.5.2

How Build Applications with Local AI Models on a Mac covers it

How deep it goes
Shows how to generate the file and restore its listed package versions.
Examples
Uses requests in a practice environment and ollama and streamlit in a chatbot environment.
What it assumes
Assumes packages have been installed in a virtual environment; demonstrates creating and activating one in the workflow.
What you can do after
Operate pip to record dependencies and rebuild an environment from the file.
How it connects
Connects pip commands with Python virtual environments.

Also explained in

Compare how 4 books explain requirements.txt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Applications with Local AI Models on a Mac. The section links point to the parts of the book it draws on.