在 Ubuntu 20.04 上为 pandas 构建轮子需要 20 多分钟,但在 18.04 上不需要

Mar*_*ell 12 pip pandas frappe erpnext ubuntu-20.04

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

我的脚本包括这两行:

  ./env/bin/pip install numpy==1.18.5
  ./env/bin/pip install pandas==0.24.2
Run Code Online (Sandbox Code Playgroud)

他们的输出是:

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
Run Code Online (Sandbox Code Playgroud)

“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$ 
Run Code Online (Sandbox Code Playgroud)

我将不胜感激任何有关如何加快速度的建议。

小智 27

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

  • 正如 @gavin 13 个月前指出的那样,直到最近这才成为可能。 (2认同)

gav*_*vin 8

您的问题可能与您的发行版无关,而与您的 virtualenv 中的 Python 版本有关。Ubuntu 20.04 的默认 Python 指向3.8.

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

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

可能的解决方案:

  1. 在创建您的 时env,请查看此答案以生成不同版本的虚拟环境。似乎您的选择介于3.5,3.6和之间3.7
  2. CPython3.8它构建一个轮子并将其与您的脚本一起发送。您可以使用来安装您的软件包。