[Solved] transformers Install Error: error can‘t find rust compiler

Install transformers after reinstalling the system. If you encounter a bug, record it and check it later.

When reinstalling with pip install transformers command under windows, an error is reported:

error: can't find Rust compiler
      
    If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
      
    To update pip, run:
      
        pip install --upgrade pip
      
    and then retry package installation.
      
    If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
    [end of output]
  
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects

According to the error prompt, first run pip install -- upgrade pip is invalid, and then install Rust Compiler according to the error prompt. First go to the official website to download the corresponding installation package, select the 64-bit installation file according to my actual situation, then click the downloaded exe file to install, and select the default configuration during the installation process.

According to the instructions on the official website, all tools of rust are in the  ~/.cargo/bin directory includes commands:  rustc, cargo and rustup . Therefore, it needs to be configured into the environment variable, but windows will configure it automatically, but the configured environment variable will take effect only after restarting the computer under windows. After restarting, run the installation command again:

pip install transformers

The result is a successful installation. The screenshot is as follows:

Read More: