Pip install fails: 'Could not find a version that satisfies the requirement'
Pip can't find a compatible package version. Usually a Python version mismatch, missing dependencies, or a typo. Here's the fix.
Quick answer
Run python --version and check if the package supports your Python version. Then try pip install --only-binary :all: <package> or install a specific version like pip install <package>==1.2.3.
Why this happens
This error means pip searched PyPI (and any configured indexes) but couldn't find a wheel or source distribution that matches your environment. The culprit here is almost always one of three things: you're on a Python version the package dropped support for (e.g., Python 3.6 trying to install something that requires 3.9+), the package name is slightly wrong (yes, even one character matters), or a system dependency is missing — common with packages like psycopg2 or cryptography that compile native code. I've seen this trip up junior devs who copy-paste from an old blog post referencing Python 2-only packages.
Fix steps
- Verify your Python version:
python --version(orpython3 --versionon Linux). If it's below 3.7, you'll struggle with most modern packages. Upgrade to 3.9 or 3.10. - Check the package's PyPI page: Go to pypi.org/project/<package>/ and look at the 'Project description' or 'Download files' section. It'll list supported Python versions and OS requirements.
- Try a specific version:
pip install <package>==1.2.3— sometimes the latest version dropped support for your setup. Usepip install <package>==and press Tab to see available versions. - Use --only-binary:
pip install --only-binary :all: <package>forces pip to use pre-built wheels. This bypasses missing build dependencies. Does not help if no wheel exists for your OS/Python combo. - Install system dependencies: On Ubuntu/Debian, run
sudo apt-get install libssl-dev libffi-dev python3-devbefore retrying. On Fedora:sudo dnf install openssl-devel libffi-devel python3-devel. For Windows, install Microsoft C++ Build Tools from visualstudio.microsoft.com/visual-cpp-build-tools/. - Use a virtual environment:
python -m venv venv, thensource venv/bin/activate(orvenv\Scripts\activateon Windows). This isolates dependencies and avoids version conflicts. Try the install again. - Specify an alternative index: If you're behind a corporate proxy or using a private registry,
pip install --index-url https://your-registry.com/simple <package>. Also check if you need--trusted-host.
Alternative fixes if the main one fails
- Downgrade pip itself:
pip install pip==20.3.4— newer pip versions have stricter dependency resolution. I've seen this fix weird edge cases with legacy packages. - Use conda instead of pip: conda manages non-Python dependencies better.
conda install <package>— especially useful for scientific packages likenumpyorscipythat need BLAS/LAPACK. - Build from source: Clone the repo, run
python setup.py install. Only try this if you're comfortable with C compilers and missing headers. - Check your internet connection and proxy:
pip install --proxy http://user:pass@proxy:port <package>. Often overlooked, especially on corporate networks.
Prevention tip
Always pin your package versions in a requirements.txt file. Run pip freeze > requirements.txt after a successful install. This locks the exact version and prevents surprises when you deploy to a different environment. Also, use a virtual environment from day one. It'll save you hours of debugging later.
A real-world example: I once spent two hours on this error because a colleague named a package
my_packagein their code, but the actual package on PyPI wasmy-package(hyphen vs underscore). Pip doesn't fuzzy match. Triple-check the name.
Was this solution helpful?