Python Package Managers Explained: From Zero to Pro
You just installed Python. Now what? This guide walks you through everything you need to know about managing Python packages — from the very basics to how modern teams actually work.
First Things First: What Is a Package?
When you install Python, you get the basics. You can do math, work with strings, write loops. But the moment you want to do something more interesting — process an image, build a web server, analyze data — you need extra tools.
These extra tools are called packages (or libraries). They’re code that someone else wrote, tested, and published online so you don’t have to reinvent the wheel.
For example:
numpy— fast math and array operationsopencv-python— image processingmatplotlib— charts and visualizationsrequests— making HTTP requests
You don’t write these yourself. You install them. And that’s exactly what package managers are for.
pip — The Classic
pip is Python's default package manager. It comes bundled with Python, so you already have it.
pip install numpy
pip install matplotlib opencv-python
pip uninstall numpy
pip list # see everything installedSimple and effective. For years, this was all anyone used.
The catch? When you run pip install, it installs the package globally — meaning it goes into your system's Python, shared across everything on your computer. That leads to a very common problem.
The Dependency Conflict Problem
Imagine you’re working on two projects:
- Project A needs
numpy 1.20 - Project B needs
numpy 2.0
If you install both globally, they overwrite each other. One project breaks. This is one of the most frustrating experiences in Python development — and it has a simple solution.
venv — Isolated Environments
venv creates a virtual environment: a self-contained folder that has its own Python and its own packages, completely separate from your system.
# Create a virtual environment
python -m venv myenv# Activate it (Mac/Linux)
source myenv/bin/activate# Activate it (Windows)
myenv\Scripts\activate# Now install packages — they go ONLY into this environment
pip install numpy# Deactivate when done
deactivate
Think of it like this: instead of keeping all your tools in one giant drawer, you give each project its own toolbox. Project A has its toolbox, Project B has its own. They never interfere.
venv is built into Python — no installation needed. It’s the standard approach and you’ll see it everywhere.
conda — The Data Science Alternative
conda is a package manager from Anaconda, designed specifically for data science and scientific computing.
It goes further than pip in one important way: it can install non-Python dependencies too. Many scientific packages (like those for machine learning or numerical computation) depend on C or Fortran libraries under the hood. conda handles all of that automatically.
conda create -n myenv python=3.11 # create environment with specific Python
conda activate myenv
conda install numpy pandas scikit-learn
conda deactivateconda also manages environments like venv does — each one is isolated.
When to use conda:
- You’re in data science or scientific computing
- You’re working with tools like TensorFlow, PyTorch, or Jupyter
- You want a GUI-based experience (Anaconda Navigator)
When to skip conda:
- You’re building web apps or general Python projects
- You want something lightweight and fast
- Your team isn’t using it
requirements.txt — Sharing Your Setup
Here’s a scenario: you build a project on your machine, everything works perfectly. You send it to a colleague. They run it. It crashes immediately because they don’t have the same packages.
Get Gülce Berfin Ercan’s stories in your inbox
Join Medium for free to get updates from this writer.
The solution is requirements.txt — a simple file that lists every package your project needs.
# Generate it from your current environment
pip freeze > requirements.txt# The file looks like this:
# numpy==1.26.0
# matplotlib==3.8.0
# opencv-python==4.9.0# Anyone can recreate your exact environment with:
pip install -r requirements.txt
This is standard practice. Any serious Python project has a requirements.txt (or something similar). Always include it when sharing code.
poetry — Professional Dependency Management
As projects grow more complex, pip + venv + requirements.txt starts to show its limitations. Managing version conflicts manually gets painful. This is where poetry comes in.
poetry handles the full lifecycle of a project:
poetry new my-project # creates project structure
poetry add numpy # adds a package AND records it properly
poetry install # installs everything from lock file
poetry run python script.py # runs inside the environmentInstead of a simple requirements.txt, poetry uses two files:
pyproject.toml— your declared dependencies (human-readable)poetry.lock— the exact resolved versions (machine-readable, never edit this)
The lock file is the key idea: it guarantees that everyone on your team, and every server you deploy to, runs the exact same versions of every package. No more “works on my machine” problems.
Use poetry when:
- You’re building a library or package to publish
- You’re working in a team
- You need reproducible environments across dev and production
uv — The Modern Standard
uv is the newest player, built in Rust by the team behind ruff. It's designed to be a single tool that replaces pip, venv, and more — and it's dramatically faster (10–100x compared to pip).
uv venv # create virtual environment
uv pip install numpy # install a package
uv pip install -r requirements.txt
uv run python script.py # run without manually activating env
uv sync # install everything from lock fileFor a full project workflow:
uv init my-project # creates project with pyproject.toml
cd my-project
uv add numpy matplotlib # add dependencies
uv run python main.pyWhy uv is gaining adoption fast:
- Blazing fast — installs that took 30 seconds now take 1–2
- One tool instead of three (pip + venv + something else)
- Compatible with existing
requirements.txtandpyproject.tomlfiles - Works great in CI/CD pipelines where speed matters
If you’re starting a new project today, uv is worth serious consideration.
Putting It All Together
Here’s how these tools relate:
Tool What it does pip Installs packages venv Creates isolated environments conda Installs packages + manages environments (data science focus) poetry Full project management with lock files uv Modern replacement for pip + venv, much faster
A typical beginner workflow looks like this:
python -m venv env
source env/bin/activate
pip install numpy matplotlib
pip freeze > requirements.txtA typical professional workflow today looks more like this:
uv init my-project
cd my-project
uv add numpy matplotlib
uv run python main.pyQuick Decision Guide
Just learning Python? → Use pip and venv. They're everywhere, well-documented, and good enough.
Working in data science? → conda is worth learning. The Anaconda distribution sets everything up for you.
Building something serious with a team? → poetry or uv with a lock file. Your future self will thank you.
Starting fresh today? → uv. It does everything, it's fast, and it's where the ecosystem is heading.
One Last Tip
Whatever tool you use, always work inside an environment — never install packages globally into your system Python. It takes 30 extra seconds and saves hours of debugging down the line.
# Before starting any project, do this first:
python -m venv env && source env/bin/activate
# or
uv venv && source .venv/bin/activateMake it a habit from day one.







