Failed to install any R packages in my conda virtual environment - r

I got my new computer (Mac Pro M1) lately but I am not quite familiar with the MacOS system...
I enjoy using VSCode so I configured it with R language. I created an virtual environment with commands:
conda create -n R python=3.8
conda activate R
conda install -c conda-forge r-base=4.1.2
conda install -c conda-forge r-languageserver
and configured everything following this website. Everything goes fine when I run R language except for installing R packages. Here is a screenshot of my problem.
I can only install packages on R.app:
Can anyone help me? Thanks so much in advance!!!
I really want to get everything ready for coding in R language with VSCode!!! How to solve it? It seems not a problem of permission?
Updated infomation here:
Below are some screenshots showing what are in my R conda environment:
Also, the paths of R and Radian are added to settings of VSCode:

Related

R Package Conflicts in Anaconda3

I have installed Anaconda 3 for Mac M1 and I am trying to create a new environment for R. However, everytime I try to do this, I am faced with the below error:
Conda Prompt Error Message
I am faced with this error irrespective of whether I try to do this in anaconda navigator or conda prompt. I have already tried removing Anaconda completely and reinstalling it again but to no avail. Is there anything I can do here?
Update: As requested, here is an additional screenshot:
Mamba install r-eesentials
Mamba install r-essentials output
[Disclosure: I am a volunteer on the Conda Forge R team.]
Conda users who want to use R should prioritize Conda Forge. The Anaconda company has not actively maintained R packages since v3.6.
If installing Conda for the first time, I recommend Miniforge variants (specifically, Mambaforge), rather than the Anaconda distributions (which prioritize defaults/anaconda channel).
Also note that osx-arm64 support for R through Conda is currently sparse. We are actively working on migrating, but for simplicity of workflow, I still recommend Conda users to install a osx-64 version of Conda and use that platform when installing R. You can always create native osx-arm64 environments when you actually need them (e.g., native TensorFlow with Metal support).

Python: Camelot-PY (Error: GhostscriptNotFound while it is installed) for M1 MacOS

Problems using Camelot-py for PDF parsing. Cannot locate 'gs' package, although it has been installed in any imaginable way... Using M1 Monterey OS.
While GS is clearly installed (gs launches from Terminal root just fine), home-brew installation of python / Xcode, PATH variables added through 'export PATH'. Still getting the same error with Ghostscript not being installed when trying to parse a PDF table.
Any suggestions / experience on this please? One would have thought it should not be such a massive pain to resolve...
I had the same issue, which was resolved by installing camelot-py from Anaconda:
conda install -c conda-forge camelot-py

libreadline.so.6 missing - Can not access R via command line after installation

I did put R on path using the .bashrc file. And yet, I do not have access to R through the command line. I have nevertheless no issues with RStudio. When I check for the R location with which R, I get /home/myself/anaconda3/bin/R. I have Ubuntu 20.04. The error message that I get is /home/myself/anaconda3/lib/R/bin/exec/R: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory. I have version R version 4.1.3 which I have installed recently. Working in JupyterLab in anaconda, I installed again R in a conda environement. Unfortunately, I get inside the conda environment the same error message.
When I try to install the missing package, I get the message:libreadline6 : PreDepends: multiarch-support but it is not installable.
I also tried to install libreadline with conda, conda install -c conda-forge m2-libreadline (as suggested on the anaconda site) as well as conda install -n base -c conda-forge libreadline.so.6. The message I get is: `PackagesNotFoundError: The following packages are not available from current channels:
libreadline.so.6
m2-libreadline`
I will highly appreciate your help. Thanks.

Installing rsvg library in R 4.0.2 (conda-forge)

I'm facing difficulties downloading the r package rsvg. I created first an environment with conda for the latest R version 4.0.2 following these instructions. I was able to download many other R packages & bioconductor packages without problem, however, this one produces huge pile of lines while configuring it and ends with errors downloadind its dependencies (systemfonts, stringi, stringr, gdtools, magick, svglite, knitr). My exact command is install.packages("rsvg", dependencies =T). Trying to download each of those packages produced also a tree of required dependencies (with configuration fail at the end of each).
Among the lines I noticed this error /user/include/freetype2/freetype/config/ftheader.h:3:12: fatal error x86_64-linux-gnu/freetype2/config/fthreader.h no such file or directory which make me suspect that my R installation is incopmlete or corrupted. I tested it with other R versions (e.g. R 3.6.0) yet the same error appear. Installing it on windows (Rstudio 3.6.2) also didn't work, and now I'm wondering if this package needs to be installed differently or it is system related problem? Any help would be highly appreciated
You need to create a new environment and then you can install R 4.+ in Anaconda. Follow these steps.
conda create --name r4-base
After activating r4-base run these commands
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.
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.

Installing R Studio with Anaconda

I tried to install R Studio (version 1.1.456) using the anaconda navigator by simply clicking on the install button. It was taking more than an hour, so I just figured it should be stuck.
I then tried to install it through the anaconda prompt but now it has also been stuck for around 30 minutes here:
What can I do to get around this?
Thank you in advance!
For various reasons up-to-date RStudio versions are not availabe on any conda channel I know. #merv's answer is the easiest solution, if you are happy to work with an older version of rstudio. Here is another suggestion, where you install RStudio outside of conda, but configure it to use a particular R installation, which is maintained in your custom conda environment. Step by step, this is how you procede:
Install the latest RStudio from the official sources
Create your custom conda environment CUSTOMENV, including an installation of r-base
conda create -n CUSTOMENV -c conda-forge r-base'>=4.0.0' ... [further packages]
Activate the conda environment
conda activate CUSTOMENV
Start RStudio from console
rstudio &
Important Note: I strongly endorse #mfakaehler's answer since all RStudio builds on Conda have effectively been abandoned. Install RStudio natively and launch from activated environment.
Create a new env instead. E.g.,
conda create --name rstudio_env -c r rstudio
Best practice for Conda is to create new envs for each project rather than using a monolithic base env. Generally, I find that the less one installs in base the better their experience with Conda will be.

Resources