Debian dependencies for some R Packages - r

I'm about to install a R environment on my debian Debian GNU/Linux 11 (bullseye).
I first simply ran
sudo apt-get --assume-yes install r-base
which worked. However, when installing some packages with install.packages("..") like keyring, lintr or usethis it requires me to install some debian libraries, e.g. libsodium-dev, libxml2-dev, r-cran-gert, libgit2-dev.
After installing these libs, everything worked fine. However, I was wondering if there is any way to pre-install all these debian libraries, e.g. with something like sudo apt-get install r-build-tools so that when I clear my setting and restart the installation process, I don't have to install required debian libraries manually.
Does s.th. come into your mind?

Related

Cannot install R - Unable to correct problems, you have held broken packages

We followed instructions here - https://rtask.thinkr.fr/installation-of-r-4-0-on-ubuntu-20-04-lts-and-tips-for-spatial-packages/ - to uninstall R:
sudo apt-get purge r-base* r-recommended r-cran-*
sudo apt autoremove
sudo apt update
...seems to have worked because when we run R in command line we get -bash: /usr/bin/R: No such file or directory. However, when we try to install R using:
apt install --no-install-recommends r-base
...version 3.6.3 is installed, not version 4.0 or 4.1. Here is our machine type.
What can we do to get R version 4.1.0 (preferred) installed on our machine? I am worried that, perhaps it is not possible as if it were, v4 would be the default rather than v3... might it be the case that 16.04 is too old for R v4?
Edit: followed the instructions in the comment below, but ran into the following issue:

How to install newer version of R on Amazon Linux 2

For whatever reason, Amazon moved R to the so-called "Extras Library" so you can't install R using sudo yum install -y R anymore. Instead, you have to do sudo amazon-linux-extras install R3.4. As a result, I can only install R 3.4.3 when the newest stable release is 3.6.1, and so many R libraries can't even be installed because the version is too low. Is there any good and clean way to install the latest version of R and skip Amazon's package manager? Thanks!
Use amazon-linux-extras which installs R4.0.2:
amazon-linux-extras install R4
You may need root:
sudo amazon-linux-extras install R4
I've tried setting up R 3.6.x on a docker container that uses the amazonlinux image. My approach was to get the R source file from the below link and install from source
cd /tmp/
wget https://cloud.r-project.org/src/base/R-3/R-3.6.3.tar.gz
tar -zxf R-3.6.3.tar.gz
cd /tmp/R-3.6.3
./configure --without-libtiff --without-lapack --without-ICU --disable-R-profiling --disable-nls
make
make install
you will need to yum install some dependencies, like 'make', which doesn't seem to come with aws amazonlinux docker image (which i think mirrors the EC2 instance AMI image you are referring to).
The above kind of worked for me in that i had a working R3.6 installation, but it didnt allow me use it with rshiny server, so i'm reverting to the shipped 3.4.3 version.
tl;dr: you'll probably have to manually download the source files and install the desired R version from source, and throw in some build dependencies as well.
Try this on Amazon Linux 2
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install R
Amazon Linux 2 Image contains extras library that can be used as well. Follow the guide here.
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-install-extras-library-software/
sudo amazon-linux-extras enable R3.4
sudo yum clean metadata && sudo yum install R3.4

Are packages deleted when upgrading R on Linux?

Are packages deleted when upgrading R on Linux? I would prefer to just use the default package installation directory, instead of setting up a custom directory.
I'm aware I can setup a custom directory in the following manner:
cat >> ~/.Renviron
R_LIBS=/data/Rpackages/
I just wonder what happens if I don't issue the command above? Will packages be wiped every time I issue the command
sudo apt-get update && sudo apt-get upgrade
, and as a consequence R gets updated to the latest version?
#Jason, when you are doing sudo apt-get update && sudo apt-get upgrade, it just upgrade packages that have a new version in your list of repositories. There is no reason it will modify R packages already installed.
I'm also running Linux and R and the only time I have to re-install R packages is when I re-install my system. My R packages are installed by default in /usr/local/lib/R/site-library

OpenCPU with R 3.5.1

Since yesterday everything was all right because I used openCPU with R 3.4.4 . Today I tried to install in a fresh ubuntu 16.04 system the R 3.5.1 because I had a problem with a package. So what I did is following:
# Repos for R3.5.1
sudo add-apt-repository ppa:marutter/rrutter3.5
sudo add-apt-repository ppa:marutter/c2d4u
# Repos for opencpu
sudo add-apt-repository -y ppa:opencpu/opencpu-2.0
sudo apt-get update && sudo apt upgrade
# Installs OpenCPU server
sudo apt-get install -y opencpu-server
Everything seemed alright until I tried to visit the http:/ip/ocpu/test and the page never loaded. Then I searched into apache's errorlog
Error: package ‘unix’ was installed by an R version with different
internals; it needs to be reinstalled for use with this R version
From directive RSourceOnStartup on line 7 of
/etc/apache2/sites-enabled/opencpu.conf. Using locale: en_US.UTF-8
Error: package ‘unix’ was installed by an R version with different
internals; it needs to be reinstalled for use with this R version
From directive RSourceOnStartup on line 7 of
/etc/apache2/sites-enabled/opencpu.conf.
I then open an R session and tried to load the unix library which is loaded as expected and without any problem.
Any idea? Is there a conflict between opencpu and R 3.5.2?
Actually, openCPU has its own library which located at /usr/lib/opencpu/library and those packages needed to be recompiled. So I did the following:
pkgs <- as.data.frame(installed.packages(lib.loc="/usr/lib/opencpu/library/"))
pkgs <- as.character(pkgs$Package)
install.packages(pkgs, lib="/usr/lib/opencpu/library/")
and now everything seems to be working.

How to install a specific version of nginx on Debian 7?

I did the following to nstall nginx on Debian 7
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo service nginx start
This installed the latest version of nginx , How do I install another version?
Doing sudo apt-get install nginx=1.2 or sudo apt-get install nginx-1.2 does not work. It fails saying version not found?
Older version of Nginx is not available in Debian repository, you need configure Nginx Debian repository http://nginx.org/en/linux_packages.html or find the deb package and install manually.
A distribution of Debian is a set of software packages that was tested to run well together. Every change imposes a risk to break somethign somewhere since that change may not have been prepared for by another software also installed.
When you are for a newever version than what the distributions ships, then a look at the package "tracker" will present an overview of what is currently available, which includes so-called backports to your distribution: https://packages.qa.debian.org/n/nginx.html but indeed the packages directly provided by nginx.org should be just fine. For looks into the past, check out http://snapshot.debian.org/package/nginx/ .

Resources