Install R in conda environment offline - r

I have access to a headless, air-gapped server, where I have Anaconda installed.
The default R on server is located at /usr/local/bin/R with version 3.1.2.
On one of my environments, I wish to install R, along with certain packages. I downloaded R version 3.5.1 source files from Anaconda repository and ran the command
conda install Downloads/r-3.5.1-r351_0.tar.bz2
which executed successfully
Downloading and Extracting Packages
################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
However, when I check if R is installed inside the environment, I still get the previous location and version. How can I access the newly installed R ?

As suggested in comments section, I installed the dependencies separately (r-base >=3.5.1,<3.5.2.0a0, r-recommended 3.5.1.*) and the problem was solved.

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).

Installing R 4.0.2 version

I used to work in R 3.4.0 version. Hovewer, this version doesn't support such packages as keras and tensorflow.
I was adviced to upgrade my R version to the newest one.
I downloaded the most recent R version 4.0.2 from the official site, then ran the following code:
install.packages("keras")
library(keras)
install_keras()
And got the following error:
Error in install_keras() :
You should call install_keras() only in a fresh R session that has not yet initialized Keras and TensorFlow (this is to avoid DLL in use errors during installation)
After this, when I tried to quit R session by q() , I faced the following error:
Error: option error has NULL value
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error: option error has NULL value
I've never faced such an error before. When I used old R version, I typed q() and then had to choose between y and n. No errors appeared.
I'm asking you to help to to solve this problem.
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 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.
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.
Find the location of R.exe on your computer. In my computer, this executable is at
C:\Program Files\R\R-3.4.3\bin
Open another Anaconda Prompt as Administrator and change directories to wherever R.exe is on your computer with cd file path. On my computer, it’s cd C:\Program Files\R\R-3.4.3\bin, but it might be different for you.
Then run R from within Anaconda Prompt in Admin mode with R.exe
You’ll notice that you’re in an R session. From here, run the following three commands into the terminal.
install.packages("devtools")
devtools::install_github("IRkernel/IRkernel")
IRkernel::installspec()
In order, they (1) install the devtools package which gets you the install_github() function, (2) install the IR Kernel from GitHub, and (3) tell Jupyter where to find the IR Kernel.
Open Jupyter notebook and enjoy your new R kernel!
Get more information here
#Rheatey Bash works perfectly. but i was facing python.exe this program cant start because api-ms-win-core-path-l1-1-0.dll python system error. this is a problem running on windows 7 but i resolved this issue by installing the kernel following https://richpauloo.github.io/2018-05-16-Installing-the-R-kernel-in-Jupyter-Lab/ and it works fine

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.

how to install/update a package from source inside cygwin

new to Cygwin. I downloaded apg-cyg and have been using it to install packages.
Recently I installed R and the current version in Cygwin packages is R.3.2.4. I wanted to install the latest R package but couldn't find a way from googling on how to do it inside Cygwin.
Is this possible to do or I just have to wait for the Cygwin packages updating their packages to the latest version? It would be nice to be able to update a package using the source file inside Cygwin..
Edit:
I should mention that I tried to install ggplot2 inside R using install.packages() and there was non-zero exit status and the installation couldn't go through.
You can install the source using cygwin setup. Click on the mouse on the "Src?" column.
The source will be installed in /usr/src
PS: next R release 3.3.1 is in 11 days. It will be packed for cygwin if there are no build issue
Followup:
There were several build issues, it took longer than expected to build 3.3.1
https://www.cygwin.com/ml/cygwin-announce/2016-06/msg00056.html

Failed to install R on Centos 7

I have CentOS 7 (3.10.0-123.el7.x86_64) and I seem not be able to install R and then get Rstudio server working.
This is what I did:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install R
Then I got this error:
Transaction check error:
file /usr/lib/systemd/system/blk-availability.service from install of device-mapper-7:1.02.107-5.el7_2.1.x86_64 conflicts with file from package lvm2-7:2.02.105-14.el7.x86_64
file /usr/sbin/blkdeactivate from install of device-mapper-7:1.02.107-5.el7_2.1.x86_64 conflicts with file from package lvm2-7:2.02.105-14.el7.x86_64
file /usr/share/man/man8/blkdeactivate.8.gz from install of device-mapper-7:1.02.107-5.el7_2.1.x86_64 conflicts with file from package lvm2-7:2.02.105-14.el7.x86_64
I am not sure what it is. There is nothing from whereis R because it didn't install.
If I install Rstudio Server, it would fail to start the service and said ERROR unable to find installation of R in the system
Can someone tell me how to install R properly on Centos 7?
That is not related to R. Your log shows a conflict between "device-mapper" and "lvm2", and these packages are used to operate with devices such as hard disks and partitions (before someone downvotes me, YES this is a crude simplification).
You should try to update your system with yum before installing R.
I resolved this problem by updating lvm2 firstly, then install R.
This idea was from: https://bugzilla.redhat.com/show_bug.cgi?id=1294128

Resources