[R] Problem loading packages in R 3.6.1

Thomas Knox knoxy1827 @end|ng |rom gm@||@com
Tue Sep 17 18:55:31 CEST 2019


I have recently installed R 3.6.1 on my MacBook running Mac OS Mojave 10.14.5 in order to run a custom package called MH1823 (probability of detection).  This package requires me to load the following packages from CRAN, tcltk, tcltk2, survival and xlsx.

I have installed survival, xlsx and tlctk2 (i believe tcltk is embedded).  When I look at Package Manager i see that although the above packages are installed they are not loaded.  I can load survival but when I try to load “xlsx” i get the following  error message is:

Error: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
  Reason: image not found
starting httpd help server … done


there may be a couple of hints in here.

 .onLoad failed in loadNamespace() for 'rJava', details  suggests the problem starts with calling rJava.

the next line in the error:
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':
I have checked this path and see no problems, everything seems to stack up and I find jJava.so where it is supposed to be.  However in the next line:
 dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
I don’t know what the number , 6 after Java.so means but have presumed version number and may be why Java8 is not working.  I also note the path …. /JavaVirtualMachines/jdk-11.0.1.jdk/ appears as . /JavaVirtualMachines/1.6.0.jdk/
suggesting a different build

the same occurs when I try to load the local source package MH1823

When I try to load HM1823 I get the error message:
* installing *source* package ‘mh1823’ ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
  Reason: image not found
Error: package ‘xlsx’ could not be loaded
Execution halted
ERROR: lazy loading failed for package ‘mh1823’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/mh1823’
> 

I find that the error message is substantially the same suggesting rJava and/or the version of Java.  I have tried removing Java 8 from my machine and installing Java 6 but don’t see any difference.  It is easy to see that Java 8 has been removed but not easy to see that 6 is installed properly as the path names are still the same.

When I try to load either tcltk or tcltk2, my instance of R stops responding entirely.

I have also installed Xquartz as I believe this is needed for Mac OS X

Can anyone provide some advice on what the issue might be?  I have tried reading through the FAQ’s but not found anything to point me in the right direction.

Regards,

Tom Knox
	[[alternative HTML version deleted]]



More information about the R-help mailing list