【问题标题】:Building wheel for pandas on Ubuntu 20.04 takes more than 20 minutes, but not on 18.04在 Ubuntu 20.04 上为 pandas 构建轮子需要 20 多分钟,但在 18.04 上不需要
【发布时间】:2020-11-03 05:07:25
【问题描述】:

我有一个在 Ubuntu 18.04 上运行良好的 ERPNext 安装脚本。 当我在 20.04 运行相同的脚本时,我必须等待超过 20 分钟才能完成,而在 18.04 大约需要 30 秒。

我的脚本包括这两行:

  ./env/bin/pip install numpy==1.18.5
  ./env/bin/pip install pandas==0.24.2

他们的输出是:

Collecting numpy==1.18.5
  Downloading numpy-1.18.5-cp38-cp38-manylinux1_x86_64.whl (20.6 MB)
     |████████████████████████████████| 20.6 MB 138 kB/s 
Installing collected packages: numpy
Successfully installed numpy-1.18.5
Collecting pandas==0.24.2
  Downloading pandas-0.24.2.tar.gz (11.8 MB)
     |████████████████████████████████| 11.8 MB 18.0 MB/s 
Requirement already satisfied: python-dateutil>=2.5.0 in ./env/lib/python3.8/site-packages (from pandas==0.24.2) (2.8.1)
Requirement already satisfied: pytz>=2011k in ./env/lib/python3.8/site-packages (from pandas==0.24.2) (2019.3)
Requirement already satisfied: numpy>=1.12.0 in ./env/lib/python3.8/site-packages (from pandas==0.24.2) (1.18.5)
Requirement already satisfied: six>=1.5 in ./env/lib/python3.8/site-packages (from python-dateutil>=2.5.0->pandas==0.24.2) (1.13.0)
Building wheels for collected packages: pandas
  Building wheel for pandas (setup.py) ... done
  Created wheel for pandas: filename=pandas-0.24.2-cp38-cp38-linux_x86_64.whl size=43655329 sha256=0067caf3a351f263bec1f4aaa3e11c5857d0434db7f56bec7135f3c3f16c8c2b
  Stored in directory: /home/erpdev/.cache/pip/wheels/3d/17/1e/85f3aefe44d39a0b4055971ba075fa082be49dcb831db4e4ae
Successfully built pandas
Installing collected packages: pandas
Successfully installed pandas-0.24.2

“Building wheel for pandas (setup.py) ... /”行是 20 分钟延迟发生的地方。

这都是在 Frappe/ERPnext 命令目录中运行的,该目录具有 pip3 的嵌入式副本,如下所示:

erpdev@erpserver:~$ cd ~/frappe-bench/
erpdev@erpserver:~/frappe-bench$ ./env/bin/pip --version
pip 20.1.1 from /home/erpdev/frappe-bench/env/lib/python3.8/site-packages/pip (python 3.8)
erpdev@erpserver:~/frappe-bench$ 

如果有任何建议可以加快速度,我将不胜感激。

【问题讨论】:

    标签: pandas pip ubuntu-20.04 erpnext frappe


    【解决方案1】:

    我只是使用pip install --upgrade pip 更新pip 并解决了。

    【讨论】:

    • 正如@gavin 13 个月前指出的那样,直到最近才有可能。
    • 这似乎无法解决我的问题
    • 这对我有用。
    • 也与 Debian 10 一起使用。
    【解决方案2】:

    您的问题可能与您的发行版关系不大,而更多地与您的 virtualenv 中的 Python 版本有关。 Ubuntu 20.04 的默认 Python 指向 3.8

    PyPI 上的pandas 项目列表中,您的 pip 搜索与您的系统兼容的版本,由项目维护者提供。

    您似乎在使用CPython3.8pandas==0.24.2 不会为您的版本构建轮子,因此您的系统每次都会为自己构建它们。您可以从here查看可用的下载文件。

    可能的解决方案:

    1. 在创建env 时,检查this answer 以生成不同版本的虚拟环境。似乎您的选择介于 3.53.63.7 之间。
    2. CPython3.8 构建一个轮子并将其与您的脚本一起发布。您可以使用 that 安装您的软件包。

    【讨论】:

    • 这听起来像是一个权威的答案。自从我用 Python 做了很多事情已经 5 年了,所以我需要对你建议的替代方案进行一些研究。非常感谢。谢谢。
    • frappe/frappe v12 已在 (ci) 上进行了测试,并且与 py3.6 和 py2.7 兼容,而 v13 已在 3.7 上进行了测试;你不应该面对任何问题(除非你的 frappe 应用程序需要 py3.8+)
    • 造轮子最终会完成吗?因为尝试安装较旧的 python 版本肯定不能节省时间
    • 谢谢!这为我修复了它......如果它是预先构建的,那么它会快速发光!所以...请注意新版 python 和旧版 pandas 之间的版本不匹配,并选择一个在提供的链接中预构建的版本!
    猜你喜欢
    • 2021-07-25
    • 1970-01-01
    • 2018-12-24
    • 2020-01-17
    • 1970-01-01
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    相关资源
    最近更新 更多