Ask Your Question
1

pip install opencv-python failing on raspberry pi zero w

asked 2020-08-13 21:59:23 -0600

whogben gravatar image

updated 2020-11-17 04:08:30 -0600

I am attempting to install opencv-python on a fresh Raspbian OS image on a raspberry pi zero w.

I am following an identical process that worked on a Raspberry Pi 4, and as far as I know it should work on the Zero W, but it takes 9 hours and has failed at the last second now twice.

I give the command: pip3 --no-cache-dir install opencv-python

It appears to finish the build and begin installing:

[100%] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/common/serialization.cpp.o
[100%] Linking CXX static library ../../lib/libopencv_gapi.a
[100%] Built target opencv_gapi
Install the project...
-- Install configuration: "Release"

But during the install, fails with this message:

-3.7/cmake-install/share/opencv4/lbpcascades/lbpcascade_silverware.xml
    Copying files from CMake output
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-3p_vs88q/opencv-python/setup.py", line 449, in <module>
        main()
      File "/tmp/pip-install-3p_vs88q/opencv-python/setup.py", line 249, in main
        cmake_source_dir=cmake_source_dir,
      File "/tmp/pip-build-env-nth6q3y6/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 625, in setup
        cmake_source_dir, skbuild_kw['cmake_install_dir'])
      File "/tmp/pip-install-3p_vs88q/opencv-python/setup.py", line 362, in _classify_installed_files_override
        raise Exception("Not found: '%s'" % relpath_re)
    Exception: Not found: 'python/cv2[^/]*\.cpython\-37m\-arm\-linux\-gnueabihf\.so'

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-3p_vs88q/opencv-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-xxbinhs6/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-3p_vs88q/opencv-python/

I don't know how to interpret this failure, and given I only get one shot at this install per day, I would appreciate any help you can offer.

Does anyone know a way to install this faster / better / with less likelihood of failure? I'm open to workarounds - I just want to get it working on my pi so I can continue my main project. Many thanks in advance for your time and thoughts!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-08-14 03:55:15 -0600

supra56 gravatar image
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-13 21:59:23 -0600

Seen: 5,517 times

Last updated: Aug 14 '20