Why does pip install opencv-python also compiles it for hours?

From this docker image: node:12.18.3-buster if I run apt-get -y install python3-pip && pip3 install opencv-python it downloads this:

Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/bb/08/9dbc183a3ac6baa95fabf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gz (88.3MB)

And after that, it runs in some kind of compilation of OpenCV itself which actually last hours (!) on my laptop:

Building wheels for collected packages: opencv-python
  Running setup.py bdist_wheel for opencv-python: started
  Running setup.py bdist_wheel for opencv-python: still running...
  Running setup.py bdist_wheel for opencv-python: still running...
  Running setup.py bdist_wheel for opencv-python: still running...
  Running setup.py bdist_wheel for opencv-python: still running...
  Running setup.py bdist_wheel for opencv-python: still running...
  Running setup.py bdist_wheel for opencv-python: still running...
  Running setup.py bdist_wheel for opencv-python: still running...
  ...

But if I upgrade pip before using python3 -m pip install -U pip, and pip install --ugrade both setuptools and wheel it seems to not go into this time-consuming compilation phase, because the file downloaded is then no more a tar.gz file but a .whl:

Collecting opencv-python>=4.5.0
  Downloading opencv_python-4.5.1.48-cp37-cp37m-manylinux2014_x86_64.whl (50.4 MB)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.5.1.48

which is exactly the same version at the end...

I wonder why and what exactly does trigger this compilation in the first example where it has downloaded a tarball instead of a wheel?



Read more here: https://stackoverflow.com/questions/65708626/why-does-pip-install-opencv-python-also-compiles-it-for-hours

Content Attribution

This content was originally published by s.k at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: