Anconda R version - How to upgrade to 4.0 and later

I use R through the anaconda navigator, which manages all my package installations. I need to use qgraph for a project, which is dependent on mnormt library, which in turn needs RStudio verion 4.0

I think the solution to my problem would be to upgrade Anaconda R to the latest R version, but the r-base search in conda has no R version greater than 3.6. Any help in upgrading Anaconda R to newer versions would be very useful.

The problem is in installing qgraph, which stops with errors in installing dependencies (pysch)

During startup - Warning messages:

1: Setting LC_CTYPE failed, using C 
2: Setting LC_TIME failed, using C 
3: Setting LC_MESSAGES failed, using C 
4: Setting LC_MONETARY failed, using C 
Error: .onLoad failed in loadNamespace() for 'mnormt', details:
  call: library.dynam(mnormt, pkg, library)
  error: shared object 'mnormt.dylib' not found
Execution halted
ERROR: lazy loading failed for package 'psych'

Topic gaussian anaconda rstudio graphs

Category Data Science


The code above didn't work for me. I use macOS. Instead I used the following code and it worked. You need to fill in a name of your environment for "your_name_here" and choose version numbers for python and R:

conda config --add channels conda-forge    
conda config --set channel_priority strict    
conda search r-base  
conda create -n your_name_here python=3.X   
conda activate your_name_here  
conda install -c conda-forge r-base=4.X.X    
conda install jupyter

Now, install RStudio in your environment via Anaconda. In RStudio, write in the R console:

install.packages('IRkernel')   
IRkernel::installspec()

You need to create a new environment and then you can install R 4.+ in Anaconda. Follow these steps.

conda create --name r4-base

enter image description here

After activating r4-base run these commands

conda activate r4-base
conda install -c conda-forge r-base
conda install -c conda-forge/label/gcc7 r-base

Finally, you will notice r-basa version 4 will be installed.

enter image description here

Thereafter, you can install any supported packages. But with this only, you won't have the ability to use it in the Jupyter notebook. You need to install install.packages('IRkernel') and Jupyter notebook as well if you want to use it. Otherwise you are good to go with R-Studio.

For Jupyter Installation and RKernel.

conda install jupyter

Then open the R console. Write in R console

install.packages('IRkernel')
IRkernel::installspec()

Congrats! You can use Notebook for Python and R.


The following steps seemed to resolve the issue for me on my mac.

  1. Create an environment using Anaconda. Give it a name, say "Environment Name".

  2. Launch that environment using terminal. "Environment Name" > "Open Terminal"

  3. Inside terminal type the following command.

    brew install r


Rstudio does not support Anaconda so you are stuck with the version they provide. Your best option is to install R and RStudio outside Anaconda.


Try install through anaconda prompt and the following path

conda install -c conda-forge r-mnormt

Then install qgraph one more time

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.