Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Tidyverse on Ubuntu 16.04 and 17.04

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.
like image 411
Jocelyn Ireson-Paine Avatar asked Aug 16 '17 17:08

Jocelyn Ireson-Paine


Video Answer


1 Answers

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

    ------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: [email protected] (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'

So I followed each prompt, installing the required deb, which came up to

sudo apt-get install libssl-dev libxml2-dev libcurl4-openssl-dev 

and it worked, after I had already tried installing the cran packages listed above, without adding the new repositories.

like image 62
tcanales Avatar answered Oct 16 '22 01:10

tcanales