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

ImportError: cannot import name 'is_nltk_available' from 'transformers.utils.import_utils' #2560

Closed
stevendavis opened this issue Mar 27, 2024 · 1 comment · Fixed by #2574

Comments

@stevendavis
Copy link

Getting this error:

Traceback (most recent call last):
  File "qdrant-app.py", line 12, in <module>
    from sentence_transformers import SentenceTransformer
  File "/app/conda_envs/myenv/lib/python3.8/site-packages/sentence_transformers/__init__.py", line 3, in <module>
    from .datasets import SentencesDataset, ParallelSentencesDataset
  File "/app/conda_envs/myenv/lib/python3.8/site-packages/sentence_transformers/datasets/__init__.py", line 1, in <module>
    from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset
  File "/app/conda_envs/myenv/lib/python3.8/site-packages/sentence_transformers/datasets/DenoisingAutoEncoderDataset.py", line 5, in <module>
    from transformers.utils.import_utils import is_nltk_available, NLTK_IMPORT_ERROR
ImportError: cannot import name 'is_nltk_available' from 'transformers.utils.import_utils' (/app/conda_envs/myenv/lib/python3.8/site-packages/transformers/utils/import_utils.py)

I believe the problem is in setup.py install_requires.

transformers version must be new enough to have 'is_nltk_available'.

I think it was introduced in transformers 4.34, but I'm not 100% certain.

@tomaarsen
Copy link
Collaborator

Heya!

Thanks for reporting this; you're very right. And I believe it was indeed introduced in 4.34.0. I'll create a PR to increment the minimum transformers version accordingly.

  • Tom Aarsen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants