Error installing R package atSNP - r

I am trying to install an R package atSNP from https://github.com/chandlerzuo/atSNP. According to the documentation, this is how it is installed:
> library(devtools)
> install_github("chandlerzuo/atSNP")
But I get the following error:
Downloading github repo chandlerzuo/atSNP#master
Installing atSNP
Skipping 2 packages not available: GenomicRanges, motifStack
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
'/private/var/folders/vt/nnrr0hts2h1bk6stsg4mt2xw0000gn/T/Rtmpzjo43z/devtoolsd9a33b03bdb4/chandlerzuo-atSNP-8cbe50e' \
--library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library' --install-tests
* installing *source* package ‘atSNP’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs
** R
** data
** tests
** preparing package for lazy loading
No methods found in "IRanges" for requests: sapply
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
No methods found in "IRanges" for requests: sapply
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so, 6): no suitable image found. Did find:
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP’
Error: Command failed (1)
This is the session info:
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10 (Yosemite)
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] grid stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] motifStack_1.12.0 Biostrings_2.36.1 XVector_0.8.0 ade4_1.7-2 MotIV_1.24.0 grImport_0.9-0
[7] XML_3.98-1.2 GenomicRanges_1.20.4 GenomeInfoDb_1.4.0 IRanges_2.2.2 S4Vectors_0.6.0 BiocGenerics_0.14.0
[13] devtools_1.8.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 GenomicAlignments_1.4.1 zlibbioc_1.14.0 BiocParallel_1.2.2 BSgenome_1.36.0
[6] lattice_0.20-31 stringr_1.0.0 httr_0.6.1 tools_3.2.0 seqLogo_1.34.0
[11] lambda.r_1.1.7 futile.logger_1.4.1 git2r_0.10.1 rversions_1.0.0 digest_0.6.8
[16] rtracklayer_1.28.4 futile.options_1.0.0 bitops_1.0-6 RCurl_1.95-4.6 memoise_0.2.1
[21] rGADEM_2.16.0 stringi_0.4-1 Rsamtools_1.20.4
As you can see, I have installed & attached both packages GenomicRanges & motifStack and still the installation message says they are not available. I have tried uninstalling & reinstalling both the packages but I still get the same error. Any suggestions will be appreciated.
UPDATE: I followed the suggestion below and still getting the following errors:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library’
* installing *source* package ‘atSNP’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs
** R
** data
** preparing package for lazy loading
No methods found in "IRanges" for requests: sapply
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
No methods found in "IRanges" for requests: sapply
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so, 6): no suitable image found. Did find:
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP’
Thanks

You can download the source package from the github website and install it. This gives no error on my Mac. In the terminal, type
git clone git://github.com/chandlerzuo/atSNP.git
R CMD INSTALL atSNP

Related

Problem in the installation of R package rsvg

I'm trying to install r package rsvg without any success. Tried the following two methods:
1. install.packages("rsvg")
install.packages("rsvg")
Installing package into ‘C:/Users/hp/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is
later:
binary source needs_compilation
rsvg 2.3.1 2.3.2 TRUE
installing the source package ‘rsvg’
trying URL 'https://cloud.r-project.org/src/contrib/rsvg_2.3.2.tar.gz'
Content type 'application/x-gzip' length 183798 bytes (179 KB)
downloaded 179 KB
* installing *source* package 'rsvg' ...
** package 'rsvg' successfully unpacked and MD5 sums checked
** using staged installation
** libs
rm -f rsvg.dll rsvg.o
"C:/PROGRA~1/R/R-42~1.1/bin/x64/Rscript.exe" "../tools/winlibs.R" 2.48.8
Error in download.file(sprintf("https://github.com/rwinlib/rsvg/archive/v%s.zip", :
download from 'https://github.com/rwinlib/rsvg/archive/v2.48.8.zip' failed
In addition: Warning message:
In download.file(sprintf("https://github.com/rwinlib/rsvg/archive/v%s.zip", :
URL 'https://codeload.github.com/rwinlib/rsvg/zip/refs/tags/v2.48.8': Timeout of 60 seconds was reached
Execution halted
make: *** [Makevars.win:7: winlibs] Error 1
ERROR: compilation failed for package 'rsvg'
* removing 'C:/Users/hp/AppData/Local/R/win-library/4.2/rsvg'
The downloaded source packages are in
‘C:\Users\hp\AppData\Local\Temp\RtmpmG8xM2\downloaded_packages’
Warning message:
In install.packages("rsvg") :
installation of package ‘rsvg’ had non-zero exit status
2. remotes::install_github("ropensci/rsvg")
library(remotes)
install_github("ropensci/rsvg")
Downloading GitHub repo ropensci/rsvg#HEAD
✔ checking for file 'C:\Users\hp\AppData\Local\Temp\RtmpmG8xM2\remotes5a645f9057ed\ropensci-rsvg-6d9840f/DESCRIPTION'
─ preparing 'rsvg':
checking DESCRIPTION meta-information ...
checking DESCRIPTION meta-information ...
✔ checking DESCRIPTION meta-information
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building 'rsvg_2.3.2.tar.gz'
Warning:
Warning: file 'rsvg/cleanup' did not have execute permissions: corrected
Warning: file 'rsvg/configure' did not have execute permissions: corrected
Installing package into ‘C:/Users/hp/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
* installing *source* package 'rsvg' ...
** using staged installation
** libs
rm -f rsvg.dll rsvg.o
"C:/PROGRA~1/R/R-42~1.1/bin/x64/Rscript.exe" "../tools/winlibs.R" 2.48.8
Error in download.file(sprintf("https://github.com/rwinlib/rsvg/archive/v%s.zip", :
download from 'https://github.com/rwinlib/rsvg/archive/v2.48.8.zip' failed
In addition: Warning messages:
1: In download.file(sprintf("https://github.com/rwinlib/rsvg/archive/v%s.zip", :
downloaded length 35551249 != reported length 43111940
2: In download.file(sprintf("https://github.com/rwinlib/rsvg/archive/v%s.zip", :
URL 'https://codeload.github.com/rwinlib/rsvg/zip/refs/tags/v2.48.8': Timeout of 60 seconds was reached
Execution halted
make: *** [Makevars.win:7: winlibs] Error 1
ERROR: compilation failed for package 'rsvg'
* removing 'C:/Users/hp/AppData/Local/R/win-library/4.2/rsvg'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/hp/AppData/Local/Temp/RtmpmG8xM2/file5a645596780/rsvg_2.3.2.tar.gz’ had non-zero exit status
sessionInfo()
sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] remotes_2.4.2
loaded via a namespace (and not attached):
[1] processx_3.8.0 compiler_4.2.1 R6_2.5.1 rprojroot_2.0.3 cli_3.4.1 prettyunits_1.1.1 tools_4.2.1 withr_2.5.0
[9] curl_4.3.3 crayon_1.5.2 callr_3.7.2 ps_1.7.2 pkgbuild_1.3.1
According to this issue, you should first install pkgconfig like this:
install.packages('pkgconfig')
install.packages('rsvg')
library(rsvg)
#> Linking to librsvg 2.48.4
Created on 2022-10-28 with reprex v2.0.2
It looks like you experience some connection issues when installing the required winlib. You could also try to install this first:
remotes::install_github("rwinlib/rsvg")
EDIT: Same suggestion as the comment by #Limey

Error: package or namespace load failed for 'treesnip'

When trying to install the treesnip package from github using remotes::install_github("curso-r/treesnip"), I get the following error:
remotes::install_github("curso-r/treesnip")
Downloading GitHub repo curso-r/treesnip#HEAD
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
√ checking for file 'C:\Users\SAR.V-LOG\AppData\Local\Temp\RtmpENiM7Q\remotes38701dfb49f3\curso-r-treesnip-c70a89b/DESCRIPTION' (375ms)
- preparing 'treesnip': (736ms)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
Removed empty directory 'treesnip/.github/workflows'
Removed empty directory 'treesnip/.github'
NB: this package now depends on R (>= 3.5.0)
WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'treesnip/inst/benchmark_parallel_processing_vignette.rds'
- building 'treesnip_0.1.0.tar.gz'
* installing *source* package 'treesnip' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'treesnip'
finding HTML links ... done
add_boost_tree_catboost html
add_boost_tree_lightgbm html
add_decision_tree_tree html
multi_predict._catboost.Model html
multi_predict._lgb.Booster html
predict_lightgbm_classification_class html
predict_lightgbm_classification_prob html
predict_lightgbm_classification_raw html
predict_lightgbm_regression_numeric html
train_catboost html
train_lightgbm html
train_tree html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'treesnip':
.onLoad failed in loadNamespace() for 'treesnip', details:
call: NULL
error: The values passed to `set_encoding()` are missing arguments: 'allow_sparse_x'
error: loading failed
running stopped
*** arch - x64
Error: package or namespace load failed for 'treesnip':
.onLoad failed in loadNamespace() for 'treesnip', details:
call: NULL
error: The values passed to `set_encoding()` are missing arguments: 'allow_sparse_x'
Fejl: loading failed
running stopped
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/SAR.V-LOG/OneDrive - VELUX/Documents 1/R/R-4.0.2/library/treesnip'
Error: Failed to install 'treesnip' from GitHub:
(converted from warning) installation of package ‘C:/Users/SAR~1.V-L/AppData/Local/Temp/RtmpENiM7Q/file38706c2c7239/treesnip_0.1.0.tar.gz’ had non-zero exit status
my sessionInfo():
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252
[4] LC_NUMERIC=C LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2
I works fine when running on another PC.
I also tried changing the library location to C:/Users/SAR.V-LOG/, but that didn't help either.
Further I tried to provide INSTALL_opts = "--no-test-load". When I do that the installation finished wihtout errors, but when I try to load the library using library(treesnip) I get the same error: The values passed to set_encoding() are missing arguments: 'allow_sparse_x'
Do you know what is causing this error and how I can fix it?
treesnip is fixed. It now depends on parsnip (>= 0.1.3.9000) https://github.com/curso-r/treesnip/commit/902a33d9f156c10da6dbe1bd9cccb65926077197
Try using parsnip 0.1.3 (not the development version in this case). It looks like 0.1.3.9000 has some breaking changes coming that will be handled in a new version of parsnip-adjacent packages.
The warning message indicates:
Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
You may need to upgrade your Rtools, which can be done here: https://cran.r-project.org/bin/windows/Rtools/
Let me know if this fixes your problem.
Also I have added a GitHub Issue Here: https://github.com/tidymodels/parsnip/issues/376

R-devel: "object 'checkCompilerOptions' not found" when installing magrittr

I've installed R-devel on Ubuntu following this guide. When trying to install magrittr with install.packages("magrittr") I'm getting this:
* installing *source* package ‘magrittr’ ...
** package ‘magrittr’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'checkCompilerOptions' not found
Calls: ::: -> get
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/magrittr’
The downloaded source packages are in
‘/tmp/RtmpagwvBj/downloaded_packages’
Warning message:
In install.packages("magrittr") :
installation of package ‘magrittr’ had non-zero exit status
The single other stackoverflow question refering to this error didn't help me. Can anyone help?
What I'm really trying to do is to install the latest development version of the Gviz package. In order to do that I must use the development version of bioconductor and R. Down in the dependency tree for Gviz comes magrittr.
My sessionInfo():
R Under development (unstable) (2016-02-18 r70185)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 15.10
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=nb_NO.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=nb_NO.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=nb_NO.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=nb_NO.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] tools_3.3.0 tcltk_3.3.0
I had the same problem installing the raster package. I found out here that the problem was a conflict between library directories exported by the second script of the guide you are mentionning:
#!/bin/bash
export R_LIBS_SITE=${R_LIBS_SITE-'/usr/lib/R-devel/lib/R/library:/usr/local/lib/R/site-library:/usr/lib/R/site-library::/usr/lib/R/library'}
export PATH="/usr/local/lib/R-devel/bin:$PATH"
R "$#"
So I removed the library folders not related to my R-devel instance:
#!/bin/bash
export R_LIBS_SITE=${R_LIBS_SITE-'/usr/lib/R-devel/lib/R/library:/usr/local/lib/R/site-library'}
export PATH="/usr/local/lib/R-devel/bin:$PATH"
R "$#"
And it finally worked.
I was able to install Gviz! This is what got me there:
I tried using devtools::install_github("Bioconductor-mirror/Gviz") to install Gviz instead of doing it with biocLite("Gviz"). This got me the checkCompilerOptions error, but now with the package matrixStats.
I installed matrixStats using devtools::install_github("HenrikBengtsson/matrixStats"). This worked.
At this point I tried installing magrittr again, using install.packages("magrittr"). It worked somehow!
I could now install Gviz with devtools::install_github("Bioconductor-mirror/Gviz")
I still have no idea about the checkCompilerOptions error, and would appreciate any ideas.

R: error installing packages UBUNTU - Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object

I'm having problem installing any package, also from package archive. In this case showing error trying to install ggplot2:
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/stringi/libs/stringi.so':
libicui18n.so.52: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpVU9aIn/downloaded_packages’
This is my session Info
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 15.10
locale:
[1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C LC_TIME=pt_BR.UTF-8
[4] LC_COLLATE=es_ES.UTF-8 LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=pt_BR.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rsconnect_0.4.1.4 tools_3.2.2
Thanks in advance!!
Your upgrade to Ubuntu 15.10 meant that the ICU library went from version 52 to a newer version (55, if I recall). But the stringi package was built against 52, and is now broken. That can happen to your R packages when they are outside of the Ubuntu package management system.
So you need to re-install stringi, which is required by ggplot2, and then ggplot2 will install and also load, avoiding the erorr you.
You could avoid these upgrade problems by using the pre-built versions of ggplot2 and its dependencies: do sudo apt-get install r-cran-ggplot2.
Thank you Dirk, your advice to install the package via the ubuntu terminal solved my problem as well: I had an almost identical error message when I was trying to install reshape2 on Ubuntu 15.10.
I just,
1) uninstalled the currently installed version of reshape2 through the R terminal (if you use R-Studio you can also do this in the "packages" window where the packages are listed),
2) run sudo apt-get install r-cran-reshape2 in the ubuntu terminal,
3) restarted the computer.

.onLoad failed in loadNamespace() for 'rJava' when installing a package

I have a package "javaOnLoadFailed" (just a minimal package for testing my issue, hence the weird name) which imports rJava. I get 'rJava' errors when I try to either check() or install() the package, even though require(rJava) itself works fine.
install() gives the following errors:
> install()
Installing javaOnloadFailed
"C:/Program Files/R/R-3.2.0/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore CMD INSTALL \
"C:/Projects/stackoverflow/javaOnloadFailed/javaOnLoadFailed" \
--library="C:/Users/adb2018/Documents/R/win-library/3.2" --with-keep.source \
--install-tests
* installing *source* package 'javaOnloadFailed' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/adb2018/Documents/R/win-library/3.2/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/adb2018/Documents/R/win-library/3.2/javaOnloadFailed'
Error: Command failed (1)
I am using R 3.2.0 from within Architect, with sessionInfo():
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.7.0.9000 rj_2.0.3-2
loaded via a namespace (and not attached):
[1] tools_3.2.0 rj.gd_2.0.0-1
The Java environment variable is empty
> Sys.getenv('JAVA')
[1] ""
Based on a suggestion, I tried setting the JAVA environment variable to point to the 64 Bit version of Java (because I am running R 64 bit, as you could see from the sessionInfo, but that doesn't work:
> Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_45')
> install()
Installing javaOnloadFailed
"C:/Program Files/R/R-3.2.0/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore CMD INSTALL \
"C:/Projects/stackoverflow/javaOnloadFailed/javaOnLoadFailed" \
--library="C:/Users/adb2018/Documents/R/win-library/3.2" --with-keep.source \
--install-tests
* installing *source* package 'javaOnloadFailed' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/adb2018/Documents/R/win-library/3.2/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/adb2018/Documents/R/win-library/3.2/javaOnloadFailed'
Error: Command failed (1)
I then tried to set the JAVA environment variable such that it points to the 32 bit version of Java on my system, and then it works!
> Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre1.8.0_45\\')
> install()
Installing javaOnloadFailed
"C:/Program Files/R/R-3.2.0/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore CMD INSTALL \
"C:/Projects/stackoverflow/javaOnloadFailed/javaOnLoadFailed" \
--library="C:/Users/adb2018/Documents/R/win-library/3.2" --with-keep.source \
--install-tests
* installing *source* package 'javaOnloadFailed' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (javaOnloadFailed)
[INFO] Updating the R environment index started...
[INFO] The R environment index was updated successfully.
I don't quite understand why I need to point to Java 32 bit to make R 64 bit work, but that's what seems to be the case.
By the way, don't stumble over my package name "javaOnLoadFailed". I just created a minimal package with that name to test the problem.
Many packages fail install because they are not meant to run on i386 platform but the standard installation process tries to do that. Users waste a lot of time with jvm.dll and PATH and JAVA_HOME when the real fix is to force the installed to just forget about i386. Use option for install.packages. (this also works when drat library is used. (credit goes to Dason)
install.packages("SqlRender",INSTALL_opts="--no-multiarch")
I have found the same problem when trying to install a package only available in Github.
This solved for me:
devtools::install_github("snowflakedb/dplyr-snowflakedb", INSTALL_opts=c("--no-multiarch"))
Remember the problem is that R doesn't know where jvm.dll is. When you set JAVA_HOME use the path of the directory that contains the dll file.
You can find it in bin\client or bin\server.
The command then becomes:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_45\\bin\\client')
I tried remove the JAVA_HOME system variable and it works. So that when you launch R, Sys.getenv("JAVA_HOME") gives you "".

Resources