安装transformers报错error can‘t find rust compiler

重装系统后安装transformers遇到bug,记录一下,方面以后查看。

Windows下使用pip install transformers命令重新安装时,却报错:

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

根据错误提示,首先运行pip install --upgrade pip无效,然后便根据错误的提示需要安装Rust Compiler,首先去其官网下载相应的安装包,根据本人的实际情况选择64位的安装文件,然后点击下载的exe文件进行安装,安装过程中选择默认(default)配置即可。

根据官网的说明Rust所有的工具都在~/.cargo/bin目录,包括rustccargorustup命令,因此需要将其配置到环境变量中,但Windows会进行自动配置,但是配置的环境变量在Windows下需要重启电脑才会生效。在重启后,再次运行安装命令:

pip install transformers

结果是安装成功,截图如下:

outcome

如果您无法成功安装transformers,可能会遇到以下几种问题和对应的解决办法: 1. 安装速度慢,出现TimeoutError:这种情况可以尝试使用镜像来进行安装。具体操作是使用以下命令来安装transformers: ``` pip install -i https://pypi.tuna.tsinghua.edu.cn/simple transformers ``` 2. 安装成功但在import时出现错误提示None of PyTorch, TensorFlow >= 2.0, or Flax have been found:这种情况可能是由于tensorflow和transformers使用了不同的安装方法导致的。解决办法是先卸载已安装transformers,然后在Anaconda Prompt中重新安装transformers: ``` pip uninstall transformers conda install transformers ``` 3. 环境变量配置问题:根据官方文档的说明,在Windows系统上,需要将Rust工具配置到环境变量中才能正确安装transformers。如果您的安装仍然无效,请确保重启电脑后再次运行以下命令进行安装: ``` pip install transformers ``` 希望以上解决办法能够帮助您成功安装transformers。如果问题仍然存在,请提供更多详细的错误信息,以便我们给出更准确的解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Transformers安装Error解决](https://blog.csdn.net/qq_42426451/article/details/112648009)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [安装transformers报错error can‘t find rust compiler](https://blog.csdn.net/qq_42103091/article/details/123751444)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

斯曦巍峨

码文不易,有条件的可以支持一下

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值