error: can‘t find Rust compiler

操作系统 win11

pip install -r requirements.txt

报错如下

复制代码
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/56/fc/a3c13ded7b3057680c8ae95a9b6cc83e63657c38e0005c400a5d018a33a7/pyreadline3-3.4.1-py3-none-any.whl (95 kB)
Building wheels for collected packages: safetensors
  Building wheel for safetensors (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for safetensors (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\flax.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\numpy.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\paddle.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\tensorflow.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\torch.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\__init__.py -> build\lib.win-amd64-cpython-38\safetensors
      running build_ext
      running build_rust
      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 safetensors
Failed to build safetensors
ERROR: Could not build wheels for safetensors, which is required to install pyproject.toml-based projects

解决方法:

去官网下载安装rustup.rs - The Rust toolchain installer

下载完rustup-init.exe,运行安装,会出现窗口提示需要预先安装vs,按默认安装即可。等一会vs安装成功。

需要再次手动运行rustup-init.exe,这次就是正式安装了, 都按模型走即可。全部结束就安装成功了。

再去执行pip安装即可。

相关推荐
蒋星熠10 分钟前
Rust 异步生态实战:Tokio 调度、Pin/Unpin 与零拷贝 I/O
人工智能·后端·python·深度学习·rust
Include everything12 分钟前
Rust学习笔记(一)|Rust初体验 猜数游戏
笔记·学习·rust
公众号_醉鱼Java15 分钟前
Elasticsearch文档数迷思:深度解析count与stats背后机制
后端
Warren9824 分钟前
公司项目用户密码加密方案推荐(兼顾安全、可靠与通用性)
java·开发语言·前端·javascript·vue.js·python·安全
David爱编程28 分钟前
Java 编译期 vs 运行期:避开这些坑,少掉一半 Bug
java·后端
·白小白33 分钟前
【数据结构】——栈(Stack)的原理与实现
c语言·开发语言·数据结构
麦兜*1 小时前
Spring Boot调用优化版AI推理微服务 集成 NVIDIA NIM指南
java·人工智能·spring boot·后端·spring cloud·微服务·ai编程
野犬寒鸦1 小时前
Java Stream API 中常用方法复习及项目实战示例
java·服务器·开发语言·数据库
提笔惊蚂蚁2 小时前
Python 高级语法
开发语言·python
Moonbit2 小时前
# 量子位 AI 沙龙回顾丨用 MoonBit Pilot 解答 AI Coding 的未来
后端