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

opencv installation error using ROpenCVLite #28

Closed aharmer closed 2 years ago

aharmer commented 2 years ago

Hi, I'm keep getting the below error when trying to use ROpenCVLite::installOpenCV(). I managed to install on a different computer but then couldn't install Rvision on that one. Any help wold be greatly appreciated.

OpenCV is not installed on this system. Would you like to install it now? This will take several minutes.

1: yes
2: no

Selection: 1
OpenCV will be installed in C:\Users\HarmerA\OneDrive - MWLR\Documents\R\win-library\4.1\ROpenCV
trying URL 'https://github.com/opencv/opencv/archive/4.6.0.tar.gz'
Content type 'application/x-gzip' length unknown
downloaded 86.0 MB

CMake Warning:
Ignoring extra path from command line:

"C:/Users/HarmerA/OneDrive - MWLR/Documents/MWLR/Documents/R/win-library/4.1/ROpenCV"

CMake Error: Unknown argument -
CMake Error: Run 'cmake --help' for all supported options.
make: Entering directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build64'
make: *** No targets specified and no makefile found. Stop.
make: Leaving directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build64'
make: Entering directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build64'
make: *** No rule to make target 'install'. Stop.
make: Leaving directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build64'
CMake Warning:
Ignoring extra path from command line:

"C:/Users/HarmerA/OneDrive - MWLR/Documents/MWLR/Documents/R/win-library/4.1/ROpenCV"

CMake Error: Unknown argument -
CMake Error: Run 'cmake --help' for all supported options.
make: Entering directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build32'
make: *** No targets specified and no makefile found. Stop.
make: Leaving directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build32'
make: Entering directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build32'
make: *** No rule to make target 'install'. Stop.
make: Leaving directory '/c/Users/HarmerA/AppData/Local/Temp/Rtmp6JN7fd/opencv-4.6.0/build32'
Warning messages:
1: In if (!grepl("40", pkgbuild::rtools_path())) { :
the condition has length > 1 and only the first element will be used
2: In if (!grepl("40", pkgbuild::rtools_path())) { :
the condition has length > 1 and only the first element will be used
sjmgarnier commented 2 years ago

@aharmer It's a known issue (see https://github.com/swarm-lab/ROpenCVLite/issues/6, https://github.com/swarm-lab/ROpenCVLite/issues/8, https://github.com/swarm-lab/ROpenCVLite/issues/19, https://github.com/swarm-lab/ROpenCVLite/issues/23) for which I'm afraid I don't have a solution but only a clunky workaround. It's caused by the spaces in the installation path (in "OneDrive - MWLR") that throw off the compiler on Windows. The only workaround I know of is to either move the R library location to a folder that has no space in its path or install ROpenCVLite in another R library folder (you can have several if I'm not mistaken) that has no space in its path. See here for some help with that: https://www.accelebrate.com/library/how-to-articles/r-rstudio-library.

aharmer commented 2 years ago

Thanks, that seems to have solved the opencv issue (and sorry didn't realise there were other closed issues).

However, now I am getting a new error when installing Rvision. Any thoughts?

...
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'Rvision' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Users/HarmerA/Rpackages/Rvision/libs/i386/Rvision.dll':
  LoadLibrary failure:  The specified module could not be found.

Error: loading failed
Execution halted
*** arch - x64
Error: package or namespace load failed for 'Rvision' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Users/HarmerA/Rpackages/Rvision/libs/x64/Rvision.dll':
  LoadLibrary failure:  The specified module could not be found.

Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/HarmerA/Rpackages/Rvision'
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/HarmerA/AppData/Local/Temp/RtmpMTIxMu/file2afc4fe0535c/Rvision_0.6.2.tar.gz’ had non-zero exit status
sjmgarnier commented 2 years ago

@aharmer I could reproduce the issue here. I will investigate as soon as I can find the time. In the meantime, I will close this issue because it's "solved" (meaning the workaround works for installing OpenCV). Can you open a separate issue on the Rvision Github instead? Thanks.