After installing R and RStudio on my new computer everything works fine, except the "xlsx" package. When trying to call it with library(xlsx) I get this error message:
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
The versioncommand produces the following output:
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
I see from similar questions that this problem might stem from the fact that the Java and the R versions don't correspond. But here, everything else works, and so far this seems to be the only package that produces this error message. I can't have more than one Java version installed at the time, can I? I have tried to reinstall the package, with the same result.
I have quite a lot of scripts where I have used the "xlsx" package, the synthax is different than the alternative package "readxl" and I would by far prefer to make the "xlsx" package work, rather than switching to "readxl". The "xlsx" package also comes with more options.
Any suggestions?
Related
As stated in the question: the installation which worked fine in the past seems to be broken. Any ideas how to solve this issue?
There has been a similar issue in the past, but I am not sure, if it is a similar problem. Although the output only states a warning, the installation does not succeed.
See also here
Details
R.version
_ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 4 minor 0.4 year 2021 month 02 day 15 svn rev
80002 language R version.string R version 4.0.4 (2021-02-15) nickname
Lost Library Book
install.packages("C:/gurobi912/win64/R/gurobi_9.1-2")
Warning in install.packages : package
‘C:/gurobi912/win64/R/gurobi_9.1-2’ is not available for this version
of R
A version of this package for your version of R might be available
elsewhere, see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
When installing the R package for Gurobi, you need to set repos=NULL as #MrFlick already noted in the comments and as is listed in the official Gurobi installation guide for R: https://www.gurobi.com/documentation/9.1/quickstart_windows/r_ins_the_r_package.html
Before you mark this as duplicate, I wish to say that I already referred the related post 1,post 2, 3, 4
I am trying to install the dplyr and stringr package but i get the below error
Warning in install.packages :
downloaded length 139264 != reported length 3227450
Warning in install.packages :
error 1 in extracting from zip file
Warning in install.packages :
cannot open compressed file 'dplyr/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
I tried different installation commands like
install.packages(“dplyr”)
install.packages(“dplyr”, repos="http://cran.us.r-project.org")
install.packages(“dplyr”, repos="http://cran.us.r-project.org",type="win.binary")
> Sys.info()
sysname release version machine
"Windows" "10 x64" "build 17134" "x86-64"
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.2
year 2019
month 12
day 12
svn rev 77560
language R
version.string R version 3.6.2 (2019-12-12)
nickname Dark and Stormy Night
Till yesterday, I was able to install this package successfully. But today it is throwing this error.
This error happens with other packages like stringr as well. I tried chaging CRAN mirrors as well but still no help
Can help please?
I have downloaded a R package and installed from local files. Next I tried to install a package, with many imports, through Install package(s), I could not install. I closed R and restarted R, now I am able to install packages, with many imports. Rahul, R user.
This error typically happens because R cannot access the default directory for installing the packages. This error is a system-related error. Try this solution. It worked out for me. I changed the default installation directory in the environment variables and it worked smoothly.
I am trying to install the ProStaR and DAPAR packages with Rstudio (R version 3.6.3). Following the instructions from the instruction manual (https://www.bioconductor.org/packages/release/bioc/vignettes/DAPAR/inst/doc/Prostar_UserManual.pdf) after running the following code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version='3.10')
BiocManager::install("DAPAR")
BiocManager::install("Prostar")
library(Prostar)
Prostar()
I receive the following error messages:
>library(Prostar)
Error: package or namespace load failed for ‘Prostar’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
> Prostar()
Error in Prostar() : could not find function "Prostar"
When trying to separately install the shiny package:
install.packages("shiny")
library("shiny")
I get the same error message:
Error: package or namespace load failed for ‘shiny’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
I have to mention that I'm not extremely familiair with R yet. Any help would be greatly appreciated.
You did not include versions of several items in your setup so it's possible this comes from mismatching components (rather than my initial guess that it was due to a corrupt package from whatever mirror was being used.) I needed to upgrade to R 3.6.3 to match that aspect of your set up and in the process noted that Catalina OS users need a different version of R. I'm on Mojave, so my version now produces this on startup:
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
I then needed to update my BioConductor installation which was fairly quick but installing the DAPAR package takes a loooong time because of an extensive list of dependencies, some of which have unmet dependencies that required repeated attempts to get the process to completion. Then the Prostar package installation had another batch of unmet dependencies. After finally getting all the unmet dependencies installed, I'm unable to reproduce the error, so I'm thinking you should probably use another repository. I suggest first doing something like:
options(repos = "https://cloud.r-project.org/")
Or choose that mirror specification from the Rstudio setup panel. Then make another attempt.
I suppose it's possible that this issue arises because of a version mismatch of compilers. The CRAN page for MacOS says clang 7 is needed. In my setup I get this (in a Terminal window)
Comutername:~ myusername$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
And for gfortran I get:
GNU Fortran (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
I did all the R package installations from the R.app interface, so I suppose it's possible that some infelicity in Rstudio's package install process will be needed to explain this. Obviously all teh system installations such as clang and gfortran (and probably PROJ and other GIS packages) would need to be done from the Terminal command line. Sometimes it is safer to do all these installations from a minimal interface, possibly even from R running in a Terminal window. I've generally had good luck with R.app (over a span of 12 years) and less consistent results with Rstudio.
I´m trying to install the library ssev: https://cran.r-project.org/web/packages/ssev/index.html
On a machine with R 3.6.0
install.packages("ssev")
And I´m getting the following error:
“unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'”
Warning message:
“package ‘ssev’ is not available (for R version 3.6.0)”
What I do not understand is why I´m getting this error, when the requiered version for this library is 3.4, as shown in CRAN:
The installation does work with a more recent versions of R like 3.6.3, but in the machine I need it I do not have the option to install a newer version.
I'm using R version 3.6.1 and only getting a warning about the using the library. Generally, you can ignore these and it will still work. If it's not, try updating the package and post the results of trying to load the library and also run version to show info on your setup as I did below:
> library(ssev)
Warning messages:
1: In recycle.data(data, FALSE, length(x), units) :
reached elapsed time limit
2: package ‘ssev’ was built under R version 3.6.3
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
I have been trying to switch to 64-bit environment but i get stuck with rJava not working.
I have followed thread where people where having the same problem and their solution (JDK, JVM.DLL, environment variables etc..) but i am still stuck
Here is the error i get:
Loading required package: Rbbg
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'H:/R/R-2.15.2/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified path is invalid.
Failed with error: 'package 'rJava' could not be loaded'
Here is R.version
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 2
minor 15.2
year 2012
month 10
day 26
svn rev 61015
language R
version.string R version 2.15.2 (2012-10-26)
Thanks in advance
The problem because R can't find the jvm for the 64 architecture.
Normally if you have installed it you will get something like
C:\Program Files\Java\jre7\bin\server
Add this to your windows path and restart R.
Edit To ckeck if all things are right:
Type:
Sys.getenv()['PATH']
you get the environment variables inclusing the path for jvm.dll. If youd'ont have the jvm path here you need to add it using the usual Advanced System Settings method and restart your R console so this take effect.
Sys.getenv()['ProgramW6432']
You get C:\Program Files for the 64 archtitecture.