Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

pip

Direct answer

pip installs Python packages from PyPI, such as pip install requests. Pin versions in requirements.txt and install inside a virtual environment rather than system-wide.

When to use this

Use this when installing Python packages.

First 30 seconds

1. pip installs packages.

2. Pin versions (== or lock files with hashes).

3. Audit for vulnerabilities.

4. Use private indexes carefully (dependency confusion).

5. --break-system-packages only when necessary.

Operational verification

requirements → pip → venv

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Python automation runtime
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformPython automation runtime · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when installing Python packages.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Common mistakes Narrow the fault
  • sudo pip install into the system Python.
  • Unpinned versions changing behaviour between runs.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Install packages inside a virtual environment.
  • Pin versions in requirements.txt.
  • Use pip install -r to reproduce.
Key checks
  • pip install -r requirements.txt — install pinned
  • pip list --outdated — updates
  • pip-audit — vulnerable packages
ReferenceWhy it matters1 section · depth on demand

What it is

pip installs Python packages from PyPI or other indexes. Pin versions in requirements.txt (or a lock file) so every run uses the same code.

ReferenceImportant terms & boundaries3 sections · depth on demand

In depth

pip installs Python packages from PyPI or other indexes. For automation the important part is reproducibility: the same script must get the same library versions on a laptop, a CI runner and the automation server.

python3 -m venv .venv && . .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip freeze > requirements.lock          # exact versions actually installed
pip install --require-hashes -r requirements.lock   # with hashes: tamper-proof installs

Good practice: always install into a virtual environment (never sudo pip into the system Python; recent distributions block this with "externally-managed-environment"), pin versions, and use an internal mirror or proxy where servers have no internet access. pipx installs command-line tools such as ansible-lint in isolated environments.

Example

pip install 'netmiko==4.4.0'
pip freeze > requirements.txt
pip install -r requirements.txt
pip-audit
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docPython automation runtime current

Authoritative/upstream documentation reviewed for bounded claims in Python Automation > pip. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.python.org/3/ · confidence 94%
Confirmation

Confirm action

Continue?