Failing in install open-cv on a REVPI (possible reason is space)

#1

Hi Node-red Forums.

I'm working on a RevPI (which is basicalli a Pi, since it's based on its Compute Module) and wanted to use Open-CV-
This is a post on the steps I did, jump to the end for the possible main reason for the fail.
If you have any clues please answer.

If I try to install open-cv from terminal

npm install node-red-contrib-opencv

I have a very huge error that looks like this

npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.

> opencv@6.0.0 install /home/pi/node_modules/opencv
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-opencv.s3.amazonaws.com/opencv/v6.0.0/Release/node-v67-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for opencv@6.0.0 and node@11.6.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://node-opencv.s3.amazonaws.com/opencv/v6.0.0/Release/node-v67-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for opencv@6.0.0 and node@11.6.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
/home/pi/node_modules/opencv/utils/find-opencv.js:21
throw new Error("ERROR: failed to run: pkg-config", opencv, flag);

Error: ERROR: failed to run: pkg-config at /home/pi/node_modules/opencv/utils/find-opencv.js:21:23 at ChildProcess.exithandler (child_process.js:301:5) at ChildProcess.emit (events.js:188:13) at maybeClose (internal/child_process.js:978:16) at Socket.stream.socket.on (internal/child_process.js:395:11) at Socket.emit (events.js:188:13) at Pipe._handle.close (net.js:610:12)
gyp: Call to 'node utils/find-opencv.js --cflags' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
/home/pi/node_modules/opencv/utils/find-opencv.js:21 throw new Error("ERROR: failed to run: pkg-config", opencv, flag); ^

Error: ERROR: failed to run: pkg-config at /home/pi/node_modules/opencv/utils/find-opencv.js:21:23 at ChildProcess.exithandler (child_process.js:301:5) at ChildProcess.emit (events.js:188:13) at maybeClose (internal/child_process.js:978:16) at Socket.stream.socket.on (internal/child_process.js:395:11) at Socket.emit (events.js:188:13) at Pipe._handle.close (net.js:610:12)
gyp: Call to 'node utils/find-opencv.js --cflags' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error:gypfailed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:188:13)
gypgyp ERR! stackERR! configure error
at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gypgyp ERR! stack Error:gypfailed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:188:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12) gypERR! ERR! System Linux 4.9.76-rt60-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm/opencv.node" "-- module_name=opencv" "--module_path=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm"
gyp ERR! cwd /home/pi/node_modules/opencv gyp ERR! node -v v11.6.0 gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok System Linux 4.9.76-rt60-v7+ gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm/opencv.node" "--module_name=opencv" "--module_path=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm"
gyp ERR! cwd /home/pi/node_modules/opencv gyp ERR! node -v v11.6.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm/opencv.node --module_name=opencv --module_path=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:188:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5) node-pre-gyp ERR! System Linux 4.9.76-rt60-v7+ node-pre-gyp ERR! command "/usr/bin/node" "/home/pi/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/node_modules/opencv node-pre-gyp ERR! node -v v11.6.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.39 node-pre-gyp ERR! not ok Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm/opencv.node --module_name=opencv --module_path=/home/pi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v67-linux-arm' (1)
npm WARN opencv@6.0.0 had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions. npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN pi No description npm WARN pi No repository field. npm WARN pi No README data npm WARN pi No license field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! opencv@6.0.0 install:node-pre-gyp install --fallback-to-buildnpm ERR! Exit status 1 npm ERR! npm ERR! Failed at the opencv@6.0.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2019-01-17T16_32_19_420Z-debug.log

I followed then this tutorial, and followed step 2 (Install OpenCV 4 dependencies on your Raspberry Pi) and 3(Download OpenCV 4 for your Raspberry Pi), while jumped to step 5 (CMake and compile OpenCV 4 for your Raspberry Pi).

pi@RevPi8252:~/opencv-4.0.0/build $ cmake -D CMAKE_BUILD_TYPE=RELEASE \
> -D CMAKE_INSTALL_PREFIX=/usr/local \
> -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
> -D ENABLE_NEON=ON \
> -D ENABLE_VFPV3=ON \
> -D BUILD_TESTS=OFF \
> -D OPENCV_ENABLE_NONFREE=ON \
> -D INSTALL_PYTHON_EXAMPLES=OFF \
> -D BUILD_EXAMPLES=OFF ..
-- Looking for ccache - not found -- FP16 is not supported by C++ compiler
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR) -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8")
-- Checking for module 'gtk+-3.0'
-- Found gtk+-3.0, version 3.22.11 -- Checking for module 'gthread-2.0'
-- Found gthread-2.0, version 2.50.3 -- Checking for module 'gstreamer-base-1.0'
-- No package 'gstreamer-base-1.0' found -- Checking for module 'gstreamer-video-1.0' -- No package 'gstreamer-video-1.0' found -- Checking for module 'gstreamer-app-1.0' -- No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0' -- No package 'gstreamer-riff-1.0' found -- Checking for module 'gstreamer-pbutils-1.0' -- No package 'gstreamer-pbutils-1.0' found -- Checking for module 'gstreamer-base-0.10' -- No package 'gstreamer-base-0.10' found -- Checking for module 'gstreamer-video-0.10' -- No package 'gstreamer-video-0.10' found -- Checking for module 'gstreamer-app-0.10' -- No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10' -- No package 'gstreamer-riff-0.10' found -- Checking for module 'gstreamer-pbutils-0.10' -- No package 'gstreamer-pbutils-0.10' found -- Checking for module 'libdc1394-2' -- No package 'libdc1394-2' found -- Checking for module 'libdc1394' -- No package 'libdc1394' found -- Looking for linux/videodev2.h``CMake Error: Unable to open check cache file for write. /home/pi/opencv-4.0.0/build/CMakeFiles/CMakeTmp/CMakeFiles/cmake.check_cacheCMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Looking for linux/videodev2.h - not found-- Looking for sys/videoio.h
CMake Error: Unable to open check cache file for write. /home/pi/opencv-4.0.0/build/CMakeFiles/CMakeTmp/CMakeFiles/cmake.check_cache
CMake Error: Internal CMake error, TryCompile configure of cmake failed`
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
-- No package 'libavresample' found
CMake Error: Unable to open check cache file for write. /home/pi/opencv-4.0.0/build/CMakeFiles/CMakeTmp/CMakeFiles/cmake.check_cache
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- WARNING: Can't build ffmpeg test code
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
-- A library with BLAS API not found. Please specify library location.
-- LAPACK requires BLAS
-- A library with LAPACK API not found. Please specify library location.
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
CMake Error: Unable to open check cache file for write. /home/pi/opencv-4.0.0/build/CMakeFiles/CMakeTmp/CMakeFiles/cmake.check_cache
CMake Error: Internal CMake error, TryCompile configure of cmake failed
CMake Warning at cmake/OpenCVDetectOpenCL.cmake:28 (message):
Can't use OpenCL
Call Stack (most recent call first):
CMakeLists.txt:681 (include)

-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
CMake Error at cmake/OpenCVModule.cmake:288 (message):
  No modules has been found: /home/pi/opencv_contrib/modules
Call Stack (most recent call first):
  cmake/OpenCVModule.cmake:370 (_glob_locations)
  modules/CMakeLists.txt:7 (ocv_glob_modules)


`-- OpenCV Python: during development append to PYTHONPATH: /home/pi/opencv-4.0.0/build/python_loader
-- Excluding from source files list: modules/imgproc/src/corner.avx.cpp
-- Excluding from source files list: modules/imgproc/src/filter.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
-- Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/pi/opencv-4.0.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out ocl4dnn source code
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
-- Excluding from source files list: modules/calib3d/src/undistort.avx2.cpp`
--
-- General configuration for OpenCV 4.0.0 =====================================
--   Version control:               unknown
--
--   Platform:
--     Timestamp:                   2019-01-17T16:20:28Z
--     Host:                        Linux 4.9.76-rt60-v7+ armv7l
--     CMake:                       3.7.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--
--   CPU/HW features:
--     Baseline:                    VFPV3 NEON
--       requested:                 DETECT
--       required:                  VFPV3 NEON
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 6.3.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfp16-format=ieee -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfp16-format=ieee -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):
--     Linker flags (Debug):
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python2 python3 python_bindings_generator stitching ts video videoio
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 java js
--     Applications:                perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         YES
--
--   GUI:
--     GTK+:                        YES (ver 3.22.11)
--       GThread :                  YES (ver 2.50.3)
--       GtkGlExt:                  NO
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                        /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver 62)
--     WEBP:                        build (ver encoder: 0x020e)
--     PNG:                         /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
--     TIFF:                        /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
--
--   Video I/O:
--     DC1394:                      NO
--     FFMPEG:                      NO
--       avcodec:                   YES (ver 57.64.101)
--       avformat:                  YES (ver 57.56.101)
--       avutil:                    YES (ver 55.34.101)
--       swscale:                   YES (ver 4.2.100)
--       avresample:                NO
--     GStreamer:                   NO
--     v4l/v4l2:                    NO
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (built-in)
--
--   Other third-party libraries:
--     Lapack:                      NO
--     Eigen:                       NO
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
--
--   OpenCL:                        NO
--
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.13)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python2.7/dist-packages
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.3)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
--     numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python3.5/dist-packages
--   Python (for build):            /usr/bin/python2.7
--
**--   Java:**
**--     ant:                         NO
**--     JNI:                         NO
**--     Java wrappers:               NO
**--     Java tests:                  NO
**--**
**--   Install to:                    /usr/local
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!`
`See also "/home/pi/opencv-4.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/opencv-4.0.0/build/CMakeFiles/CMakeError.log".`

Possible reasons for this not to be working: the SD of the revpi (not even an SD) is just 4 Gb.

If I run

pi@RevPi8252:~/opencv-4.0.0/build $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 3.5G 3.2G 99M 98% / devtmpfs 459M 0 459M 0% /dev tmpfs 464M 0 464M 0% /dev/shm tmpfs 464M 47M 417M 11% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 464M 0 464M 0% /sys/fs/cgroup /dev/mmcblk0p1 42M 22M 20M 53% /boot tmpfs 93M 0 93M 0% /run/user/1000

While I'll try to replicate the whole experiment on a standard 16Gb Pi3, do you have any suggestions for this to be working with an external memory? any guides or workarounds?

Keep you posted.

d

0 Likes

#2

If you are installing a node-red node using the command line you need to be in you .node-red directory to do it.

> opencv@6.0.0 install /home/pi/node_modules/opencv

suggests you weren’t

0 Likes

#3

thanks will test

0 Likes