29

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.

Martin Bramwell
  • 2,003
  • 2
  • 19
  • 35

4 Answers4

27

I just update pip using pip install --upgrade pip and it solved.

Mohammad Anvari
  • 567
  • 5
  • 8
20

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.
gavin
  • 793
  • 1
  • 7
  • 19
  • That certainly sounds like an authoritative answer. It's 5 years since I did much with Python, so I'm going to need a bit of research into the alternatives you suggest. Very grateful. Thank you. – Martin Bramwell Jul 14 '20 at 09:14
  • [frappe/frappe](https://github.com/frappe/frappe) v12 is (ci) tested on, and compatible with py3.6 and py2.7 whereas v13 is tested with 3.7; you should not face any issues with them (Unless your frappe apps require py3.8+) – gavin Jul 16 '20 at 05:49
  • 1
    Does the wheel build finish eventually? Because trying to install an older python version was certainly not a time saver – Sam Feb 21 '21 at 13:00
  • [I created a script to install python3.7](https://stackoverflow.com/a/66485379/6331353) – Sam Mar 12 '21 at 16:20
  • 1
    THANKS! This fixed it for me...If it is prebuilt, then it is lightening fast! So...beware the version mismatch between newer python and older pandas, and pick one that is prebuilt in the provided link! – K.S. Mar 16 '21 at 01:51
  • Is there a list of old wheels anywhere? I couldn't find one, but I can confirm that there isn't a wheel for Python 3.10 and Pandas 2.4.3 -- I had to upgrade all the way to pandas 2.5.0 to avoid building the wheel myself. – Noumenon Oct 14 '22 at 18:02
0

I just changed python version from python to python:3.8 in my dockerfile. It worked fine for me.

starball
  • 20,030
  • 7
  • 43
  • 238
0

I removed a pandas version in requirements.txt and pandas was instantly installed without wheel

illuminato
  • 1,057
  • 1
  • 11
  • 33