5
$\begingroup$

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'
$\endgroup$
4
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

Try install through anaconda prompt and the following path

conda install -c conda-forge r-mnormt

Then install qgraph one more time

$\endgroup$
2
  • $\begingroup$ Hi, I have tried this, but it fails with the same error. It looks like r-base doesn't install an R version beyond 3.5. I finally had to install R 4.0 outside anaconda and use it, which is a shame. I like managing libraries through conda. $\endgroup$ – Saranya Prakash Jul 22 '20 at 7:27
  • $\begingroup$ Yes, Anaconda is quite user-unfriendly to R. Maybe you can use R-studio instead of it. $\endgroup$ – Louis Luk Jul 23 '20 at 6:27
0
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.