liveBook · Manning

Pip

As explained in Road to Kubernetes

pip is the standard package installer and dependency-management tool for Python.

pip installs Python packages and dependencies inside a project’s virtual environment. Running it through that environment’s Python interpreter avoids accidentally using a globally installed copy. section 2.1.1

A practical pip workflow:

  • Create and activate a virtual environment before installing project dependencies. section 2.1.1
  • Upgrade pip, then install individual packages such as FastAPI with python -m pip install. section 2.1.1
  • Record packages in requirements.txt and install them together with python -m pip install -r src/requirements.txt. section 2.1.1
  • Use a project-specific Python version when preparing dependencies for deployment. section 3.4

FastAPI dependency file

A requirements.txt file can list fastapi, jinja2, uvicorn, and gunicorn. pip then installs the complete set rather than requiring each package to be entered separately. section 2.1.1

Listing 2.6 Installing all third-party packages
# navigate to root of our project where the venv folder lives
cd ~/Dev/roadtok8s/py/

# activate or reactivate your virtual environment
source venv/bin/activate # or .\venv\Scripts\activate

# install all packages via the newly created requirements file
python -m pip install -r src/requirements.txt

Shows the command sequence for activating a project environment and installing every dependency declared in requirements.txt. section 2.1.1

How Road to Kubernetes covers it

How deep it goes
Demonstrates commands, virtual-environment selection, and requirements files, while deferring complex version constraints and Git repositories.
Examples
Uses FastAPI installation and a requirements.txt listing FastAPI, Jinja2, Uvicorn, and Gunicorn.
What it assumes
Assumes basic Python command-line use and teaches virtual-environment creation, activation, and dependency installation.
What you can do after
Apply pip to install individual packages or reproduce a project dependency set from requirements.txt.
How it connects
Connects pip with virtual environments, Python runtimes, requirements files, and deployment dependency management.

Also explained in

Compare how 3 books explain pip →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.