How to Install hypothesis in Python
The property-based testing library for Python
pip install hypothesis
What is hypothesis?
The property-based testing library for Python
Hypothesis is the property-based testing library for Python. With Hypothesis, you write tests which should pass for all inputs in whatever range you describe, and let Hypothesis randomly choose which of those inputs to check - including edge cases you might not have thought about. For example:
This randomized testing can catch bugs and edge cases that you didn't think of and wouldn't have found. In addition, when Hypothesis does find a bug, it doesn't just report any failing example — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.
fails with the simplest possible failing example:
Quick Start
Minimal example to get started with hypothesis:
import hypothesis
print(hypothesis.__version__)
Installation
pip (standard)
pip install hypothesis
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install hypothesis
pip3
pip3 install hypothesis
conda
conda install -c conda-forge hypothesis
Poetry
poetry add hypothesis
Dependencies
Installing hypothesis will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import hypothesis; print(hypothesis.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing hypothesis with pip.
ModuleNotFoundError: No module named 'hypothesis'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install hypothesis. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'hypothesis' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install hypothesis to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'hypothesis'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show hypothesis and upgrade with pip install --upgrade hypothesis.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install hypothesis. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user hypothesis
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org hypothesis
Recent Releases
| Version | Released |
|---|---|
6.151.12 latest |
2026-04-08 |
6.151.11 |
2026-04-05 |
6.151.10 |
2026-03-29 |
6.151.7 |
2026-02-16 |
6.151.8 |
2026-02-16 |
Manage hypothesis
Upgrade to latest version
pip install --upgrade hypothesis
Install a specific version
pip install hypothesis==6.151.12
Uninstall
pip uninstall hypothesis
Check what is installed
pip show hypothesis