Solution skill
ModuleNotFoundError: No module named 'attrs'
Complete solution
Fixes ModuleNotFoundError: No module named 'attrs' by installing hypothesis's missing dependency. Use when hypothesis's import chain breaks on attrs. Not for a missing hypothesis install.
TL;DR
Run python -m pip install attrs, or reinstall hypothesis with dependencies: python -m pip install --force-reinstall hypothesis. Hypothesis depends on attrs; skipping deps leaves it missing.
ModuleNotFoundError: No module named 'attrs'Fix it
Install the missing dep. Run
python -m pip install attrs.- Expected:
Successfully installed attrs-....
- Expected:
Verify. Run
python -c "import hypothesis; print('ok')".- Expected: prints
ok.
- Expected: prints
When this applies
- Importing hypothesis fails naming attrs.
- Minimal installs with
--no-deps.
When it does not apply
- If hypothesis itself is missing, install it first.
Tool compatibility
hypothesis 6.x requires attrs. Python 3.8+.
Why it happens
attrs is a hard dependency of hypothesis. Dependency-skipping installs break it.
Edge cases
- Note the package is
attrs(plural); the classic import isimport attrorimport attrs. Install the package name with pip.
Evidence
attrs is a declared runtime dependency of hypothesis (listed on its PyPI page at https://pypi.org/project/hypothesis/). The ModuleNotFoundError for it while hypothesis is installed is the signature of a --no-deps or partial install.
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_ghVQi-evn3ZFORcdjvbMAg" 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 'attrs' <span>— Vectle</span></a>