Failed to import transformers

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
MusfiqDehancommented, May 14, 2022

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

10reactions
Leojccommented, 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
Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: Failed to import transformers.pipelines because ...
I am using the latest Tensorflow and Hugging Face Transformers. Tensorflow - 2.9.1; Transformers - 4.21.1. Notebook: pip install tensorflow
Read more >
How to resolve the hugging face error ImportError: cannot ...
I got the following error with code: from pathlib import Path import ... import name 'is_tokenizers_available' from 'transformers.utils'?
Read more >
transformers · PyPI
Transformers provides thousands of pretrained models to perform tasks on different ... from transformers import pipeline # Allocate a pipeline for ...
Read more >
Problem Loading Distil Bert | Data Science and ... - Kaggle
Hi everybody, I'm running the following code and getting an error loading distil bert: import torch !pip install transformers import transformers as ppb ......
Read more >
PyTorch-Transformers
import torch tokenizer = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', 'bert-base-uncased') # Download vocabulary from S3 and cache.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found