Symptom
import tenacity raises ModuleNotFoundError: No module named 'tenacity.asyncio'. The traceback is tenacity/__init__.py importing AsyncRetrying from tenacity.asyncio.
Evidence what you'll see
- The issue's example is
import tenacityand the stack linefrom tenacity.asyncio import AsyncRetrying. - The issue says tenacity 8.4.0 has this error and links the allowed range in
libs/core/pyproject.tomlplus tenacity issue 471.
Why it happens
tenacity 8.4.0 shipped that broken import, and LangChain's dependency range allowed it. Pull request 22973 stops the range from accepting 8.4.0. The langchain 0.2.6 notes state the range as >=8.1.0,<8.4.0 (#22973). The pull request title writes ^=8.1.0,!=8.4.0.
Affected versions
Python 3.11 and tenacity 8.4.0. The linked issue does not name an operating system.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- Run
python -c "import tenacity". It imports withoutModuleNotFoundError: No module named 'tenacity.asyncio'.
If it still fails
- A comment says to put the pin before another library that pulls tenacity back in. The example lists
tenacity==8.3.0above that library inrequirements.txt. - The linked issue does not describe a remaining failure after the 0.2.6 range exclusion.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it