In some ways this is a continuation of this older post, R packages with Rcpp and nloptr.
Mostly, this solution proved temporary, for several reasons, some minor, but mostly I am working to prefect this project for a cran submission and this remains the last hurdle.
That said, I attempted and failed to get this example running https://github.com/jyypma/nloptr/issues/39.
The error here is "..../sourceCpp_2.so Reason: image not found"
After, this I made a test package with nlopt installed into the 'inst' folder and 'makevars' and 'makevars.win' in the 'src' along with the test example from above.
This package is now on GitHub: https://github.com/shortyatz/Nlopt-and-Rcpp.
And gives me a similar error message to the one above.
Here is my session info:
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rcpp_0.12.18
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0 RcppArmadillo_0.8.600.0.0 yaml_2.2.0
Related
I'm running some very simple code:
library(opencv)
ocv_video(ocv_face)
And the session immediately aborts.
Any ideas? (note: running R 4.0.2)
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] opencv_0.1
loaded via a namespace (and not attached):
[1] compiler_4.0.2 magrittr_1.5 tools_4.0.2 Rcpp_1.0.4.6
Solution
For anyone else who arrives here, the solution is to run the same code from terminal. That is press cmd + space to bring up spotlight search, type terminal to open terminal. Type R to open the R interpreter, and use that instead of RStudio.
Cause of the crash
The reason it works from terminal but no RStudio is because from terminal, a prompt will appear asking you to give opencv permission to use your webcam, but this prompt will not appear in RStudio (it causes the crash).
When I turn on my R project, this strange error occurred.
Error: 1:41: unexpected string constant
4:
5: if(capabilities("
^
I reinstalled it twice, but the same problem happened. The same problem occurred when installing the lower-version(3.3.1).
Due to this error, I can not make any R markdown document.
This is my session information.
sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.2 tools_3.6.2
I'm really want to know how to deal with this strange error. Thank you!
My problem on my MacOS is that I can use R from GUI (aka console, downloaded from CRAN), Terminal or from RStudio but I cannot have them function in the same way.
Specific example is I can use rJava on Terminal and RStudio but not on GUI. Similar stuff happens for Rmarkdown pdf outputs. I usually get errors from GUI but everything is fine on Terminal or RStudio. How do I update R GUI settings to the same as Terminal's?
ps. For instance R CMD javareconf command handled the Terminal R but not R GUI.
edit: It is not actually something that requires a minimal working example but let's try library(rJava) after installing it.
R Called from Terminal (same with RStudio)
No problems.
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] C/UTF-8/C/C/C/C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0
R GUI
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0
Some differences between Sys.getenv() are GUI has the following extra
LD_LIBRARY_PATH :#JAVA_LD#
DYLD_LIBRARY_PATH /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/server
Brief update: I was able to correct Rmarkdown situation by using this link and reading help by writing ?Startup on R console. Changed the Renviron file on my R.home()/etc/. But still no rJava.
For R Markdown problem, I managed to handle it by adding a ~/.Renviron file and defining PATH parameter with the value I got from Terminal's Sys.getenv() parameters.
The only thing that worked for rJava for High Sierra is the following answer (changed the version to 3.5 though)
https://stackoverflow.com/a/47685001/3608936
I'm unable to download packages in R when using a Mac. I've tried the simple suggested solutions. Please help.
ERROR: compilation failed for package ‘lmtest’
* removing ‘/Users/Saundy/Library/R/3.4/library/lmtest’
Warning in install.packages :
installation of package ‘lmtest’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/b7/6zytq47j2k5d3knkv0zjtzbm0000gn/T/RtmpMY0uuf/downloaded_packages’
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS High Sierra 10.13.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2 yaml_2.1.14
I have no idea how to make this problem reproducible, but here is a description of the problem nevertheless. I upgraded to R v 3.4.0 yesterday (sessionInfo() is below) and one of my RStudio projects couldn't update packages in packrat. After messing around with various "fixes" without success, I decided to delete packrat (packrat directory, project dir's .RStudio file) in the end. Unfortunately, I can't seem to re-initialize packrat in this project now. The following is the R output from
> packrat::init()
Initializing packrat project in directory:
- "~/my-project-path"
Error in isNamespaceLoaded(pkg) :
attempt to use zero-length variable name
In addition: Warning message:
In FUN(X[[i]], ...) : Package '' not available in repository or locally
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.0 magrittr_1.5 tools_3.4.0 yaml_2.1.14 stringi_1.1.5
[6] knitr_1.15.1 stringr_1.2.0 packrat_0.4.8-1 evaluate_0.10
Any help is very much appreciated. I thought about re-cloning the repo from github, but that would involve copy a large amount of files over from various directories that aren't under revision control currently.
Thanks!