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

Failed to import transformers #11262

Closed
notooth1 opened this issue Apr 15, 2021 · 13 comments
Closed

Failed to import transformers #11262

notooth1 opened this issue Apr 15, 2021 · 13 comments

Comments

@notooth1
Copy link

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)
@LysandreJik
Copy link
Member

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

@github-actions
Copy link

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.

@nobellant215
Copy link

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

@Leojc
Copy link

Leojc commented May 19, 2021

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

use pip instead of conda:

conda uninstall tokenizers, transformers
pip install transformers

@github-actions
Copy link

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.

@kyxyxn
Copy link

kyxyxn commented Dec 22, 2021

Solved this issue by downgrading to python 3.6 and conda 4.6.14

@GeorgiosEtsias
Copy link

Solved this by downgrading from python 3.8 to 3.7

@MusfiqDehan
Copy link

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

@brando90
Copy link

brando90 commented Oct 3, 2022

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

@An-Jhon
Copy link

An-Jhon commented Oct 18, 2022

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

@scissorstail
Copy link

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

pip install numpy==1.24.2 works

@sudip-modi
Copy link

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

@Jeremylee1234
Copy link

@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

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

No branches or pull requests