Pip is the OG package manager for Python.
It’s the most widely supported one…
But it has all sorts of limitations, just like all other good “old” technologies.

Here are the 5 facts you should (probably) know about pip…
And the last one is why using pip today might not be the best idea.
1. Use pip through Python
The primary purpose of pip is to manage packages.

But you don't really have to install pip because it's likely that you have it installed together with your Python binary, so you can just run this:
python -m pip install <package>
2. Global Environment
Pip installs packages globally by default.
What it means is that all projects on your computer share the same set of packages.

This is problematic. If you
Install OpenCV 3.0 in one project
Install OpenCV 4.0 in another project
The second installation will override the first one

It's unlikely that your first project code supports both versions of OpenCV.
To fix that, you use a virtual environment.
3. Virtual environment
Think of a virtual environment as an isolated workspace.
Instead of installing packages globally, you create a local virtual environment for each project.

To do that, run venv in a project folder.
This creates a virtual environment.
What happens is:
pip installnow installed packages locally in this virtual environmentYou can run
pip installeven if you were using something like pip3 or python -m pip
This way, every project can have its own packages.
4. Pip freeze
When you share your project with other developers, they need a way to install the same dependencies as you do.
How do you do that?
You put the list of your project packages into a file called "requirements.txt."
There are two common ways to create and maintain this file.
Option 1: Manually
You can type your project's dependencies directly in requirements.txt:
opencv-python>=4.0
requests>=2.0
Other developers can then install everything with:
pip install -r requirements.txt
Option 2: Generate It Automatically
You can install the package first, then run:
pip freeze > requirements.txt
This command scans the current environment and pins all installed packages (including those you installed their subdependencies) and their exact versions into the file.
opencv-python==4.10.0.84
requests==2.32.3
5. Pip alone sucks, kind of
When I say that Pip comes with problems, one of the main issues is that it's very clunky to maintain the versions of your packages.
If you specify version ranges in the requirements.txt file, the problem is that this doesn't produce a final lock file that is reproducible and consistent.

But if you use "pip freeze", it creates a fixed version of the packages for your code, which makes it difficult when you want to update a certain package.
To solve this problem, people have created other tools and package managers, like Poetry and UV. But those are topics for another article.
To recap:
You can use pip through Python
Pip installs packages globally by default
Use a virtual environment to avoid dependency conflicts
Use pip freeze and requirements.txt to maintain your packages
Pip doesn’t provide good lock-file management
—Fee from Anime Coders
PS: Recently I've been using Python again on a new project, and inevitably I have to deal with pip because many Python projects still use that. I have a good idea of how package managers work, but pip still confuses me. For example, what do you mean I have to run a separate command (pip freeze) just to add a package I've already installed to my project? If you have found pip confusing in some ways, hopefully this article clears it up a bit.
PPS: If you have signed up for the Docker waitlist… yes, I’m working on it, and I’m making sure that it passes my unreasonable standard (perfectionism + procrastination sucks).
Porkbun is the domain name registrar you need.
Still using GoDaddy or Namecheap? There’s a better way with Porkbun!
Porkbun is the domain registrar trusted by creators, developers, entrepreneurs, and folks who want low prices without the nonsense.
Why people are choosing Porkbun:
• Most domains sold at cost
• Low, transparent registration and renewal pricing
• Free features like WHOIS privacy and SSL certificates
• Powerful web and email hosting options
• Real human support 24/7, 365 days a year
• Named the #1 domain registrar by Forbes Advisor and USA Today
For launching a business, building a personal brand, starting a side project, or creating your first website, Porkbun makes it easy.
Get $1 off your next domain registration with Porkbun now.


