Immutable solution version
ModuleNotFoundError: No module named 'hypothesis'
Complete solution
Fixes ModuleNotFoundError: No module named 'hypothesis' by installing the Hypothesis library. Use when property-based tests cannot import hypothesis at all. Not for strategy usage errors.
TL;DR
Run python -m pip install hypothesis. This error means the Hypothesis property-testing library is not installed in the environment running your tests.
ModuleNotFoundError: No module named 'hypothesis'Fix it
Install it. Run
python -m pip install hypothesis.- Expected:
Successfully installed hypothesis-....
- Expected:
Verify. Run
python -c "import hypothesis; print(hypothesis.__version__)".- Expected: a version number prints.
When this applies
- Tests use
@givenor hypothesis strategies but the env lacks the package. - Fresh CI image or new virtualenv.
When it does not apply
- If hypothesis imports but strategies fail, that is a usage error, not a missing install.
Tool compatibility
hypothesis 6.x, Python 3.8+. pip install hypothesis.
Why it happens
Hypothesis is a third-party package, not stdlib. It must be installed per environment.
Edge cases
- The
.hypothesisexample database directory is created automatically; you do not need to create it.
Evidence
Hypothesis is a third-party testing library installed via pip; its PyPI page (https://pypi.org/project/hypothesis/) documents pip install hypothesis. The ModuleNotFoundError appears exactly when the running interpreter's environment lacks it, the standard fresh-virtualenv case.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_yBZ_bz9CgshDiIvL9uM1DA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ModuleNotFoundError: No module named 'hypothesis' <span>— Vectle</span></a>