Tech With Galvan
Courses/Python Mastery/The Python Ecosystem

pip and Packages Beyond the Standard Library

20 min • Beginner • Module 11

Install, upgrade, and manage third-party packages without fear.

pip and Packages Beyond the Standard Library

The standard library is huge, but the true power of Python is PyPI — the Python Package Index — with over 500,000 free packages. One command installs almost any capability: web frameworks, AI libraries, PDF tools, you name it.

pip — your package manager

pip is Python’s installer (it ships with Python). The essential commands:

pip install package-name          # install
pip install package-name==2.1.0   # install a SPECIFIC version
pip install --upgrade package-name # update
pip uninstall package-name        # remove
pip list                          # what's installed
pip show package-name             # details about one package

Install something real — the requests library (next lesson’s star):

pip install requests

Then import it like the standard library:

import requests
print(requests.__version__)

One command, one import — that’s the entire deal. This is why Python dominates: whatever you’re building, someone probably published the hard parts already.

Always inside a virtual environment

Module 2 taught venvs — this is where they matter most:

# the ritual for every new project
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install requests pandas

Without a venv, every package lands in one global pile — version conflicts between projects are inevitable. With a venv, each project owns its packages. Install globally = future chaos. Install in a venv = future calm.

requirements.txt — your project’s recipe

Freeze what you’ve installed so anyone (including future you, including deployment servers) can recreate the exact environment:

pip freeze > requirements.txt

The file looks like:

requests==2.31.0
streamlit==1.41.1
pandas==2.2.3

Recreating the environment anywhere:

pip install -r requirements.txt

This two-file pair (code + requirements.txt) is what makes projects portable — and it’s exactly what the Streamlit Cloud deployment in your other course requires.

Finding packages — how to choose

When you need a capability, search PyPI.org or ask: “python how to [task]”. With thousands of options, pick by:

  1. Downloads — PyPI shows monthly numbers; high = battle-tested
  2. Recent updates — abandoned packages rot as Python evolves
  3. Documentation — a package with good docs saves hours

The famous ones you’ll meet on your journey:

Package Superpower
requests HTTP/API calls
pandas data analysis
streamlit web apps from Python
numpy fast number crunching
matplotlib charts
beautifulsoup4 web scraping
openai / mistralai AI APIs

Common Errors & Fixes

  • pip: command not found — try python -m pip install ... (runs pip through your Python, always works).
  • Installed but ImportError — installed into a different Python than the one running. Check: which python and which pip point to the same venv.
  • Permission denied — installing globally without rights. The real fix: use a venv (never sudo pip).
  • Version conflicts — two projects need different versions of the same package. The entire reason venvs exist — separate them.

✅ Checkpoint

  1. Install requests version 2.31.0 exactly? (pip install requests==2.31.0)
  2. What file makes a project reproducible, and what creates it? (requirements.txt — pip freeze > requirements.txt)
  3. Why install inside a venv? (Per-project isolation — no version conflicts)
  4. pip: command not found — what always works? (python -m pip install …)

Next: requests — your code’s passport to the internet.