Problem installing using conda

Hey everone. I’m trying to install transformers and datasets package using conda.

I installed pytorch using conda, and I’m using miniconda with python version 3.7. My environment is also using python 3.7.

Installation of transformers using the command

conda install -c huggingface transformers

works, but when testing the installation I get

from transformers import pipeline
Traceback (most recent call last):
File “”, line 1, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/init.py”, line 43, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/dependency_versions_check.py”, line 36, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/file_utils.py”, line 56, in
ModuleNotFoundError: No module named ‘importlib_metadata’

conda install importlib-metadata
File “”, line 1
conda install importlib-metadata
^
SyntaxError: invalid syntax

I thought possibly the following would solve it

conda install importlib-metadata

But when testing the installation I still get trouble:

from transformers import pipeline
Traceback (most recent call last):
File “”, line 1, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/init.py”, line 2310, in getattr
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/file_utils.py”, line 1660, in getattr
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/init.py”, line 2304, in _get_module
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/pipelines/init.py”, line 24, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/modelcard.py”, line 31, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/models/init.py”, line 19, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/models/mt5/init.py”, line 36, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/models/t5/tokenization_t5_fast.py”, line 23, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/transformers-4.4.2-py3.8.egg/transformers/tokenization_utils_fast.py”, line 25, in
File “/home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/tokenizers/init.py”, line 79, in
from .tokenizers import (
ImportError: /lib64/libm.so.6: version `GLIBC_2.29’ not found (required by /home/nfs/tjviering/envs/torch3/lib/python3.7/site-packages/tokenizers/tokenizers.cpython-37m-x86_64-linux-gnu.so)

Any help would be greatly appreciated!

For anyone wondering how to fix this issue, I found that when using the channel conda-forge there is no issue at all. So the fix:

conda install -c conda-forge transformers
conda install importlib-metadata

Ha thanks, Tom! I had the same import error “version `GLIBC_2.29’ not found”, uninstalling and reinstalling using conda-forge fixed the problem! Thanks again!