paddlehub下载时onnx下载失败

0 前言

我下载paddlehub的时候(pip install paddlehub)遇到了这个问题。实际上pip install onnx=1.8.1的时候也会有这个问题。

note: This error originates from a subprocess, and is likely not a problem with pipERROR: Failed building wheelfor onnx
ailed to build onnxIRROR: Could not build wheels for onnx, which is required to install pyproject. toml-based projects

原因是这个版本的onnx依赖于旧版本的python3.8,并不支持高版本的python(会缺少前置文件)。

具体问题看他们github上的讨论issue4376

1 解决办法

将你环境中的python降级为python3.8

以我conda的虚拟环境为例, 我原来虚拟环境中的版本是python3.10:

  1. conda install python=3.8 降级python
  2. 继续执行pip install paddlehub命令即可

2 其他问题

针对paddlehub中某些模块,因为太久没有维护了,会出现:

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.

是因为 numpy 版本升级导致的兼容性问题,np.float 这个别名已经被弃用。

解决办法

conda install numpy==1.23.5

posted @ 2024-02-28 19:01  wenli7363  阅读(196)  评论(0编辑  收藏  举报