I'm running Ubuntu 16.04 [now 17.04: see note in bold below] and R 3.4.1. I installed the latter this morning, so I presume it's the latest version. I want to install Tidyverse, which I've spent many happy hours with under Windows. But when I do install.packages("tidyverse")
, I get errors about unrecognized command line options to gcc. These start when the install hits the colorspace and munsell packages. I'll show an example at the end of this post, just for munsell.
I've not found anyone else who had exactly that problem on Ubuntu 16.04. But posts from people with similar problems suggest that my gcc might be a version that's too old to recognise the options -fstack-protector-strong and -Wdate-time.
Possible work-arounds that I've thought of:
1) Update Ubuntu to 16.10 or 17.04 in the hope that one of these has a suitable gcc. However, I'm hitting my lack of Ubuntu expertise here: in particular, it appears that I have to upgrade twice, once to 16.10 and then again to 17.04. I can't even make the system upgrade to 16.10: the steps recommended at https://wiki.ubuntu.com/YakketyYak/ReleaseNotes , "Upgrading from Ubuntu 16.04 LTS", don't find upgrades when I try them. Also, I don't know for sure whether either of those Ubuntus would have the right gcc.
Added the following day: Although my attempts to upgrade Ubuntu by following https://wiki.ubuntu.com/YakketyYak/ReleaseNotes did nothing yesterday, they did work today. Maybe a caching problem? So I now have Ubuntu 17.04. However, I still get the same errors when trying to install Tidyverse.
2) Find an older version of Tidyverse that doesn't need those compiler options.
3) Upgrade my Ubuntu's gcc. But I don't know whether that would nuke other software on my machine that expects an older gcc.
4) Install a new gcc just for Tidyverse, and somehow play with paths to fool the installer into calling it, perhaps by following the advice in https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu . But that sounds risky.
5) Scrap Ubuntu and do all my work on Windows. I know people deride "Micro$oft", but at least with Windows, I don't waste a morning with Linux arcana and can do my job, which is R. This is feeling far too much like the priests with their incantations in https://people.dsv.su.se/~jpalme/s1/hoare.pdf , "Software Design: a Parable". Just saying...
Any suggestions from someone who has actually done this with these versions of R and Ubuntu?
Here's an install that failed:
`> install.packages("munsell") Installing package into ‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4’ (as ‘lib’ is unspecified) also installing the dependency ‘colorspace’ trying URL 'https://cran.rstudio.com/src/contrib/colorspace_1.3-2.tar.gz' Content type 'application/x-gzip' length 293433 bytes (286 KB) ================================================== downloaded 286 KB trying URL 'https://cran.rstudio.com/src/contrib/munsell_0.4.3.tar.gz' Content type 'application/x-gzip' length 97244 bytes (94 KB) ================================================== downloaded 94 KB * installing *source* package ‘colorspace’ ... ** package ‘colorspace’ successfully unpacked and MD5 sums checked ** libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c colorspace.c -o colorspace.o gcc: error: unrecognized command line option '-fstack-protector-strong' gcc: error: unrecognized command line option '-Wdate-time' /usr/lib/R/etc/Makeconf:159: recipe for target 'colorspace.o' failed make: *** [colorspace.o] Error 1 ERROR: compilation failed for package ‘colorspace’ * removing ‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4/colorspace’ Warning in install.packages : installation of package ‘colorspace’ had non-zero exit status ERROR: dependency ‘colorspace’ is not available for package ‘munsell’ * removing ‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4/munsell’ Warning in install.packages : installation of package ‘munsell’ had non-zero exit status The downloaded source packages are in ‘/tmp/RtmpQ8FW70/downloaded_packages’ Warning message: R graphics engine version 12 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.
In some cases I find that I need to install the Ubuntu packages. To install the Tidyverse I added
After installing these packages, I could install the Tidyverse.
I believe had a similar problem trying to install the tidyverse package. Being reasonably new to Linux and a complete rookie to R, I followed the Ubuntu installation intructions on the CRAN Project's homepage. When I installed R, I deliberately skipped installation of the r-base-dev package, as it said it was intended for "package maintainers". I didn't really read the latter part or understand the necessity for compiling packages myself.
Anyway, installing
r-base-dev
package, and allowed me to install the Tidyverse package without problems. The complete steps to get it to work should be something like below. In terminal do the following steps (Step 1-3 may or may not be necessary, but I've added them just in case):deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu artful/
in your/etc/apt/sources.list
file, replacing by the actual URL of your favorite CRAN mirror. See https://cran.r-project.org/mirrors.html for the list of CRAN mirrors.Add the repository key to your system:
An alternate method can be used by retrieving the key with
and then feed it to apt-key with
To install the complete R system, use
Then comes the step I missed, that proved crucial to be able to compile the packages within the Tidyverse package, namely installing the
r-base-dev
package:Then in RStudio execute the package installation command:
Hopefully this will work for you as well. Read the installation guide on the CRAN Projects homepages for further about the installation procedure.
I run into the same problem, using elementary loki, based on ubuntu 16.04. Reading the output, I realized there was a very informative error message, that looked like this
So I followed each prompt, installing the required deb, which came up to
and it worked, after I had already tried installing the cran packages listed above, without adding the new repositories.