Can't install R on Ubuntu 20.04 running in WSL 2 - r

So, I am trying to install R on WSL 2 running Ubuntu 20.04. I followed the instructions here Cran ubuntu packages. As per instructions I added deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/
to /etc/apt/sources.list.
Added the security key sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Ran sudo apt-get update. Checked R packages available: apt list r-base -a.
I get this list:
r-base/bionic-cran40 4.0.1-1.1804.0 all
r-base/bionic-cran40 4.0.0-1.1804.0 all
r-base/bionic 3.4.4-1ubuntu1 all
Finally I ran sudo apt-get install r-base. It threw the following error:
The following packages have unmet dependencies:
r-base : Depends: r-base-core (>= 4.0.1-1.1804.0) but it is not going to be installed
Depends: r-recommended (= 4.0.1-1.1804.0) but it is not going to be installed
Recommends: r-base-html but it is not going to be installed
So I tried running sudo apt-get install r-base-core. Got the following error:
r-base-core : Depends: liblapack3 but it is not going to be installed or
liblapack.so.3
Recommends: r-recommended but it is not going to be installed
Recommends: r-base-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Does anyone know why this is happening and if there's a way to install R on WSL 2 Ubuntu? There are other related questions here but they are not for Ubuntu 20.04 and R 4. Your help is appreciated. Thank you!

For the benefit of those who may have encountered the same issue, I solved it by replacing my original sources.list file by the one I got from this link. Then I followed the steps found at the R ubuntu packages page again and it installed the latest R version (4.0.3) as expected.

Related

R 4.2.2 on Ubuntu Server 22.10

I try to install R 4.2.2 but it is able to install only 4.2.1.
The following packages have unmet dependencies: r-base-core :
Depends: libicu70 (>= 70.1-1~) but it is not installable
Recommends: r-doc-html but it is not going to be installed E: Unable to correct problems, you have held broken
packages.
I have
libicu-dev is already the newest version (71.1-3ubuntu1).
Could be that is not yet supported for 22.10? or is there any turnaround to install it?
Thanks
I am running ubuntu 22.10 and had the same problem. I have solved it via:
wget http://ftp.osuosl.org/pub/ubuntu/pool/main/i/icu/libicu70_70.1-2_amd64.deb
sudo dpkg -i libicu70_70.1-2_amd64.deb
then this will work:
sudo apt-get install r-base-core

Can't install r-base on Ubuntu 19.10; unmet dependencies r-recommended

In general, I am new in working with Ubuntu (19.10;eoan) and currently trying to install r-base. r-base-dev is installed.
When I do so, I get the following message:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-base : Depends: r-recommended (= 3.6.2-1xenial) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I have used the following Threads to try to fix my problem - without any succes.
Installing r-base; Depenency: r-recommended missing?
Issues in installing r-base-dev
For this one I stopped at the section: "Disable/Remove/Purge PPA:". Because I was not able to understand the process.
https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa
I will appreciate any solution or advice to solve my problem.
Without more information about what you actually tried (and the order) it is difficult to try and pinpoint why it doesn't work, but I recently installed this on 19.10 myself. I used the following.
# Get the key from the keyserver.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
# Add the repository to your sources.list. Make sure that it does not already exist
# and that it is not a typo in there. Making a backup of the file before running the
# next line is useful.
echo "deb https://cloud.r-project.org/bin/linux/ubuntu eoan-cran35/" | sudo tee -a /etc/apt/sources.list
# Install base, dev and other dependencies.
sudo apt install r-base r-base-dev r-cran-curl r-cran-openssl r-cran-xml2 libssl-dev libxml2-dev libcurl4-openssl-dev
It worked without any problem for me. It is very important that you add the correct repository to your sources.list. Judging by the error message you are using a repository referring to Ubuntu Xenial and not Ubuntu Eoan.

Update R base - Ubuntu from 3.4.4 to 3.5.2 - Azure

I'm using Ubuntu 16.04 on Azure Linux Virtual Machine
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
The current R version for Rstudio/Rserver is 3.4.4 and I would like to update it to the latest version (i.e. version 3.5.2)
R --version
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
From some reasons, the most common method doesn't work:
apt-get update
apt-get upgrade
So I did some research and find this post on biostars.org
One of the posts says the following codes might work
sudo su
echo "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
apt-get update
apt-get install r-base
apt-get install r-base-dev
However, after apt-get install r-base I'm getting the following error message:
root#VMforR:/usr/local/bin# apt-get install r-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-base : Depends: r-recommended (= 3.5.2-1xenial) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I don't understand what "held broken packages" means, and more importantly, how to update the R base?
What worked for me was to add the PPA of Michael Rutter:
sudo add-apt-repository ppa:marutter/rrutter3.5
sudo apt-get update
Update R:
sudo apt install r-api-3.5
I'm with the 16.04 LTS ubuntu.
Have tried some other methods, the following seems to work:
sudo apt-get install r-base-core=3.5.2-1xenial
Ref:
1. Install particular version(2.15.2) of r-base on ubuntu
2. https://cran.rstudio.com/bin/linux/ubuntu/xenial-cran35/
But I'm not sure if this also work for others or not, as I can't reproduce it.
After
apt-get update
do
apt-get dist-upgrade
first to "move your installation forward". That includes upgrading already installed packages. It should just upgrade your R installation (unless you also switch / need to switch repositories).
The r-sig-debian list is good and patient with basic 'how do it od X for R on Debian/Ubuntu'. Consider subscribing to lurk and/or ask questions.
Mine said some of my packages were missing. So, I ran sudo dpkg --configure -a and then re-run the R --update and it worked to correct the missing package error.

Install particular version(2.15.2) of r-base on ubuntu

I am newbie to both Ubuntu and R.
I am trying to install R 2.15.2 on ubuntu. Since the latest version of R is 3.0.X, I specified the version in /etc/apt/sources.list
deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu precise 2.15.2
Then I ran sudo apt-get install r-base.
It installs, but when I check version, it is 2.14.1, not 2.15.2
I tried to specify version in command line, such as:
sudo apt-get install r-base_2.15.2_1precision1
Always seeing:
E: Unable to locate package r-base_2.15.2_1precision1.
E: Couldn't find any package by regex 'r-base_2.15.2_1precision1'
Any suggestion? Thanks.
If I run command:
sudo apt-get install r-base=2.15.2-1precise0
See the following message:
The following packages have unmet dependencies:
r-base : Depends: r-recommended (= 2.15.2-1precise0) but 3.0.1-1precise0precise2 is to be installed
Recommends: r-base-html but it is not going to be installed
Find the solution.
I need to install like:
sudo apt-get install r-base-core=2.15.3-1precise0precise1
sudo apt-get install r-recommended=2.15.3-1precise0precise1
sudo apt-get install r-doc-html=2.15.3-1precise0precise1
sudo apt-get install r-base=2.15.3-1precise0precise1
Okay so the URL for where the packages are found has changed :^) on the cran.ma site:
Change the debian url to:
deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu precise/
do an apt-get update and try reinstalling
The complete instructions are on:
http://cran.ma.imperial.ac.uk/bin/linux/ubuntu/

re- installing R linux ubuntu: unmet dependencies R

I used aptitude install to install a package, Ubuntu 11.10 oneiric, that apparently I couldn't install because of dependencies. I removed a couple of more libraries while doing it. I uninstalled Rstudio but still can't install R on my machine. I'm on ubuntu and this is what I get while running
sudo apt-get install r-base
The following packages have unmet dependencies:
r-base : Depends: r-base-core (>= 2.15.3-1quantal0) but it is not going to be installed
Depends: r-recommended (= 2.15.3-1quantal0) but it is not going to be installed
Recommends: r-base-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
any ideas how to start from scratch and get R running again?
More of the Error log:
The following packages have unmet dependencies r-base-core : Depends: libblas3 but it is not installable or libblas.so.3 but it is not installable or libatlas3-base but it is not installable Depends: libc6 (>= 2.15) but 2.13-20ubuntu5.3 is to be installed Depends: liblapack3 but it is not installable or liblapack.so.3 but it is not installable or libatlas3-base but it is not installable Depends: liblzma5 (>= 5.1.1alpha+20120614) but it is not installable –
Try this
If you have added a line from new ubuntu repository to /etc/apt/sources.list, erase the line.
Then, run the commands
sudo add-apt-repository ppa:marutter/rrutter
sudo apt-get update
sudo apt-get upgrade
It worked for me, the answer comes from here
http://r.789695.n4.nabble.com/Upgrading-on-Ubuntu-from-2-11-1-to-2-15-1-td4636965.html
Uninstall previous R installation:
sudo R --no-save
pkgList <- installed.packages(priority='NA')
remove.packages(pkgList)
q()
sudo apt-get remove --purge r-cran* r-base*
Follow instructions (for R part) from:
How to install R, JGR and Deducer in Ubuntu
To list what you installed with aptitude type the following
xyz#sxyzcom~$ sudo apt-get remove
This should list what remains of your R install and possibly anything else missing dependencies Then you can run
xyz#sxyzcom~$ sudo apt-get autoremove
and that should get you back to square one.
If you are facing problems regarding Broken packages then first of all remove that package by first checking dependencies and then forcefully remove that package, and don't ever forget to reboot when you do make enormous changes in your system. To remove that package use these shell commands
$ sudo su
Then Enter your password
# apt-cache rdepends package-name
# apt-get --purge remove --force package-name
Use these shell commands
# apt-get clean
# apt-get autoclean
# apt-get update
# apt-get upgrade
# apt-get dist-upgrade
# reboot
This worked for me, Try this, I believe this will fix all your problems, Good luck.
If you want to remove the package forcefully,you can do
sudo dpkg --remove --force-remove-reinstreq package_name
and then
sudo apt-get update

Resources