Many packages can not be installed in R version 3.6.3

Halo, I would ask for help from the experts,

I happened to upgrade R version to the latest version, 4.0.3 on my Mac OS Catalina,
the reason was that a package needed to be installed with the newest version, So, I just upgraded the R to the latest version, and now I am running into the problems that many packages can not be installed (and if they are installed) the libraries of the packages can not be loaded. I was advised that upgrading R to the latest was not a good decision (in our case: working on the same dataset/environment), so I uninstalled the latest version and back to R version 3.6.3, the problems are still there, can't install packages and load the libraries.
So far, some of those problematic packages are: adegenet, xlsx, deldir.

I have tried to run the command install.packages("lifecycle")
but it didn't help.

anybody with solutions is much appreciated.

Thanks

Installation issues are very specific, can you provide an specific example along with the corresponding error message?

Thank you @andresrcs,

as for the library(xlsx), here is the error info:
JVMJ9VM015W Initialization error for library j9gc29(2): Failed to instantiate compressed references metadata. 200M requested
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'xlsx', details:
call: .jinit()
error: Cannot create Java virtual machine (-4)

and as for the other issue, I put the screenshot, also it happens that the R studio aborted automatically after I installed and called 70 % of the packages I need.

thanks

You are showing two different problems, the first one is related to your Java installation but there is not enough information on what you have posted (at least for me) to help you.

The second error is happening because you are trying to install a package from source (which requires compilation) without having a compiler installed in your system, for compiling packages on macOS you need to install Xcode in your system (not in R), and the recommended development tools for macOS systems.

Please concentrate on one issue at a time and try to provide all the relevant information you can.

@andresrcs thank you,

could you help with the second one a bit specific what I have to do?

I try too run the commands in my terminal(as I attached)
should I install the Xcode app first?
I tried to install but it says that there is no enough space for this app on my Mac.
Thanks,!

Sorry, I can't give you specific advice about this since I'm not a macOS user, hopefully, someone else will be able to help.

HI @Jefri,
Judging from your screenshot of error messages, there are a couple of things to check. First, it looks like you have the command-line version of xtools installed, but that you might be missing a fortran compiler (make: gfortran: No such file or directory). The version recommended by CRAN is at https://github.com/fxcoudert/gfortran-for-macOS/releases. You don't have to install all of Xcode, as it contains all the libraries for development on iOS, etc.

The second is to make sure you have a Java development kit installed correctly, as the xlsx package depends of rJava, which depends on the java development kit (Different versions can be found at: https://www.oracle.com/java/technologies/javase-downloads.html#javasejdk). Once you have the java development kit installed, In a terminal, if you type " sudo R CMD javareconf", it should return something like:

Java interpreter : /usr/bin/java
Java version     : 15.0.1
Java home path   : /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar

trying to compile and link a JNI program
detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/include/darwin  -I/usr/local/include   -fPIC  -Wall -g -O2  -c conftest.c -o conftest.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation


JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

HTH

thank you @jrmuirhead for your helpful explanation.
Best,

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.