huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

Home Page:https://huggingface.co/transformers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to import transformers

notooth1 opened this issue · comments

I got this error when importing transformers. Please help.
My system is Debian 10, Anaconda3.

$ python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from transformers import pipeline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/__init__.py", line 2487, in __getattr__
    return super().__getattr__(name)
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/file_utils.py", line 1699, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/__init__.py", line 2481, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/home/notooth/anaconda3/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/pipelines/__init__.py", line 24, in <module>
    from ..modelcard import ModelCard
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/modelcard.py", line 31, in <module>
    from .models.auto.configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/models/__init__.py", line 19, in <module>
    from . import (
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/models/layoutlm/__init__.py", line 23, in <module>
    from .tokenization_layoutlm import LayoutLMTokenizer
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/models/layoutlm/tokenization_layoutlm.py", line 19, in <module>
    from ..bert.tokenization_bert import BertTokenizer
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/models/bert/tokenization_bert.py", line 23, in <module>
    from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/tokenization_utils.py", line 26, in <module>
    from .tokenization_utils_base import (
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 68, in <module>
    from tokenizers import AddedToken
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/tokenizers/__init__.py", line 79, in <module>
    from .tokenizers import (
ImportError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/notooth/anaconda3/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-x86_64-linux-gnu.so)

I think this is the same issue as huggingface/tokenizers#585

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

I am struggling with the same issue. Have you solved the problem?

commented

I am struggling with the same issue. Have you solved the problem?

use pip instead of conda:

conda uninstall tokenizers, transformers
pip install transformers

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

Solved this issue by downgrading to python 3.6 and conda 4.6.14

Solved this by downgrading from python 3.8 to 3.7

Solved this by doing pip install pytorch-transformers and then reload the notebook/application. I keep my python version 3.7.

Solved this by doing pip install pytorch-transformers and then reload the notebook/application. I keep my python version 3.7.

didn't work for me :(, details: #15062

Maybe your numpy version is too low, try again after updating

Maybe your numpy version is too low, try again after updating

pip install numpy==1.24.2 works

@kyxyxn how did you download python 3.6 . I am using colab and unable to downgrade the version. Any help is very appreciated.

@kyxyxn how did you download python 3.6 . I am using colab and unable to downgrade the version. Any help is very appreciated.

conda install python==3.6