Stop 01 · Programming & CS FoundationsTopics · 7/12

pip & Package Management

Part of the AI Engineer Roadmap

In short

Nobody writes matrix maths or HTTP code from scratch. pip pulls ready-made packages like numpy, pandas and requests onto your machine, and a requirements file lets anyone rebuild your exact setup.

Installing, pinning and managing the Python packages (numpy, pandas, torch, transformers) that every AI project depends on.

The purple blob hands a shopping slip to a kirana shopkeeper who passes back grocery packets.

Think of it like this

The kirana store delivery list

You hand the kirana uncle a list: 2 kg atta, butter, a packet of noodles. He fetches each item, and the masala sachet the noodles need comes inside the pack. pip is the uncle, PyPI is his godown, and requirements.txt is your list.

Watch it happen

pip install requests

You
pip
PyPI
.venv

pip install requests

1/5You ask pip for one package by name.

The big ideas

What you need to know

PyPI is the shop

pypi.org hosts the public Python packages. pip downloads from there unless you point it somewhere else.

Pin versions you depend on

pandas==2.2.3 always installs that exact version. Without a pin you get whatever is newest that day.

requirements.txt is the recipe

pip install -r requirements.txt rebuilds the same set of packages on a teammate's laptop or a server.

Check before you install

Typo packages like 'reqeusts' have been used to spread malware. Copy names from official docs.

See it in code

Walk through the code

bash
1pip install requests pandas          # newest versions2pip install "numpy<2"                # any version below 23pip install --upgrade pandas         # move to the newest4 5pip list                             # what's installed6pip show requests                    # version, location, deps7 8pip freeze > requirements.txt        # save exact versions9pip install -r requirements.txt      # rebuild elsewhere10pip uninstall requests

1/3Install the latest, cap a version with a range, or upgrade something you already have.

Run these inside an activated virtual environment. python -m pip ... does the same thing and guarantees pip matches the Python you're using.

Save yourself the pain

Common mistakes

Oops

Using sudo pip install to fix a permissions error.

Do this instead

Create and activate a virtual environment instead. Installing system-wide can break tools your OS depends on.

Oops

Sharing a project with no requirements.txt and saying 'just install whatever'.

Do this instead

Commit requirements.txt so the project works the same on every machine.

Your mission

Make a reproducible project

~15 min

Quick check

Why does pip freeze list packages you never installed yourself?

Go deeper

  1. 1Practice installing, upgrading and uninstalling packages with pip.
  2. 2Learn to pin exact versions in requirements.txt for reproducibility.
  3. 3Understand dependency conflicts and how to resolve them.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge