I get this error message while trying to load the rJava or the openNLP packages through the function library(openNLP) or library(rJava):
Error: package or namespace load failed for ‘rJava’:
.onLoad in loadNamespace() for 'rJava' failed, details:
call: dirname(this$RuntimeLib)
error: a character vector argument expected
I have no problems loading other packages, e.g. NLP.
Does somebody know what the problem is?
I have updated the Java SE Development Kit and now I get no error message anymore. So this seems to be the solution for the problem.
I solved this problem by installing Java SE Development Kit 8.
Link for Download: http://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.html
Related
please could you help me to solve the problem with the launch of the epiR package?
I installed this package from CRAN via RStudio. The installation went fine, but when I try to run this package, I get the following message:
> library(epiR)
Download required package: survival
Error: Failed to load package or namespace for 'epiR': .onLoad failed in loadNamespace() for 'units', details: call: ud_init(path) error: no database found!
Tell me, please: what is the problem and how to solve it? Other packages (including those installed today) do not have this problem.
I'm having an issue getting rjags to load & run. I can install rjags, but it doesn't run because it can't find JAGS. My versions are listed below and are all updated to the latest versions. I'm also using a Thinkpad.
JAGS Version: 4.3.0
RStudio Version: 2021.09.0 Build 351
Installation of rjags is okay using the following command:
install.packages('rjags',configure.args="--enable-rpath")
Error messages recopied below:
library(rjags)
Warning: package ‘rjags’ was built under R version 4.0.5
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: fun(libname, pkgname)
error: The environment variable JAGS_HOME is set to
C:/ProgramData/Microsoft/Windows/Start Menu/Programs/JAGS/JAGS-4.3.0
but no JAGS installation can be found there
If I go to where JAGS is installed, the path is:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\JAGS
I used the above lines shared to try and solve this problem, but to no avail:
Sys.setenv(JAGS_HOME="C:/ProgramData/Microsoft/Windows/Start Menu/Programs/JAGS/JAGS-4.3.0")
Error: unexpected '/' in "Sys.setenv(JAGS_HOME=C:/"
Corrected to:
Sys.setenv(JAGS_HOME="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\JAGS\JAGS-4.3.0")
Error: '\P' is an unrecognized escape in character string starting ""C:\P"
Corrected to:
Sys.setenv(JAGS_HOME="C:\ ProgramData\ Microsoft\ Windows\ Start Menu\ Programs\ JAGS\ JAGS-4.3.0")
This doesn't yield any errors, but when I try to load rjags I get the following:
library(rjags)
Warning: package ‘rjags’ was built under R version 4.0.5
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: fun(libname, pkgname)
error: The environment variable JAGS_HOME is set to
C: ProgramData Microsoft Windows Start Menu Programs JAGS JAGS-4.3.0
but no JAGS installation can be found there
This is the same as above, but the / are left out for some reason.
Unsure of what to try next, any thoughts/insight would be much appreciated! :)
This seems to be an issue others have faced too: rjags failed to load and R Failed to locate any version of JAGS
https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/060fd5c378/?limit=25
https://www.reddit.com/r/rstats/comments/pzto5t/rjags_is_my_enemy/
Though none of these solutions seem to be working (yet?).
Problem solved!
Both of you were right - JAGS was in an odd location, so I moved it to:
C:\Program Files\JAGS\JAGS-4.3.0
And then used the code (I think / is the same as \):
Sys.setenv(JAGS_HOME="C:/Program Files/JAGS/JAGS-4.3.0")
And now it works like a charm :)
Got the following error message after installing "sf" package in R.
It seems to have something to do with a prior installation of "tmap".
I get the same error message for library(tmap).
R version 4.0.2
install.packages('sf')
library(sf)
Fehler: package or namespace load failed for ‘sf’:
.onLoad in loadNamespace() für 'units' fehlgeschlagen, Details:
Aufruf: udunits_init(file.path(.get_ud_xml_dir(), "udunits2.xml"))
Fehler: Error in function udunits_init: Can't open installed, default, unit database
is there anything I can do? I am completely lost.
After reading several threads, the solution that worked for me was to install and manually load the package udunits2.
I tried to load the R package xlsx:
library('xlsx')
But I got the following error:
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
call: .jinit()
error: Cannot create Java virtual machine (-1)
In addition: Warning message:
package ‘xlsx’ was built under R version 3.2.3
Error: package or namespace load failed for ‘xlsx’
My R-session aborts when I try .jinit()
Any help is much appreciated.
Edit:
I updated R Studio to the newest version and executed
update.packages(checkBuilt = TRUE)
but still got the following error:
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
call: .jinit()
error: Cannot create Java virtual machine (-1)
Error: package or namespace load failed for ‘xlsx’
Edit 2:
This question is still unsolved.
As Pascal in the comments below suggested I looked for the windows equivalent command of:
R CMD javareconf
After many hours of searching I still didn't found it.
I faced similar problem on Macbook. If you've upgraded Java recently, it is likely that you need to reconfigure.
For me, it got solved with,
step#1 sudo R CMD javareconf (On Windows, sudo not required. If you face "command not found" issue on Windows, try this)
step#2 install.packages("rJava",type='source') (inside R prompt)
Hope this helps!
In case you don't have PATH variable set up properly, try to override it by using
options(java.home="PATH TO jre")
This might fix some issues.
I installed the R caret package using install.packages command and did library(caret). I am recieving the following error
>library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
Error: package or namespace load failed for ‘caret’
I searched other posts and also installed OSX tcltk package from http://cran.us.r-project.org/bin/macosx/tools/ but it still does not seem to work. I also installed tcltk2 package from R but still does not work.. Kindly help
I have met the same problem with the same error message but unfortunately, just reinstalling R1.3 didn't solve the problem for me.
To solve it, I had to install X-Quartz as explained here in the "Mac OS X Trouble-shooting" section and the problems related to tcltk.
Do this and it will resolve the problem
install.packages("quantreg")
What version of R are you using? Do you use Mavericks? You may need to update to a version which includes Mavericks updates.
http://cran.r-project.org/bin/macosx/
I had the same issue. Reinstalling Quartz solved the issue
Try this, worked for me.
install.packages("caret", dependencies = T)
Once that is done, run
install.packages("pbkrtest", dependencies = T)