Skip to content
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

pip install build issue #825

Open
DrBwts opened this issue Mar 30, 2023 · 3 comments
Open

pip install build issue #825

DrBwts opened this issue Mar 30, 2023 · 3 comments
Assignees

Comments

@DrBwts
Copy link

DrBwts commented Mar 30, 2023

Expected behaviour

I expected OpenCV's python API to install. I have used the same proceedure in numerous conda environments & have never had a problem like this. In fact it worked just fine yesterday in a different conda env

Actual behaviour

pip installer threw pages & pages of errors, c&p below

Steps to reproduce

As admin,
conda activate genicam

Then any of the following,

pip install opencv-contrib-python
pip install opencv-contrib-python --user
pip install opencv-python
pip install opencv-python --user

They all give the same pages & pages of errors

  • operating system - Win 10
  • architecture (e.g. x86) - x64
  • opencv-python version - 4.7.0.72

I would post the errors but "There was an error creating your Issue: body is too long (maximum is 65536 characters). "

So some highlights,

ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\envs\genicam\python.exe' 'C:\ProgramData\Anaconda3\envs\genicam\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\NICBWT~1\AppData\Local\Temp\tmp98_vz8u5'
       cwd: C:\Users\NICBWT~1\AppData\Local\Temp\pip-install-71z9rl7t\opencv-contrib-python_387a51900d48422f8ed4ed222402118d
  Complete output (1205 lines):


  --------------------------------------------------------------------------------
  -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Ninja

    does not support platform specification, but platform

      x64

    was specified.

The LOADS of stuff ending with...

ERROR: Could not build wheels for opencv-contrib-python, which is required to install pyproject.toml-based projects
@asmorkalov
Copy link
Collaborator

The logs piece says that pip tries to build the package from source, but does not use pre-built wheel. What is your python version? Python 3.6 was deprecated some time ago. 4.7.0.x was built for Python 3.7+.

@henryiii
Copy link
Contributor

FYI, it's better to drop 3.6 than to keep supporting it but not provide binaries. If you drop it, then Python 3.6 remain happy with their previously built binaries.

If you are on conda, you should be using conda to get most packages, I think.

You can attach a log file as a .txt by dragging it into GitHub's edit box.

@henryiii
Copy link
Contributor

henryiii commented Apr 11, 2023

Thought that error is caused by:

opencv-python/setup.py

Lines 189 to 192 in 6b73d90

if platform.machine() == "ARM64" and sys.platform == "win32"
# If it is not defined 'linker flags: /machine:X86' on Windows x64
else ["-DCMAKE_GENERATOR_PLATFORM=x64"] if is64 and sys.platform == "win32"
else []

Which is incorrect, scikit-build already handles the platform1, and adding a platform this way will break some of the generators, like ninja above.

The interesting error is likely the "MSVC" generator error. Though building from source on Conda with pip is tricky, as it ships its own compiler stack on some platforms, which you might not have installed.

Footnotes

  1. I'm pretty sure it does, as I remember writing this code, but it's possible I'm mixing it with something else. But if it is broken it needs to be fixed in scikit-build. Ahh, yes, it's here: https://github.com/scikit-build/scikit-build/blob/66339e23ad65f0c6f6a989c6707a4f2a05430748/skbuild/platform_specifics/abstract.py#L235-L236

@asmorkalov asmorkalov self-assigned this Apr 12, 2023
@asmorkalov asmorkalov changed the title pip install pip install build issue Apr 12, 2023
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