pandaspipubuntu-20.04erpnextfrappe

Building wheel for pandas on Ubuntu 20.04 takes more than 20 minutes, but not on 18.04


I have an installation script for ERPNext that works just fine on Ubuntu 18.04. When I run the same script on 20.04 I am obliged to wait more than 20 minutes for it to complete where it takes around 30 secs on 18.04.

My script includes these two lines:

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

Their output is:

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

The line "Building wheel for pandas (setup.py) ... /" is where the 20 min delay occurs.

This is all run from within the Frappe/ERPnext command directory, which has an embedded copy of pip3, like this:

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$ 

I would be most grateful for any suggestions how to speed it up.


Solution

  • Your issue may be less to do with your distribution and more to be with the Python version in your virtualenv. Ubuntu 20.04 has its default Python pointing to 3.8.

    From the pandas project listing on PyPI, your pip searches for a version that's compatible with your system, as provided by the project maintainers.

    It seems you're using CPython3.8. pandas==0.24.2 does not wheels built for your version, so your system builds them for itself each time. You can check the available download files from here.

    Possible Solutions:

    1. While creating your env, check out this answer to generate a virtual environment for a different version. Seems like your options are between 3.5, 3.6 and 3.7.
    2. Build a wheel for CPython3.8 and ship it along with your script. You can install your package from using that.