Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 882
Martin Bramwell Avatar asked Jul 13 '20 22:07

Martin Bramwell


People also ask

How long does it take to install pandas?

There are several ways of going about installing Pandas on a computer. The methods listed in this post are fairly simple, and it shouldn't take you longer than five minutes to get Pandas set up on your machine.

Why is pip building wheel?

If you've installed a Python package using pip , then chances are that a wheel has made the installation faster and more efficient. Wheels are a component of the Python ecosystem that helps to make package installs just work. They allow for faster installations and more stability in the package distribution process.

Could not build wheels for pandas which do not use PEP 517?

To Solve ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly Error Just update your pip and your error will be solve. pip3 install –upgrade pip. this error solved just after update pip with setuptools wheel just run below command. pip install –upgrade pip setuptools wheel.

How do I import pandas into Python Ubuntu?

[Sumarry] 3 ways to install pandas on Ubuntu 20.04 Run sudo apt install python3-pip to install pip3 and Python 3 if they are not installed. Run pip3 install pandas to install pandas as a pyPI package. Run conda install pandas after you have install conda in Ubuntu 20.04.


2 Answers

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

like image 119
Mohammad Anvari Avatar answered Oct 24 '22 08:10

Mohammad Anvari


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.
like image 20
gavin Avatar answered Oct 24 '22 08:10

gavin