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

No such file or directory: '_skbuild/linux-aarch64-3.8/cmake-install/python/cv2/__init__.py' #600

Closed
4 tasks done
twmht opened this issue Dec 28, 2021 · 14 comments
Closed
4 tasks done
Assignees

Comments

@twmht
Copy link

twmht commented Dec 28, 2021

Expected behaviour

Build wheel successfully on jetson xavier nx

Actual behaviour

Build wheel failed at the end of the build phase

  Traceback (most recent call last):
    File "/home/acer/.pyenv/versions/3.8.12/envs/nx-3.8.12/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/home/acer/.pyenv/versions/3.8.12/envs/nx-3.8.12/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/acer/.pyenv/versions/3.8.12/envs/nx-3.8.12/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-sleawhsc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 230, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-sleawhsc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-sleawhsc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 267, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/tmp/pip-build-env-sleawhsc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 501, in <module>
      main()
    File "setup.py", line 238, in main
      skbuild.setup(
    File "/tmp/pip-build-env-sleawhsc/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 625, in setup
      _classify_installed_files(cmake_manifest, package_data, package_prefixes,
    File "setup.py", line 371, in _classify_installed_files_override
      with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init:
  FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-aarch64-3.8/cmake-install/python/cv2/__init__.py'

See my log
log.txt

Steps to reproduce

git clone --recursive https://github.com/opencv/opencv-python.git
cd opencv-python
export CMAKE_ARGS="-DWITH_CUDA=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DCUDA_ARCH_BIN="7.2" -DCUDA_ARCH_PTX="" -DOPENCV_EXTRA_MODULES_PATH=/home/acer/opencv-python/opencv_contrib/modules -DWITH_GSTREAMER=ON -DWITH_LIBV4L=ON -DBUILD_opencv_python3=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/acer/opencv-python_build"
export ENABLE_CONTRIB=1
pip wheel . --verbose
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python
@asenyaev
Copy link
Contributor

I tried to reproduce this issue on Jetson nano, but without CUDA flags and did not faced the error. We had a hard dependency on __init__.py file recently, but it has been fixed (#571). Do you use the latest version of repository? Could you try to build with a tag 62 or if the issue will happen again, to try with 60 tag (to check regression)?

My steps to reproduce w/o CUDA:

git clone --recursive https://github.com/opencv/opencv-python.git && cd opencv-python
export CMAKE_ARGS="-DENABLE_PRECOMPILED_HEADERS=OFF   -DWITH_GSTREAMER=ON -DWITH_LIBV4L=ON -DBUILD_opencv_python3=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=RELEASE"
export ENABLE_CONTRIB=1
python3.6 -m pip wheel . --verbose

@mnik17
Copy link

mnik17 commented Dec 30, 2021

Hi @asenyaev,

I just got the same error, but this might be due to compatibility issues. I happen to need OpenCV 2.4.13 as a dependency of another project, so I was following this post's steps. Additionally I run Ubuntu 18.04 (in WSL2) and am using a Conda environment with Python 2.7.17. Pip version is 20.3.4.

The error message is as follows:

Copying files from CMake output
Traceback (most recent call last):
  File "setup.py", line 503, in <module>
    main()
  File "setup.py", line 280, in main
    cmake_source_dir=cmake_source_dir,
  File "/home/milen/.local/lib/python2.7/site-packages/skbuild/setuptools_wrap.py", line 629, in setup
    cmake_source_dir, skbuild_kw['cmake_install_dir'])
  File "setup.py", line 372, in _classify_installed_files_override
    with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init:
IOError: [Errno 2] No such file or directory: '_skbuild/linux-x86_64-2.7/cmake-install/python/cv2/__init__.py'

Any idea what can I do to fix this issue?

@alalek
Copy link
Member

alalek commented Dec 30, 2021

using a Conda environment with Python 2.7.17.

It is unlikely that opencv-python still supports Python 2.7 (EOL in 2020).

need OpenCV 2.4.13

AFAIK, opencv-python doesn't have support for OpenCV 2.4 packages at all.


Try to build OpenCV Python bindings from OpenCV upstream source code.

@mnik17
Copy link

mnik17 commented Dec 30, 2021

AFAIK, opencv-python doesn't have support for OpenCV 2.4 packages at all.

I'm not sure what you mean, but I found that the package, which is installable with pip, that is opencv-python or opencv-contrib-python have no support for 2.4.

Try to build OpenCV Python bindings from OpenCV upstream source code.

Again, what I did was, what was described in the stack overflow post, namely:

  1. Clone the repositorty from https://github.com/skvark/opencv-python.git
  2. Go into the opencv folder
  3. Checkout 2.4
  4. Run python setup.py bdist_wheel

Everything worked up untill step 4, where after building everything successfully, it started installing some thng in the opencv-python\_skbuild folder, until it threw the error, which I posted above.

Honestly speaking I've never had any issues with OpenCV, so I might be misunderstanding you, in which case I'm sorry.

@alalek
Copy link
Member

alalek commented Dec 30, 2021

Try 3.4 branch of opencv-python repository. Not the "master" branch.

@mnik17 Please don't hijack issue with unrelated comments.


@twmht Your problem is here:

-DCMAKE_INSTALL_PREFIX=/home/acer/opencv-python_build

You should not hijack installation location.
It breaks setup.py expectations.

@twmht
Copy link
Author

twmht commented Dec 31, 2021

@alalek

you are right.

but where can i find the wheel after the build? I can't find something like dist under _skbuild.

@twmht
Copy link
Author

twmht commented Dec 31, 2021

ok. got solved.

@twmht twmht closed this as completed Dec 31, 2021
@kb173
Copy link

kb173 commented Feb 1, 2022

Sorry for reviving this issue, but I just tried installing OpenCV on a fairly fresh Raspberry Pi using pip3 install opencv-python and ran into this exact error:

      Configuring Project
        Working directory:
          /tmp/pip-install-xvyvk7gz/opencv-python_5f1967d02aeb4557a27e0369b19c3ac5/_skbuild/linux-armv7l-3.7/cmake-build
        Command:
          cmake /tmp/pip-install-xvyvk7gz/opencv-python_5f1967d02aeb4557a27e0369b19c3ac5/opencv -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-xvyvk7gz/opencv-python_5f1967d02aeb4557a27e0369b19c3ac5/_skbuild/linux-armv7l-3.7/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 -DPYTHON_VERSION_STRING:STRING=3.7.3 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.7m -DPYTHON_LIBRARY:FILEPATH=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-zshau83j/overlay/lib/python3.7/site-packages/skbuild/resources/cmake -DPYTHON3_EXECUTABLE=/usr/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON3_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so -DBUILD_opencv_python3=ON -DBUILD_opencv_python2=OFF -DBUILD_opencv_java=OFF -DOPENCV_PYTHON3_INSTALL_PATH=python -DINSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_apps=OFF -DBUILD_opencv_freetype=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_DOCS=OFF -DPYTHON3_LIMITED_API=ON -DBUILD_OPENEXR=ON -DCMAKE_BUILD_TYPE:STRING=Release
      
      Copying files from CMake output
      Traceback (most recent call last):
        File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
          metadata_directory)
        File "/tmp/pip-build-env-zshau83j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 231, in build_wheel
          wheel_directory, config_settings)
        File "/tmp/pip-build-env-zshau83j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-zshau83j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 268, in run_setup
          self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-zshau83j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 502, in <module>
          main()
        File "setup.py", line 280, in main
          cmake_source_dir=cmake_source_dir,
        File "/tmp/pip-build-env-zshau83j/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 629, in setup
          cmake_source_dir, skbuild_kw['cmake_install_dir'])
        File "setup.py", line 372, in _classify_installed_files_override
          with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init:
      FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-armv7l-3.7/cmake-install/python/cv2/__init__.py'

Based on your comment @alalek, I assume this is the culprit: -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-xvyvk7gz/opencv-python_5f1967d02aeb4557a27e0369b19c3ac5/_skbuild/linux-armv7l-3.7/cmake-install

This was generated by pip, so please let me know if I need to report this somewhere else.

@LennyPhoenix
Copy link

@kb173 I am also having this issue on a new raspberry pi

@andyconda
Copy link

@kb173 me as well

@apatsekin
Copy link

same issue while trying to conda-build package - opencv-contrib-python

@Gittomcat
Copy link

same to me on Raspberry Pi4 4 GB:
with open(config_py, 'w') as opencv_init_config:
FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-aarch64-3.9/cmake-install/python/cv2/config-3.py'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for opencv-contrib-python

@shanyuyuyuer
Copy link

same to me on Raspberry Pi4 4 GB: with open(config_py, 'w') as opencv_init_config: FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-aarch64-3.9/cmake-install/python/cv2/config-3.py' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for opencv-contrib-python

"Hi there! Have you managed to resolve the code problem you were facing? Could you please share any updates or let me know if you need further assistance?"

@textronics
Copy link

For me 'pip3 install --upgrade pip' didn't work on python3 / piZero2

But: 'apt install python3-opencv' which will install the prebuilt wheel worked fine.

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