I have updated the sources.list file in /etc/apt with the link
deb https://cran.stat.nus.edu.sg/bin/linux/ubuntu precise/
I have changed precise with quantal, trusty also. I am staying in singapore so used the link from singapore. After
apt-get update
when I run
sudo apt-get install r-base
command i get the following error
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-base-core (>= 3.2.2-1precise0) but it is not going to be installed Depends: r-recommended (= 3.2.2-1precise0) 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.
Why Precise aka 12.10? That is neither the current LTS (14.04) nor the previous one (12.04).
As such, it is supported neither by Ubuntu (AFAIK) nor the Michael who (as a volunteer) looks after the "ports" of my Debian packages to Ubuntu.
I generally stay current, so my machines are currently all 15.04 with some 15.10. I recommend you do the same.
As for RStudio, it is still not apt-get'able so that will always be a simple download (though you can script that).
Related
Does anyone have a good approach to installing R on Ubuntu 20.04? I can't seem to find a solution for this specific to 20.04 focal through apt.
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
Edit: after going through the link here and adding the entry to sources.list, I ran into issues with dependencies:
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-base-core (>= 4.0.2-1.2004.0) but it is not going to be installed
Depends: r-recommended (= 4.0.2-1.2004.0) 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.
Per #DirkEddelbuettel's comment, I ran sudo apt install r-base-core r-recommended r-base-html to see next level dependencies:
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-core : Depends: libblas3 but it is not installable or
libblas.so.3 but it is not installable
Depends: liblapack3 but it is not installable or
liblapack.so.3 but it is not installable
Depends: libtcl8.6 (>= 8.6.0) but it is not installable
Depends: libtk8.6 (>= 8.6.0) but it is not installable
Recommends: r-base-dev but it is not going to be installed
Recommends: r-doc-html but it is not going to be installed
r-recommended : Depends: r-cran-kernsmooth (>= 2.2.14) but it is not going to be installed
Depends: r-cran-mgcv (>= 1.1.5) but it is not going to be installed
Depends: r-cran-rpart (>= 3.1.20) but it is not going to be installed
Depends: r-cran-survival (>= 2.13.2-1) but it is not going to be installed
Depends: r-cran-matrix but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
There was a more underlying issue when I worked on trying to install r-base. I ended up finding out that I had problems with unmet dependencies after adding a PPA. I used this link here to fix the underlying problem of unmet dependencies, which in turn allowed me to apt install and not have any issues installing.
Here is what I do in the Rocker container r-ubuntu for the 20.04 image:
Install software-properties-common to be able to say add-apt-repository
Add the rrutter4.0 PPA for R itself (same as CRAN)
add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0"
Add the c4d4u.teams repo for over 4k CRAN packages:
add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"
Run apt install r-base (and a few more).
In a narrow sense you only need 2 (as you likely do not 1 on a full Ubuntu system) and 4 but you may as well do 3.
You can of course also just to docker pull rocker/r-ubuntu:20.04 and get that container pre-made, but I use both: a container for tests, and these settings on my 20.04 machine(s).
Prerequisites
You will need an Ubuntu 20.04 with:
at least 1GB of RAM
a root user / non-root user with sudo privileges
Installing R
Because R is a fast-moving project, the latest stable version isn’t always available from Ubuntu’s repositories, so we’ll start by adding the external repository maintained by CRAN.
Note: CRAN maintains the repositories within their network, but not all external repositories are reliable. Be sure to install only from trusted sources.
Let’s first add the relevant GPG key.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Note that if you’re not using 20.04, you can find the relevant repository from the R Project Ubuntu list, named for each release. Ubuntu 20.04 is referred to as Focal Fossa, and the most recent version of R is 4.0.0, hence the naming convention of the repository below — focal-cran40.
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
Now, we’ll need to run update after this in order to include package manifests from the new repository.
sudo apt update
At this point, we’re ready to install R with the following command.
sudo apt install r-base
If prompted to confirm installation, press y to continue.
Finally get into R shell-
sudo -i R
This confirms that we’ve successfully installed R and entered its interactive shell.
I want to be able to install the latest stable R release for Ubuntu 18.04, I had the ubuntu version installed and so I removed it and then followed several guides like in this link.
No matter what I do I get the following output when I issue a sudo apt-get install r-base:
sudo apt 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-base-core (>= 3.6.1-3disco) but it is not going to be installed
Depends: r-recommended (= 3.6.1-3disco) 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.
What's wrong?
I'm trying to install R from the terminal following this site:
https://www.r-bloggers.com/how-to-install-r-on-linux-ubuntu-16-04-xenial-xerus/
When I execute sudo apt-get install r-base, I get the following error:
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-base-core (>= 3.3.2-1xenial0) but it is not going to be installed
Depends: r-recommended (= 3.3.2-1xenial0) 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.
Add the two others to the command, and see the errors it generates, ie do
sudo apt-get install r-base r-base-core r-recommended
You likely you have something installed which conflicts. Many (and I mean thousands) of us run these packages just fine.
You can also consider the r-sig-debian mailing list.
I'm trying to install the GTK+ library on my distribution using :
sudo apt-get install libgtk-3-dev
However I get these logs (errors):
The following packages have unmet dependencies:
libgtk-3-dev : Depends: libgtk-3-0 (= 3.10.8-0ubuntu1.6) but 3.14.15-0ubuntu1~14.04~ricotz1 is to be installed
Depends: gir1.2-gtk-3.0 (= 3.10.8-0ubuntu1.6) but 3.14.15-0ubuntu1~14.04~ricotz1 is to be installed
Depends: libglib2.0-dev (>= 2.37.5) but it is not going to be installed
Depends: libgdk-pixbuf2.0-dev (>= 2.27.1) but it is not going to be installed
Depends: libpango1.0-dev (>= 1.32.4) but it is not going to be installed
Depends: libatk1.0-dev (>= 2.7.5) but it is not going to be installed
Depends: libatk-bridge2.0-dev but it is not going to be installed
Depends: libcairo2-dev (>= 1.13.0~20140204) but it is not going to be installed
Depends: libwayland-dev (>= 1.2.0) but it is not going to be installed
Depends: libxkbcommon-dev but it is not going to be installed
Depends: libxi-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I've recently started working on unix systems, so I don't know how to correct this.
Any help will be appreciated.
After some serious googling and reading through all the errors , I have discovered that this is a delicate situation . Apparently there is no single answer for this , and if it is it's not the right one.
I've tried the following which works :
It is recommended to use aptitude for this kind of work because aptitude offers a conflict resolver , it basically visualize unmet dependencies (and tries to solve them).
sudo apt-get update
sudo apt-get install aptitude
Then
sudo aptitude install libgtk-3-dev
Even if this will solve the issue in most cases, it does not have a 100% succes rate.
There are differrent approaches , like cleaning up the apt cache , (it didn't work for me) and then using : sudo apt-get install libgtk-3-dev -f , which will attempt to fix broken dependencies.
There are too many ways , all that I have learned is from this post.
NOTE ->
It is possible that I have this particular issue because of my linux distro , I have read that is not very stable and it is recommended to start with some more stable and reliable versions like : Debian or Ubuntu.(for beginners)
I'm a newbie to Linux and try to install the latest R version on my Raspberry.
My Raspberry runs on Wheezy 7.8.
I followed instructions on CRAN, so I
added
deb http://cran.rstudio.com/bin/linux/debian wheezy-cran3/
to /etc/apt/sources.list
ran apt-get update which was successful and gave me only a "signature error" for the public key as pointed out on the CRAN-site
ran apt-get install r-base
But the result of the last command is
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-base-core (>= 3.1.2-1~wheezycran3.0) but it is not going to be installed
Depends: r-recommended (= 3.1.2-1~wheezycran3.0) but it is not going to be installed
Recommends: r-base-html but it is not going to be installed
Recommends: r-doc-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I tried to install R-2.15 before and then run the above commands. R-2.15 could be installed successfuly, but I'd need R-3* really.
I did browse the web, but couldn't find any useful hints for my specific problem, so I appreciate any support you could give me.
Thanks!
If it is of any use:
apt-cache policy r-base gives
r-base:
Installed: (none)
Candidate: 3.1.2-1~wheezycran3.0
Version table:
3.1.2-1~wheezycran3.0 0
500 http://cran.rstudio.com/bin/linux/debian/ wheezy-cran3/ Packages
3.1.0-1~wheezycran3.0 0
500 http://cran.rstudio.com/bin/linux/debian/ wheezy-cran3/ Packages
2.15.1-4 0
500 http://mirrordirector.raspbian.org/raspbian/ wheezy/main armhf Packages
apt-cache policy r-base-core gives
r-base-core:
Installed: (none)
Candidate: 2.15.1-4
Version table:
2.15.1-4 0
500 http://mirrordirector.raspbian.org/raspbian/ wheezy/main armhf Packages
uname -a gives
Linux raspberrypi 3.18.5+ #744 PREEMPT Fri Jan 30 18:19:07 GMT 2015 armv6l GNU/Linux
I had the same situation and decided to install that from the source code instead of install R from the repository(apt-get command).
Here is the command I run on my Raspberry Pi 2.
I could install and run R(3.1.2) sucessfully.
It might not be complete answer for you because I might already installed the library like gcc you did not have before. If you encounter the other issue, please let me know. I would like to solve it.
Just as a side note on this topic, because sudo make install process took a long time(maybe over a hour. I'm not sure because I feel asleep before I knew it...), I recommend you to do this when you have enough or before going to sleep like me.
wget http://cran.rstudio.com/src/base/R-3/R-3.1.2.tar.gz
mkdir R_HOME
mv R-3.1.2.tar.gz R_HOME/
cd R_HOME/
tar zxvf R-3.1.2.tar.gz
cd R-3.1.2/
sudo apt-get install gfortran libreadline6-dev libx11-dev libxt-dev
./configure
make
sudo make install
R
The cause of your problem is likely that the cran repository provides armel versions of the packages, and not armhf (which is the expected architecture for your RPI). If this is right, then you have two solutions:
The first work-around could be to download the armel version of the packages and then force their installation despite the architecture mismatch. It is supposed to work according to the Debian wiki, although you may experience performance issues:
The CPU in the Raspberry Pi implements the ARMv6 ISA (with VFP2) and
is thus incompatible with the Debian armhf port baseline of ARMv7+VFP3
and ARM hardware-floating-point ports for other distributions, which
all have the same baseline. It is compatible with Debian armel
(armv4t, soft(emulated) FP), but floating-point tasks will be slow
when running the Debian armel port.
To do that, you can try to reinstall the packages by specifying the armel architecture, for example:
apt-get install r-base:armel
If it doesn't work this way, you can otherwise download the packages from http://cran.r-project.org/bin/linux/debian/wheezy-cran3/ and install them manually using a commandline like:
dpkg --install --force-architecture xxxx_armel.deb yyyy_armel.deb zzzz_armel.deb
The other solution would be to compile R from its source.
I solved my initial question by upgrading Wheezy to Jessie. I am not an expert, but Jessie seems to be the current testing version of Debian, while Wheezy is the stable release - see here.
For upgrading, I followed the instructions here, or here, or here. Note: Upgrading takes quite a while and during the process you're required to answer some questions.
A word of caution though: Jessie is still testing and some people recommend not to use it yet, for a discussion see e.g. here.
I did set it up completely from a new completely new image, and it works well.
After having upgraded to Jessie I installed R-3.1.1. using
sudo apt-get install r-base
And I'd like to thank all those who have answered my question and given alternative ways of solving the problem above.
I'm able to install R-3.1.2 into raspbian using answer from teramonagi. I confirm it can install successfully on Raspberry Pi model B/B+.
However, before you can actually use R (install packages and run some R scripts), you have to increase the swap file size for Raspberry Pi due to lack of RAM (This service works very similar to page file in window, it kicks in when RAM usage is high). You can configure it by edit one of the config file by enter command below in LX terminal.
sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=100 #(change 100 to 512 or 1024, up to you, save the file)
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start #(restart swap file service with new swap file size)
Take note though, some users argued that increase swap file size can actually ruin your SD card. So apply this change at your own risk. I've been running my Pi with this configuration for my R automation for 1 month now. No issue so far.
Hope this helps.
Edit: If you are using model B/B+, i recommend to configure swap file size first then compile R.
That's what I've done to update my r-base on wheezy:
HOW TO UPDATE r-base 2.15 to 3.x ON DEBIAN WHEEZY
add these lines at the end of "/etc/apt/sources.list"
deb http://cran.revolutionanalytics.com/bin/linux/debian wheezy-cran3/
deb-src http://cran.revolutionanalytics.com/bin/linux/debian wheezy-cran3/
add the missing publich key of cran
gpg --keyserver pgpkeys.mit.edu --recv-key 06F90DE5381BA480
gpg -a --export 06F90DE5381BA480 | sudo apt-key add -
update and upgrade
apt-get update
aptitude -t wheezy-cran3 install r-base r-base-dev