Skip to content

Building wheel for opencv-python (PEP 517) ... error on python-3.9.0 #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huzaifa-99 opened this issue Oct 29, 2020 · 2 comments
Closed

Comments

@huzaifa-99
Copy link

Error Installing OpenCv with python 3.9.0

I tried to install opencv with pip install opencv-python with python-3.9.0 version. It did not work and gave me this error

ERROR: Command errored out with exit status 1:
   command: 'e:\softwares\installed\python\python39\python.exe' 'e:\softwares\installed\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\huzai\AppData\Local\Temp\tmppecs_1iu'
       cwd: C:\Users\huzai\AppData\Local\Temp\pip-install-_tso37d_\opencv-python
  Complete output (153 lines):
  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 "C:/Users/huzai/AppData/Local/Temp/pip-install-_tso37d_/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  Not searching for unused variables given on the command line.
  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Visual Studio 15 2017 Win64

    could not find any instance of Visual Studio.



  -- Configuring incomplete, errors occurred!
  See also "C:/Users/huzai/AppData/Local/Temp/pip-install-_tso37d_/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  Not searching for unused variables given on the command line.
  -- The C compiler identification is unknown
  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
    The CMAKE_C_COMPILER:

      cl

    is not a full path and was not found in the PATH.

    To use the NMake generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/huzai/AppData/Local/Temp/pip-install-_tso37d_/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/huzai/AppData/Local/Temp/pip-install-_tso37d_/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
  Not searching for unused variables given on the command line.
  -- The C compiler identification is unknown
  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
    The CMAKE_C_COMPILER:

      cl

    is not a full path and was not found in the PATH.

    To use the JOM generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/huzai/AppData/Local/Temp/pip-install-_tso37d_/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/huzai/AppData/Local/Temp/pip-install-_tso37d_/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeError.log".


  --------------------------------------------------------------------------------
  -- Trying "Ninja (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja (Visual Studio 15 2017 Win64 v141)" generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying "Visual Studio 15 2017 Win64 v141" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Visual Studio 15 2017 Win64 v141" generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying "NMake Makefiles (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles (Visual Studio 15 2017 Win64 v141)" generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying "NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)" generator - failure
  --------------------------------------------------------------------------------

  ********************************************************************************
  scikit-build could not get a working generator for your system. Aborting build.

  Building windows wheels for Python 3.9 requires Microsoft Visual Studio 2017.
  Get it with "Visual Studio 2017":

    https://visualstudio.microsoft.com/vs/

  ********************************************************************************
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

What could be causing this?

@skvark
Copy link
Member

skvark commented Oct 29, 2020

There are no wheels for Python 3.9 so pip tries to build from source. That fails because you do not have build tools installed as indicated by the error:

  scikit-build could not get a working generator for your system. Aborting build.

  Building windows wheels for Python 3.9 requires Microsoft Visual Studio 2017.
  Get it with "Visual Studio 2017":

    https://visualstudio.microsoft.com/vs/

Install the build tools or wait for the Python 3.9 pre-built packages: #382

@skvark skvark closed this as completed Oct 29, 2020
@07Agarg
Copy link

07Agarg commented Aug 29, 2022

How to resolve this issue? Can someone list the steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants