如何在 Ubuntu 16.04 和 17.04 上安装 Tidyverse [英] How to install Tidyverse on Ubuntu 16.04 and 17.04

查看:37
本文介绍了如何在 Ubuntu 16.04 和 17.04 上安装 Tidyverse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Ubuntu 16.04 [现在是 17.04:请参阅下面的粗体注释] 和 R 3.4.1.我今天早上安装了后者,所以我认为它是最新版本.我想安装 Tidyverse,我在 Windows 下度过了许多欢乐时光.但是当我执行 install.packages("tidyverse") 时,我会收到有关 gcc 无法识别的命令行选项的错误.这些在安装遇到 colorspace 和 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 升级",当我尝试升级时找不到升级.另外,我不确定这些 Ubuntu 是否有正确的 gcc.

第二天添加:虽然我尝试按照 https 升级 Ubuntu://wiki.ubuntu.com/YakketyYak/ReleaseNotes 昨天什么都没做,他们今天工作了.也许是缓存问题?所以我现在有 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 奥秘上浪费一个上午,并且可以完成我的工作,即 R.这感觉太像牧师在https://people.dsv.su.se/~jpalme/s1/hoare.pdf,软件设计:一个寓言".只是说...

实际使用过这些版本的 R 和 Ubuntu 的人有什么建议吗?

这是一个失败的安装:

<前>`> install.packages("munsell")安装包到‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4’(因为'lib'未指定)还安装依赖项colorspace"尝试 URL 'https://cran.rstudio.com/src/contrib/colorspace_1.3-2.tar.gz'内容类型 'application/x-gzip' 长度 293433 字节 (286 KB)==================================================已下载 286 KB尝试 URL 'https://cran.rstudio.com/src/contrib/munsell_0.4.3.tar.gz'内容类型 'application/x-gzip' 长度 97244 字节 (94 KB)==================================================已下载 94 KB* 安装 *source* 包 ‘colorspace’ ...** 包colorspace"成功解包并检查 MD5 总和** 库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 色彩空间.c -o 色彩空间.ogcc:错误:无法识别的命令行选项-fstack-protector-strong"gcc:错误:无法识别的命令行选项-Wdate-time"/usr/lib/R/etc/Makeconf:159: 目标colorspace.o"的配方失败制作:*** [colorspace.o] 错误 1错误:包colorspace"编译失败* 删除‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4/colorspace’install.packages 中的警告:安装包colorspace"的退出状态非零错误:依赖项colorspace"不可用于包munsell"* 删除‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4/munsell’install.packages 中的警告:安装包munsell"的退出状态为非零下载的源码包在‘/tmp/RtmpQ8FW70/downloaded_pa​​ckages’警告信息:此版本的 RStudio 不支持 R 图形引擎版本 12.在安装较新版本的 RStudio 之前,绘图选项卡将被禁用.

解决方案

在某些情况下,我发现我需要安装 Ubuntu 软件包.要安装我添加的 Tidyverse

sudo apt-get install r-cran-curl r-cran-openssl r-cran-xml2

安装这些软件包后,我可以安装 Tidyverse.

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

sudo apt-get install r-cran-curl r-cran-openssl r-cran-xml2

After installing these packages, I could install the Tidyverse.

这篇关于如何在 Ubuntu 16.04 和 17.04 上安装 Tidyverse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆