Package Managers in Python —
Imagine you are building a big house called a Python Project. You need bricks, paint, windows, and tools to complete it. Instead of making everything yourself, you buy ready-made materials.
In Python, these ready-made materials are called packages or libraries. A package manager helps you install, update, and manage them.
1. Meet Python Developer Rahul
Rahul wants to create a website using Python. His project needs:
- A package to build the website.
- A package to work with data.
- A package to send HTTP requests.
Rahul doesn’t want to install and manage everything manually. So, he uses a package manager!
2. Meet pip — Rahul's Shopping Assistant
Rahul meets a helpful assistant named pip. Pip finds and installs the packages he needs.
For example, Rahul wants to install the popular requests package.
pip install requestsThat’s it! Pip installs the package so Rahul can use it in his Python program.
What can pip do?
Command
Purpose
pip install requests
Install a package
pip uninstall requests
Remove a package
pip list
Show installed packages
pip show requests
Show package information
pip install --upgrade requests
Upgrade a package
3. Meet the Virtual Environment — Rahul’s Private Room
One day, Rahul works on two projects:
- Project A needs version 1 of a package.
- Project B needs version 2 of the same package.
Installing packages globally can cause conflicts. Rahul creates a separate room for each project, called a virtual environment.
Create one using:
python -m venv myenvActivate it on Windows:
myenv\Scripts\activateNow packages installed in this environment are kept separate from those in other environments.
Get Raveenanagar’s stories in your inbox
Join Medium for free to get updates from this writer.
To leave the environment:
deactivate4. Meet requirements.txt — Rahul's Shopping List
Rahul wants his friend to run the same project. His friend needs to know which packages to install.
Rahul creates a file named requirements.txt:
requests
numpy
flaskHe can save his installed package versions with:
pip freeze > requirements.txtHis friend can install the listed packages with:
pip install -r requirements.txtThis makes it easier to set up the project on another computer.
5. The Complete Story
Step 1: Build a project
Rahul starts writing a Python application.
Step 2: Install packages
Rahul uses pip to install the libraries he needs.
Step 3: Isolate the project
Rahul uses a virtual environment to manage dependencies separately.
Step 4: Share the project
Rahul shares requirements.txt so others can install the needed packages.
6. Other Python Package Managers
- pip — the standard, widely used Python package installer.
- Conda — manages packages and environments, including non-Python dependencies.
- Poetry — helps manage dependencies, project configuration, and packaging.
- uv — a fast tool for Python package and project management.
Remember the difference
Term
Simple meaning
Package
Ready-made code
Package manager
Tool to install and manage packages
pip
A Python package installer
Virtual environment
An isolated space for a project
requirements.txt
A list of project dependencies
The main lesson: A package manager is like a shopping assistant for your Python project. It helps you get the code you need without building every feature from scratch.






