如何在Ubuntu 16.04和17.04上安装Tidyverse

Joc*_*ine 10 r tidyverse

我正在运行Ubuntu 16.04 [现在是17.04:参见下面的粗体注释]和R 3.4.1.我今天早上安装了后者,所以我认为这是最新版本.我想安装Tidyverse,我在Windows下度过了很多欢乐时光.但是当我这样做时install.packages("tidyverse"),我得到了关于gcc无法识别的命令行选项的错误.当安装命中颜色空间和munsell包时,这些开始.我将在这篇文章的最后给出一个例子,仅供munsell使用.

我没有在Ubuntu 16.04上找到其他任何人确切存在这个问题的人.但来自有类似问题的人的帖子表明我的gcc可能是一个太旧的版本,无法识别选项-fstack-protector-strong和-Wdate-time.

我想到的可能的解决方法:

1)将Ubuntu更新为16.10或17.04,希望其中一个具有合适的gcc.但是,我在这里缺乏Ubuntu的专业知识:特别是,似乎我必须升级两次,一次升级到16.10再升级到17.04.我甚至无法将系统升级到16.10:https ://wiki.ubuntu.com/YakketyYak/ReleaseNotes ,"从Ubuntu 16.04 LTS升级"中建议的步骤,在我尝试时找不到升级.另外,我不确定这些Ubuntus中是否有正确的gcc.

第二天添加:虽然我尝试通过https://wiki.ubuntu.com/YakketyYak/ReleaseNotes升级Ubuntu 昨天没有做任何事情,但他们今天确实工作了.也许是一个缓存问题?所以我现在有Ubuntu 17.04.但是,在尝试安装Tidyverse时,我仍然会遇到相同的错误.

2)找到不需要那些编译器选项的旧版Tidyverse.

3)升级我的Ubuntu的gcc.但是我不知道是否会在我的机器上使用其他需要较旧gcc的软件.

4)为Tidyverse安装一个新的gcc,并以某种方式使用路径来欺骗安装程序调用它,可能遵循https://askubuntu.com/questions/466651/how-do-i-use-the中的建议-latest-gcc-on-ubuntu.但这听起来很危险.

5)废弃Ubuntu并在Windows上完成我的所有工作.我知道人们会嘲笑"Micro $ oft",但至少在Windows上,我不会浪费一个早晨的Linux arcana并且可以完成我的工作,这就是R.这种感觉太过于像牧师在https中的咒语://people.dsv.su.se/~jpalme/s1/hoare.pdf, "软件设计:一个寓言".只是说......

来自使用这些版本的R和Ubuntu实际执行此操作的人的任何建议?

这是一个失败的安装:

`> 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.

Pet*_*vos 19

在某些情况下,我发现我需要安装Ubuntu软件包.要安装tidyverse,我添加了sudo apt-get install r-cran-curl r-cran-openssl r-cran-xml2

安装完毕后我可以安装tidyverse.

  • 为了记录,这适用于Ubuntu版本18.04. (3认同)
  • 我的Ubuntu 16.04上的r-cran-rcurl和r-cran-xml。所以运行sudo apt-get install r-cran-xml r-cran-rcurl (2认同)

小智 6

我遇到了同样的问题,使用基于 ubuntu 16.04 的基本 loki。阅读输出,我意识到有一个非常有用的错误消息,看起来像这样

    ------------------------- 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: openssl@1.1 (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=...'
Run Code Online (Sandbox Code Playgroud)

所以我按照每个提示,安装所需的 deb,它出现了

sudo apt-get install libssl-dev libxml2-dev libcurl4-openssl-dev 
Run Code Online (Sandbox Code Playgroud)

在我已经尝试安装上面列出的 cran 软件包之后,它起作用了,而没有添加新的存储库。