swarm-lab / ROpenCVLite

Utility package to install OpenCV in R
https://swarm-lab.github.io/ROpenCVLite/
GNU General Public License v3.0
53 stars 17 forks source link

Problems installing ROpenCVLite package on Windows 10 locally, display() giving errors on Posit Cloud #40

Closed pcofoche closed 10 months ago

pcofoche commented 10 months ago

I have been having an issue with installing ROpenCVLite on my Windows 10 computer for several months. While the installation runs successfully, on Posit Cloud, it gives an error on the local machine and it has prevented me from using the package. Could you please help to look into this?

Many thanks, Paul

Here is my session info:

"R version 4.3.1 (2023-06-16 ucrt)" "ROpenCVLite_4.80.1"

Here is the installation code run: install.packages("ROpenCVLite") ROpenCVLite::installOpenCV()

Here is the error obtained below (also attached): [ 73%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/degeneracy.cpp.obj C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: internal error: aborting at ../../binutils-2.40/ld/ldlang.c:527 in compare_section C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: please report this bug [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/dls_solver.cpp.obj collect2.exe: error: ld returned 1 exit status make[2]: [modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:307: bin/libopencv_videoio480.dll] Error 1 [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/essential_solver.cpp.obj make[1]: [CMakeFiles/Makefile2:2946: modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 74%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/conv_1x1_fast_spv.cpp.obj [ 74%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/conv_depthwise_3x3_spv.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/estimator.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/fundamental_solver.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/gamma_values.cpp.obj [ 74%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/conv_depthwise_spv.cpp.obj [ 74%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/conv_implicit_gemm_spv.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/homography_solver.cpp.obj [ 74%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/gemm_spv.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/local_optimization.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/pnp_solver.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/quality.cpp.obj [ 74%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/ransac_solvers.cpp.obj [ 75%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/spv_shader.cpp.obj [ 75%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/sampler.cpp.obj [ 75%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/termination.cpp.obj [ 75%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/buffer.cpp.obj [ 75%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/command.cpp.obj [ 76%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/usac/utils.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/context.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/fence.cpp.obj [ 76%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/opencl_kernels_calib3d.cpp.obj [ 76%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/undistort.avx2.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/internal.cpp.obj [ 76%] Building RC object modules/calib3d/CMakeFiles/opencv_calib3d.dir/vs_version.rc.obj [ 76%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/opencv_calib3d_main.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_base.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_conv.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_matmul.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/pipeline.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/tensor.cpp.obj [ 76%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/vulkan/vk_functions.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/vulkan/vk_loader.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/opencl_kernels_dnn.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/cpu_kernels/conv_block.avx.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/cpu_kernels/conv_depthwise.avx.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/cpu_kernels/conv_winograd_f63.avx.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx2.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/int8layers/layers_common.avx2.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/cpu_kernels/conv_block.avx2.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/cpu_kernels/conv_depthwise.avx2.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/cpu_kernels/conv_winograd_f63.avx2.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx512_skx.cpp.obj [ 77%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/int8layers/layers_common.avx512_skx.cpp.obj [ 78%] Building RC object modules/dnn/CMakeFiles/opencv_dnn.dir/vs_version.rc.obj [ 78%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/opencv_dnn_main.cpp.obj [ 78%] Linking CXX shared library ../../bin/libopencv_dnn480.dll [ 78%] Linking CXX shared library ../../bin/libopencv_calib3d480.dll [ 78%] Built target opencv_calib3d [ 78%] Built target opencv_dnn make: [Makefile:166: all] Error 2 make: Leaving directory '/c/Users/PCOfoche/AppData/Local/Temp/RtmpmEnpaA/opencv-4.8.0/build64' make: Entering directory '/c/Users/PCOfoche/AppData/Local/Temp/RtmpmEnpaA/opencv-4.8.0/build64' [ 0%] Built target opencv_dnn_plugins [ 0%] Built target opencv_highgui_plugins Consolidate compiler generated dependencies of target jsimd [ 3%] Built target jsimd Consolidate compiler generated dependencies of target libopenjp2 [ 5%] Built target libopenjp2 [ 5%] Built target opencv_videoio_plugins Consolidate compiler generated dependencies of target zlib [ 7%] Built target zlib Consolidate compiler generated dependencies of target opencv_core [ 16%] Built target opencv_core Consolidate compiler generated dependencies of target opencv_flann [ 17%] Built target opencv_flann Consolidate compiler generated dependencies of target opencv_imgproc [ 24%] Built target opencv_imgproc Consolidate compiler generated dependencies of target opencv_ml [ 25%] Built target opencv_ml Consolidate compiler generated dependencies of target opencv_photo [ 26%] Built target opencv_photo Consolidate compiler generated dependencies of target libprotobuf [ 29%] Built target libprotobuf Consolidate compiler generated dependencies of target opencv_dnn [ 41%] Built target opencv_dnn Consolidate compiler generated dependencies of target opencv_features2d [ 43%] Built target opencv_features2d Consolidate compiler generated dependencies of target libjpeg-turbo [ 47%] Built target libjpeg-turbo Consolidate compiler generated dependencies of target libtiff [ 51%] Built target libtiff Consolidate compiler generated dependencies of target libwebp [ 60%] Built target libwebp Consolidate compiler generated dependencies of target libpng [ 61%] Built target libpng Consolidate compiler generated dependencies of target IlmImf [ 69%] Built target IlmImf Consolidate compiler generated dependencies of target opencv_imgcodecs [ 71%] Built target opencv_imgcodecs Consolidate compiler generated dependencies of target opencv_videoio [ 71%] Linking CXX shared library ../../bin/libopencv_videoio480.dll C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: internal error: aborting at ../../binutils-2.40/ld/ldlang.c:527 in compare_section C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: please report this bug collect2.exe: error: ld returned 1 exit status make[2]: [modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:307: bin/libopencv_videoio480.dll] Error 1 make[1]: [CMakeFiles/Makefile2:2946: modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 make: *** [Makefile:166: all] Error 2 make: Leaving directory '/c/Users/PCOfoche/AppData/Local/Temp/RtmpmEnpaA/opencv-4.8.0/build64' [1] FALSE

Error

display() also gives errors when the code is run on Posit Cloud, as shown below:

library(Rvision) balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision")) display(balloon, height = nrow(balloon), width = ncol(balloon))

library(Rvision) balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision")) display(balloon, height = nrow(balloon), width = ncol(balloon)) Error: OpenCV(4.8.0) /tmp/RtmpHxPqVd/opencv-4.8.0/modules/highgui/src/window.cpp:1272: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

Could you please help?

Thank you, Paul

Error2

############################################################################################################################################################################################################################################################################################################

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Computer (please complete the following information):

R (please complete the following information):

Additional context Add any other context about the problem here.

sjmgarnier commented 10 months ago

@pcofoche Thanks for reporting the two problems. For future reference, it's better to report each problem in separate issues (actually, one of the problems is linked to Rvision and should have been reported on the corresponding repository). This makes tracking progress on separate errors simpler for the developers (in this case, me).

Let's start with the easy one: it is normal that display() does NOT work on Posit Cloud (or on any RStudio Server for that matter). The reason is that display() requires access to the graphical user interface (GUI) of the server which is not possible through Posit Cloud and RStudio Server. These are essentially fancy web servers and they cannot access the GUI of the system they are running on (if any is available – the Posit Cloud server probably has none). You can use the plot() function instead on such servers. However, it is considerably slower than display() when it is available and won't be suitable for applications requiring live display.

Regarding the compilation problem with ROpenCVLite, the error message suggests that there was an earlier error message that was not included in your post. Could you please include the entire output of the compilation process if you can? That would be helpful to find the source of the problem. Thanks.

pcofoche commented 10 months ago

Here is the error displayed below:

System 1.docx

I also tried the installation on a different machine, and followed your guide: https://swarm-lab.github.io/ROpenCVLite/articles/install.html but despite installing Cmake and adding it to my "PATH", these errors still arise below:

System 2.docx

sjmgarnier commented 10 months ago

@pcofoche The error on the second machine is due to Cmake not being found on the PATH. You may need to log out and back in (or maybe even reboot) for your session to read the new path correctly.

sjmgarnier commented 10 months ago

@pcofoche In your first machine, the version of Cmake is quite old (3.24, the latest is 3.28). I would start by updating it before trying again to compile ROpenCVLite. The easiest way is through winget in an elevated Windows terminal or powershell (winget install kitware.cmake).

pcofoche commented 10 months ago

Thank you. I have restarted System 2, but this error appears.

[cid:48b1bfca-052f-46e9-a51e-9d69f5ef9013]


From: Simon Garnier @.> Sent: Thursday, December 7, 2023 3:22 PM To: swarm-lab/ROpenCVLite @.> Cc: pcofoche @.>; Mention @.> Subject: Re: [swarm-lab/ROpenCVLite] Problems installing ROpenCVLite package on Windows 10 locally, display() giving errors on Posit Cloud (Issue #40)

@pcofochehttps://github.com/pcofoche In your first machine, the version of Cmake is quite old (3.24, the latest is 3.28). I would start by updating it before trying again to compile ROpenCVLite. The easiest way is through winget in an elevated Windows terminal or powershell (winget install kitware.cmake).

— Reply to this email directly, view it on GitHubhttps://github.com/swarm-lab/ROpenCVLite/issues/40#issuecomment-1845542729, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGVCEIXCRRB64AI3J3KQIF3YIHNLXAVCNFSM6AAAAABAKFYSAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBVGU2DENZSHE. You are receiving this because you were mentioned.Message ID: @.***>

pcofoche commented 10 months ago

Sorry, here is the image.

Image.docx

sjmgarnier commented 10 months ago

@pcofoche This can happen when the download servers are unreachable. It's usually temporary. Try again in a few minutes.

pcofoche commented 10 months ago

Thanks a lot! I previously has Rtools42 but had to install Rtools43. The ("ROpenCVLite", "Rvision", and "remotes") packages are all now installed successful. I appreciate your help. Will go through your toot-orial examples and look forward to doing great things! As a minimal example, I tried to test the "display" function, but the R session crashes each time I run it either on a photo or a video.

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision")) display(balloon, height = nrow(balloon), width = ncol(balloon))

Image.docx

sjmgarnier commented 10 months ago

@pcofoche I will close this issue now. The error you mention was reported here https://github.com/swarm-lab/Rvision/issues/93 and here https://github.com/swarm-lab/trackR/issues/36. I'm looking into a solution.