Fix ERROR: Could not build wheels for tokenizers which use PEP 517 and cannot be installed directly – Bert Tutorial

By | June 6, 2022

When we are installing transformers, we may get this error: ERROR: Could not build wheels for tokenizers which use PEP 517 and cannot be installed directly. In this tutorial, we will introduce you how to fix it.

Install transformers

We can use pip install command to install it. For example:

pip install -i https://mirrors.aliyun.com/pypi/simple/ transformers --trusted-host mirrors.aliyun.com

However, after running this command, we will get this error:

Fix ERROR: Could not build wheels for tokenizers which use PEP 517 and cannot be installed directly - Bert Tutorial

How to fix this error?

It is easy to fix, we can install transformers 2.4.1 version

For example:

pip install -i https://mirrors.aliyun.com/pypi/simple/ transformers==2.4.1 --trusted-host mirrors.aliyun.com

Run this command, we will find this error disappeared. transformers is installed successfully.