pip is Python's package installer that comes bundled with Python 3.4+. You run pip install requests
and it downloads packages from PyPI. Most of the time this works fine. When it doesn't work, you'll spend hours debugging dependency conflicts while questioning your life choices.
What pip Actually Does
pip downloads Python packages and tries to figure out dependencies. When it works, great. When it doesn't, you'll be debugging version conflicts for hours. When you install one package that needs numpy>=1.20
and another that needs numpy<1.19
, pip will shit the bed and make you fix it manually.
Most of the time you'll use pip for:
Installing shit: pip install pandas flask requests
gets you the basics for most web projects. pip will download these packages and their dependencies, usually without breaking anything. Check Flask's documentation and Requests docs for usage guides.
Pinning versions: pip install Django==4.2.7
locks you to a specific version because you learned the hard way that automatic updates break production. Always pin your versions in requirements.txt unless you enjoy debugging mysterious failures at 3am. See the Django release notes to understand version differences.
Virtual environments: Use python -m venv myenv
then activate it before installing anything. Install packages globally and you'll eventually break your system Python. I've learned this lesson twice - don't be me. Read the virtual environment guide for more details.
Requirements files: Create requirements.txt
with exact versions and use pip install -r requirements.txt
to recreate environments. Works great until someone on your team uses macOS and you use Linux and the dependencies don't quite match. Check the pip documentation for requirements file syntax.
When pip Breaks (Not If, When)
pip will fail in creative ways:
- Building C extensions on Windows feels like medieval torture
- SSL certificate errors on corporate networks with MITM proxies
- Cache corruption that makes every install fail with cryptic errors
- Dependency conflicts where package A needs X>=2.0 and package B needs X<2.0
- The dreaded "No module named pip" after you accidentally broke something
The error messages tell you absolutely nothing. "Could not find a version" - which version? Of what? Thanks for nothing, pip. The PyPA troubleshooting guide might help with common issues.
Version 25.2 and Modern pip
Current pip (version 25.2 as of July 2025) has a better dependency resolver than older versions. It still can't perform miracles, but at least the error messages are slightly more helpful. The new resolver added in version 20.3 tries harder to find compatible versions before giving up.
pip supports installing from Git repos, local directories, and custom PyPI indexes. Most people never use these features, but they're there when you need to install an unreleased version or your company's internal packages.
The Survival Commands
python -m pip install package_name
- use this form to avoid path confusionpip freeze > requirements.txt
- snapshot your current environmentpip list --outdated
- see what needs updating (proceed with caution)pip cache purge
- nuclear option when the cache gets corruptedpip uninstall package_name
- remove packages (usually works)
Now that you understand what pip is and when it breaks, let's cover the actual commands you'll need to survive daily development.