tudou
tudou

Reputation: 515

Unable to build opencv-python with python 3.8

OS:ubuntu I am able to install opencv-python from the command line. However,when I tried to install my self-built package with opencv-python dependencies, it failed to biuld:

Building wheels for collected packages: opencv-python
  Building wheel for opencv-python (PEP 517): started
  Building wheel for opencv-python (PEP 517): finished with status 'error'
  ERROR: Complete output from command /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp7jntqv2r:
  ERROR: Not searching for unused variables given on the command line.
  CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  Not searching for unused variables given on the command line.
  CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".


-- Trying "Unix Makefiles" generator - failure
  --------------------------------------------------------------------------------
  
  ********************************************************************************
  scikit-build could not get a working generator for your system. Aborting build.
  
  Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
  It can be installed using debian package manager:
  
    sudo apt-get install build-essential
  
  To build compliant wheels, consider using the manylinux system described in PEP-513.
  Get it with "dockcross/manylinux-x64" docker image:
  
    https://github.com/dockcross/dockcross#readme
  
  For more details, please refer to scikit-build documentation:
  
    http://scikit-build.readthedocs.io/en/latest/generators.html#linux
  
  ********************************************************************************
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python

I suspect issue is with scikit-build. I checked I have ninja, make/gcc all available. I set manually CMAKE_MAKE_PROGRAM=/usr/bin/make.

But still failed with same error. I

Upvotes: 1

Views: 7317

Answers (3)

xuanwu_yan
xuanwu_yan

Reputation: 11

Run pip3 install -U pip before install opencv-python.

Upvotes: 1

tudou
tudou

Reputation: 515

Finally figured out, when I installed locally I had a requirements with version 4.1.x and no issues. When I install with the dependencies, it fetches the latest version 4.4 and the issue is that 1) pip version is 19.1 and2) since 4.3 opencv, the wheels has been replaced.

Upvotes: 0

rayryeng
rayryeng

Reputation: 104493

You are missing dependencies. Please see this part of the error message you have provided above:

  Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
  It can be installed using debian package manager:
  
    sudo apt-get install build-essential

Therefore, please use apt-get to install the build tools required to build your package.

Upvotes: 7

Related Questions