R Cairo 安装没有 apt-get,sudo

标签 r installation cairo

我正在开发一台预装了大部分开罗要求的 headless ubuntu 机器,但我在让 R 使用开罗时遇到了困难。有谁知道我需要设置/安装哪些标志或附加包才能让 install.packages 使用其依赖项的现有安装正确构建 Cairo?窍门:我无法使用 sudo 命令或 apt-get , 并且附加软件必须涉及 <50Mb 的内存。这可能吗?如果我可以将其连接到 R 中,那么看起来我需要的几乎所有东西都已存在。

> library('Cairo')
Error in library("Cairo") : there is no package called ‘Cairo’
> install.packages('Cairo')
...
* installing *source* package ‘Cairo’ ...
...
checking for pkg-config... /usr/bin/pkg-config
configure: CAIRO_CFLAGS=/usr/lib:/usr/bin:/usr/include
checking if R was compiled with the RConn patch... no
checking cairo.h usability... no
checking cairo.h presence... no
checking for cairo.h... no
configure: error: Cannot find cairo.h! Please install cairo (http://www.cairographics.org/) and/or set CAIRO_CFLAGS/LIBS correspondingly.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/app/vendor/R/lib64/R/library/Cairo’

这意味着我需要安装 libcairo2-dev 包,但通过 configure/make 安装会遇到 pixman 错误,尽管我的系统上存在 pixman:
package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
No package 'pixman-1' found
checking whether cairo's image surface backend feature could be enabled
no (requires pixman-1 >= 0.22.0 http://cairographics.org/releases/)error: mandatory image surface backend feature could not be enabled

安装了什么:
$ dpkg -l | grep 'cairo\|png\|fontc\|pix'
ii  fontconfig     2.8.0-2ubuntu1 generic font configuration library - support
ii  fontconfig-con 2.8.0-2ubuntu1 generic font configuration library - configu
ii  libcairo2      1.8.10-2ubuntu The Cairo 2D vector graphics library
ii  libfontconfig1 2.8.0-2ubuntu1 generic font configuration library - runtime
ii  libpixman-1-0  0.16.4-1ubuntu pixel-manipulation library for X and cairo
ii  libpng12-0     1.2.42-1ubuntu PNG library - runtime
ii  libpng12-dev   1.2.42-1ubuntu PNG library - development

我的 session 信息:
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base   

R 看不到 cairo:
> capabilities()
    jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets 
   FALSE    FALSE    FALSE    FALSE    FALSE    FALSE     TRUE     TRUE 
  libxml     fifo   cledit    iconv      NLS  profmem    cairo 
    TRUE     TRUE     TRUE     TRUE     TRUE    FALSE    FALSE 

最佳答案

你需要 cario dev 文件

apt-get install libcairo2-dev

我还需要安装以下
apt-get install libxt-dev

关于R Cairo 安装没有 apt-get,sudo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16678934/

相关文章:

Ubuntu 14.04 尝试 "sudo add-apt-repository ppa:tualatrix/ppa"失败

python - 如何在 matplotlib/Python 中更改后端

c - GTK3+ - 如何根据鼠标点击更新图形?

r - 同时将函数传递给多个数据帧

r - 如何格式化ggplot2图例的数值?

r - 如何在另一个包中使用 R 包中的 'unexported' 数据集

开罗分割图像

r - ggplot2:在绘图少于视口(viewport)的网格上绘图

c# - 简单更新工具

ruby-on-rails - rails : Bundle Install fails to install necessary gem after downloading from github