【问题标题】:Problems installing R packages on Linux Mint 18.1在 Linux Mint 18.1 上安装 R 包时出现问题
【发布时间】:2017-06-21 01:31:37
【问题描述】:

所以我一直在尝试安装 Shiny 和 Devtools R 软件包,但我遇到了如下相同类型的错误:无论哪种类型的软件包,它总是有一个非零退出并包含“错误:未知类型名称“文件””消息。下面是一个例子。作为记录,我已经运行了 apt-get update 和 upgrade 命令,尝试重新安装 R 和 RStudio 等,但我一直遇到这个问题。

这是我的 /etc/apt/sources.list:

#deb cdrom:[Linux Mint 18.1 _Serena_ - Release amd64 20161213]/ xenial contrib main non-free
deb http://cran.rstudio.com/bin/linux/ubuntu xenial/
deb https://cloud.r-project.org/bin/linux/ubuntu xenial/

我被这个卡住了,谁能帮我弄清楚如何才能让这些 R 包正确安装?我没有通过 RStudio 的 IDE 或 CLI 尝试过任何运气...这里缺少什么?????

install.packages("tibble")
Installing package into ‘/home/lennys/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependency ‘lazyeval’

trying URL 'https://cloud.r-project.org/src/contrib/lazyeval_0.2.0.tar.gz'
Content type 'application/x-gzip' length 317272 bytes (309 KB)
==================================================
downloaded 309 KB

trying URL 'https://cloud.r-project.org/src/contrib/tibble_1.2.tar.gz'
Content type 'application/x-gzip' length 54517 bytes (53 KB)
==================================================
downloaded 53 KB

* installing *source* package ‘lazyeval’ ...
** package ‘lazyeval’ 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 expr.c -o expr.o
In file included from expr.c:3:0:
/usr/share/R/include/Rinternals.h:1042:48: error: unknown type name ‘FILE’
 void R_InitFileInPStream(R_inpstream_t stream, FILE *fp,
                                                ^
/usr/share/R/include/Rinternals.h:1045:50: error: unknown type name ‘FILE’
 void R_InitFileOutPStream(R_outpstream_t stream, FILE *fp,
                                                  ^
/usr/lib/R/etc/Makeconf:132: recipe for target 'expr.o' failed
make: *** [expr.o] Error 1
ERROR: compilation failed for package ‘lazyeval’
* removing ‘/home/lennys/R/x86_64-pc-linux-gnu-library/3.3/lazyeval’
ERROR: dependency ‘lazyeval’ is not available for package ‘tibble’
* removing ‘/home/lennys/R/x86_64-pc-linux-gnu-library/3.3/tibble’

The downloaded source packages are in
    ‘/tmp/RtmpvLx4dw/downloaded_packages’
Warning messages:
1: In install.packages("tibble") :
  installation of package ‘lazyeval’ had non-zero exit status
2: In install.packages("tibble") :
  installation of package ‘tibble’ had non-zero exit status
>

更多信息:我一直在努力解决这个问题,但仍然没有成功。不过,我不断地看到这种情况:

In file included from print_stderr.c:2:0:
/usr/share/R/include/Rinternals.h:1042:48: error: unknown type name ‘FILE’
 void R_InitFileInPStream(R_inpstream_t stream, FILE *fp,
                                                ^
/usr/share/R/include/Rinternals.h:1045:50: error: unknown type name ‘FILE’
 void R_InitFileOutPStream(R_outpstream_t stream, FILE *fp,

【问题讨论】:

    标签: r rstudio linux-mint


    【解决方案1】:

    我遇到了同样的问题,我已经解决了:

    • 卸载 R:sudo apt-get remove r-base-core
    • 卸载 rStudio:sudo apt-get remove rstudio

    然后,重新安装 R:

    • sudo apt-get install r-base r-base-dev
    • 重新安装或 rStudio,终于搞定了,可以下载软件包

    【讨论】:

      【解决方案2】:

      我正在运行 Mint 18.1,并且刚刚安装了 R:

      sudo apt-get install r-base r-base-dev
      

      (我猜“r-base-dev”就足够了。)

      作为非 root 用户,我随后启动 r 并输入:

      install.packages('tibble')
      

      它询问了镜像,我选择了一个地理位置相近的镜像,它询问我是否想创建一个本地存储库(而不是系统范围的存储库),我说是的。

      然后我的输出与你的不同:

      also installing the dependencies ‘rlang’, ‘Rcpp’
      
      trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/rlang_0.1.1.tar.gz'
      Content type 'application/x-gzip' length 201419 bytes (196 KB)
      ==================================================
      downloaded 196 KB
      
      trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/Rcpp_0.12.11.tar.gz'
      Content type 'application/x-gzip' length 2485092 bytes (2.4 MB)
      ==================================================
      downloaded 2.4 MB
      
      trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/tibble_1.3.3.tar.gz'
      Content type 'application/x-gzip' length 91511 bytes (89 KB)
      ==================================================
      downloaded 89 KB
      

      即tibble 是 1.3.3 版本,而不是 1.2,并且 rcpp 和 rlang 是依赖项,而不是lazyeval。但我怀疑这与您收到的错误消息有关,更多的是与 2 月和 6 月之间发生的变化有关。

      我从另一个答案中看到您放弃并重新安装了操作系统(Mint/Ubuntu 的差异不会导致您看到的错误)。我怀疑一个不太极端的解决方案是卸载 r,然后重新安装,确保它是您正在安装的“r-base-dev”。如果它继续,卸载并重新安装“gcc”,因为抱怨 FILE 表明 C 编译器安装严重搞砸了。

      【讨论】:

        【解决方案3】:

        我已经这样做了足够长的时间,知道如果我想安装 RStudio & R,那么最好事先检查并了解如何安装。因此,当查询(ubuntu mint 16.10 rstudio install apt-get)没有返回任何类似于可用答案的内容时,我并不感到惊讶。因此,我进行了调查,并设法偶然发现了以下 URL,这些 URL 阐明了问题,并描述了一个命令行解决方案,以使事情正常运行。

        如果这个问题已经得到解决,那会很酷,但我的感觉是,因为固有的 Yak Shaving (http://sethgodin.typepad.com/seths_blog/2005/03/dont_shave_that.html) SNAFU 级别与 Ubuntu v16.04 到 v16.10 非功能的情况相同,所以这些修复描述仍然可行,并且可能作为修复类似损坏的其他包的一个很好的模板。

        干杯,奥东曹

        【讨论】:

          【解决方案4】:

          我没有答案,但我只能告诉你

          • 在 Debian 和 Fedora 上进行 CRAN 测试,它当然可以在那里工作
          • 使用 Ubuntu 的人越来越少,Michael 通过他的 PPA 构建 > 3k 个软件包
          • 也许 Mint 更改了默认库
          • FILE 是非常普通的老 C,真的应该知道
          • 您的报告缺乏详细信息,因为我们无法确定您使用的是什么编译器、什么 libc……

          再说一遍,第一件事是:您是否安装了包r-base-dev 以确保满足一堆其他依赖项?

          最后,从我的 Ubuntu 16.10 笔记本电脑登录:

          edd@brad:~$ install.r tibble
          trying URL 'https://cloud.r-project.org/src/contrib/tibble_1.2.tar.gz'
          Content type 'application/x-gzip' length 54517 bytes (53 KB)
          ==================================================
          downloaded 53 KB
          
          * installing *source* package ‘tibble’ ...
          ** package ‘tibble’ successfully unpacked and MD5 sums checked
          ** libs
          ccache g++ -I/usr/share/R/include -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O3 -Wall -pipe -Wno-unused -pedantic -march=native -c RcppExports.cpp -o RcppExports.o
          ccache g++ -I/usr/share/R/include -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O3 -Wall -pipe -Wno-unused -pedantic -march=native -c matrixToDataFrame.cpp -o matrixToDataFrame.o
          g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o tibble.so RcppExports.o matrixToDataFrame.o -L/usr/lib/R/lib -lR
          installing to /usr/local/lib/R/site-library/tibble/libs
          ** R
          ** inst
          ** preparing package for lazy loading
          ** help
          *** installing help indices
          ** building package indices
          ** installing vignettes
          ** testing if installed package can be loaded
          * DONE (tibble)
          
          The downloaded source packages are in
                  ‘/tmp/downloaded_packages’
          edd@brad:~$ 
          

          标准建议:可能会在 r-sig-debian 上询问,因为其他 Mint 用户潜伏在那里。

          【讨论】:

          • 感谢您的意见,德克。可悲的是,我从来没有找到可行的解决方案,所以我只是擦除了我的硬盘驱动器并切换到 Ubuntu 16.04。它在 Mint 中不起作用但在 Ubuntu 中不起作用似乎仍然很奇怪,但这可能是由于我的一些疏忽。
          猜你喜欢
          • 2020-08-28
          • 2017-08-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-08-05
          • 2015-01-03
          • 2013-08-07
          相关资源
          最近更新 更多