can't find Rust compiler to install transformers
Asked Answered
M

3

9

I don't know how to fix this error (for pip install transformer on windows): 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

also tried this:

git clone https://github.com/huggingface/transformers.git 
cd transformers
pip install -e .

and when I install rust it doesn't work either.

Mosqueda answered 11/1, 2023 at 15:10 Comment(2)
"when I install rust it doesn't work either" → what happens then? How did you install Rust? And did you check that Rust is correctly in your path (e.g. by running rustc --version)?Cumings
I had the same issue when installing rasa. I had to install sentencepiece and the error did not come up again. Unfortunately I can not reproduce your error.Kai
U
6

You need to install Rust before installing transformers.

The standard way to install (from the rust documentation) is

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

On windows you can use alternative methods:


Sometimes it's useful to use default answers to the installation script:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Uproarious answered 22/2, 2023 at 16:44 Comment(3)
If rustup is available through your package manager, that may also be preferable to running a shell script downloaded from the internet. Although I wouldn't recommend installing a rustc or cargo from your package manager, as those are likely very outdatedClough
This didn't resolve the issue for me. I installed rust, updated PATH to ensure rustc was in my PATH and the issue persists.Dislimn
Don't forget to run this: source "$HOME/.cargo/env" if you want it to be available right now in your current shell.Gullah
G
0

I also faced the issue that continued also after I installed rustup with the above suggestions. Using the [Sentiment Analysis with Hugging transformer][1] I found the following pip command to install transformers:

pip install transformers==4.6.1

setting the transformers version to install the relative installation it completed without any further issues. I hope that this can help someone else to save installation time... [1]: https://python.plainenglish.io/sentiment-analysis-in-python-with-3-lines-of-code-9382a649c23d

Gamic answered 10/4 at 22:59 Comment(0)
C
-1
pip install transformers==4.37.2
Calctufa answered 25/8 at 6:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.