Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: import errors due to Tenacity update #14190

Closed
evgerher opened this issue Jun 17, 2024 · 3 comments
Closed

[Bug]: import errors due to Tenacity update #14190

evgerher opened this issue Jun 17, 2024 · 3 comments
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@evgerher
Copy link

Bug Description

Tenacity library recently updated to v8.4.0 and they had broken some of the imports.
llama-index has no issues with it, current hot fix I used in pyproject.toml is next:

    "tenacity>=8.2.0,<8.4.0",
    "llama-index-core>=0.10.12",

The same issue as here

Version

0.10.45

Steps to Reproduce

from llama_index.core.schema import TextNode

Relevant Logs/Tracbacks

Stacktrace

    ...
    from llama_index.core.evaluation.base import BaseEvaluator
  File "/root/.pyenv/versions/3.10.6/lib/python3.10/site-packages/llama_index/core/evaluation/__init__.py", line 8, in <module>
    from llama_index.core.evaluation.batch_runner import BatchEvalRunner
  File "/root/.pyenv/versions/3.10.6/lib/python3.10/site-packages/llama_index/core/evaluation/batch_runner.py", line 2, in <module>
    from tenacity import retry, stop_after_attempt, wait_exponential
  File "/root/.pyenv/versions/3.10.6/lib/python3.10/site-packages/tenacity/__init__.py", line 653, in <module>
    from tenacity.asyncio import AsyncRetrying  # noqa:E402,I100
@evgerher evgerher added bug Something isn't working triage Issue needs to be triaged/prioritized labels Jun 17, 2024
@evgerher evgerher changed the title [Bug]: [Bug]: import errors due to Tenacity update Jun 17, 2024
Copy link

dosubot bot commented Jun 17, 2024

Hello, @evgerher! I'm here to assist you with bugs, questions, and becoming a contributor. Let's tackle this issue together.

To address the ModuleNotFoundError for tenacity.asyncio after updating the Tenacity library to version 8.4.0, you can update the import statements in the llama-index library to reflect the changes in the Tenacity library. In Tenacity version 8.0.0 and later, the asyncio module was removed. You should use the tenacity module directly for asynchronous functionality.

Here is an example of how you can update the import statements:

# Old import statement (before Tenacity 8.0.0)
# from tenacity.asyncio import AsyncRetrying

# New import statement (Tenacity 8.0.0 and later)
from tenacity import AsyncRetrying

Make sure to update all instances where tenacity.asyncio is imported in the llama-index library [1].

As a temporary workaround, you can pin the Tenacity version in your pyproject.toml file to a version before 8.4.0:

tenacity = ">=8.2.0,<8.4.0"

This should prevent the import issues until the necessary updates are made in the llama-index library.

To continue talking to Dosu, mention @dosu.

@ovuruska
Copy link
Contributor

@evgerher Thanks for the fix! Respect 🙏

@logan-markewich
Copy link
Collaborator

This should be fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized
Projects
None yet
Development

No branches or pull requests

3 participants