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

Build broken with latest scikit-build release (0.14.0) #648

Closed
clintlombard opened this issue Apr 6, 2022 · 11 comments
Closed

Build broken with latest scikit-build release (0.14.0) #648

clintlombard opened this issue Apr 6, 2022 · 11 comments

Comments

@clintlombard
Copy link

The latest release of scikit-build==0.14.0, is breaking the build.

When building a wheel (pip wheel .), the build crashes with the following error

Traceback (most recent call last):
  File "/opt/pyenv/versions/3.9.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
    main()
  File "/opt/pyenv/versions/3.9.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/opt/pyenv/versions/3.9.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 248, in build_wheel
    return _build_backend().build_wheel(wheel_directory, config_settings,
  File "/tmp/pip-build-env-awj8sday/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 244, in build_wheel
    return self._build_with_temp_dir(['bdist_wheel'], '.whl',
  File "/tmp/pip-build-env-awj8sday/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
    self.run_setup()
  File "/tmp/pip-build-env-awj8sday/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 281, in run_setup
    super(_BuildMetaLegacyBackend,
  File "/tmp/pip-build-env-awj8sday/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 462, in <module>
    main()
  File "setup.py", line 222, in main
    skbuild.setup(
  File "/tmp/pip-build-env-awj8sday/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 676, in setup
    _classify_installed_files(
  File "setup.py", line 402, in _classify_installed_files_override
    return (cls.wraps._classify_installed_files)(
TypeError: _classify_installed_files() got an unexpected keyword argument 'cmake_install_dir'
Building wheel for opencv-contrib-python (PEP 517): finished with status 'error'
ERROR: Failed building wheel for opencv-contrib-python
Failed to build opencv-contrib-python
ERROR: Failed to build one or more wheels

Note that OpenCV does successfully build.

I don't think it's relevant, but the following environment variables were set:

CMAKE_ARGS="\
    -D BUILD_ANDROID_EXAMPLES=OFF \
    -D BUILD_DOCS=OFF \
    -D BUILD_EXAMPLES=OFF \
    -D BUILD_IPP_IW=OFF \
    -D BUILD_ITT=OFF \
    -D BUILD_OPENCV_JAVA=OFF \
    -D BUILD_PERF_TESTS=OFF \
    -D BUILD_SHARED_LIBS=OFF \
    -D BUILD_TESTS=OFF \
    -D BUILD_opencv_apps=OFF \
    -D BUILD_opencv_freetype=ON \
    -D CMAKE_MAKE_PROGRAM=make \
    -D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
    -D ENABLE_FAST_MATH=1 \
    -D ENABLE_PRECOMPILED_HEADERS=OFF \
    -D INSTALL_C_EXAMPLES=OFF \
    -D INSTALL_PYTHON_EXAMPLES=OFF \
    -D INSTALL_TESTS=OFF \
    -D OPENCV_ENABLE_NONFREE=OFF \
    -D OPENCV_GENERATE_PKGCONFIG=YES \
    -D OPENCV_VULKAN=OFF \
    -D WITH_EIGEN=ON \
    -D WITH_FFMPEG=ON \
    -D WITH_GDAL=OFF \
    -D WITH_GSTREAMER=ON \
    -D WITH_GTK=OFF \
    -D WITH_IPP=OFF \
    -D WITH_JASPER=OFF \
    -D WITH_JPEG=ON \
    -D WITH_LAPACK=ON \
    -D WITH_OPENCL=ON \
    -D WITH_OPENEXR=OFF \
    -D WITH_OPENGL=ON \
    -D WITH_OPENJPEG=OFF \
    -D WITH_OPENNI=OFF \
    -D WITH_PNG=ON \
    -D WITH_PROTOBUF=OFF \
    -D WITH_QT=ON \
    -D WITH_TBB=ON \
    -D WITH_TIFF=OFF \
    -D WITH_V4L=ON \
    -D WITH_VTK=OFF \
    -D WITH_WEBP=OFF \
    -D WITH_XINE=OFF \
    "
ENABLE_CONTRIB=1

However, this is fixed by limiting the version in pyproject.toml to scikit-build!=0.14.0, i.e.

[build-system]
requires = [
  "setuptools", "wheel", "scikit-build!=0.14.0", "cmake", "pip",
  "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
  "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
  "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
  "numpy==1.19.3; python_version<='3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
  "numpy==1.21.0; python_version<='3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
  "numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
  "numpy==1.21.2; python_version>='3.10'"
]
@asmorkalov
Copy link
Collaborator

Most probably this pr fixes this issue: #637

@asenyaev
Copy link
Contributor

asenyaev commented Apr 7, 2022

#637 is merged into master, should fix this problem. Please, update your local opencv-python repository.

@asenyaev asenyaev closed this as completed Apr 7, 2022
@philiparvidsson
Copy link

I still cannot build with docker because of this exact issue - what do I do?

@Augustinio
Copy link

Augustinio commented May 9, 2022

pip3 install --no-binary=opencv-contrib-python opencv-contrib-python still triggers this exact same error for me

@skvark
Copy link
Member

skvark commented May 9, 2022

The last release was in March (https://github.com/opencv/opencv-python/releases) and the fix landed in April so it's not yet in PyPI. You'll have to clone this repository or wait for a new release.

@alalek
Copy link
Member

alalek commented May 19, 2022

@Augustinio Try pip install git+https://github.com/opencv/opencv-python.git to build from the HEAD of repository with latest fixes.

@lig
Copy link

lig commented May 25, 2022

Installing something in production blindly from a head branch of a remote repo is dangerous and could lead to unexpected behavior. It would be beneficial to make a new release that fixes building with advanced package managers like pip-tools and poetry.

@samwli
Copy link

samwli commented May 27, 2022

@Augustinio Try pip install git+https://github.com/opencv/opencv-python.git to build from the HEAD of repository with latest fixes.

I am working with a different package, mmpose, that initially won't install. Building from HEAD allows mmpose to install, but mmcv is no longer able to read videos (not a problem with my original install of opencv-python from source). Maybe there is some issue as @lig indicates?

@asmorkalov
Copy link
Collaborator

OpenCV team works on 4.6 release. Right now. The patched version will be officially released in a couple of weeks.

@Interpause
Copy link

Can the fix be backported to 4.5?

@cscanlin
Copy link

I needed to install opencv-python==4.4.0.46 and I was able to fix this issue with the following commands:

pip install cmake==3.20.5 scikit-build==0.13.1 setuptools==50.3.2 wheel==0.30.0
pip install opencv-python==4.4.0.46 --no-build-isolation

The critical part is the --no-build-isolation flag. Without it, pip will create a separate environment to build opencv-python. This environment uses the pyproject.toml [build-system.requires] block to specify dependencies, which had the scikit-build version unpinned, so the latest version was always used.

When specifying --no-build-isolation, the dependencies must be installed manually first. The scikit-build version must be less than 0.14.0, but there may be a bit more flexibility with the other versions.

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