ubuntu - 在 Ubuntu 17.04 中安装 igraph 时出现问题

标签 ubuntu installation rstudio igraph

这个问题在这里已经有了答案:





Getting error "In function ‘igraph_write_graph_graphml’:" while installing igraph package in R

(3 个回答)


4年前关闭。




我是 igraph 的新手在 R 上仍然是绿色的('littler' 版本 0.3.2,带有 R v3.4.0)和 Rstudio (版本 1.0.153)。
我刚刚安装了RRstudio在 Ubuntu 17.04(64 位)上安装 igraph 时遇到问题。有人问过这个问题 elsewhere但没有解决,也没有公认的答案。

下面描述的安装错误似乎与我尝试安装软件包的库目录无关。我都试过了:
...通过修改文件/etc/R/Renviron .

RStudio 内部的结果在每种情况下都是:

> install.packages("igraph")
........
In file included from src/foreign-gml-parser.y:59:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined
 #  define strdup igraph_i_strdup

In file included from /usr/include/string.h:630:0,
                 from src/foreign-gml-parser.y:54:
/usr/include/x86_64-linux-gnu/bits/string2.h:337:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)

gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fdebug-prefix-map=/build/r-base-X2xP8j/r-base-3.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-X2xP8j/r-base-3.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function ‘igraph_write_graph_graphml’:
foreign-graphml.c:1408:46: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^~~~~~~~~~~~~~~~~~~~~
foreign-graphml.c:1412:59: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^~~~~~~~~~~~~~~~~~~~~
foreign-graphml.c:1414:38: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
make: *** [foreign-graphml.o] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/ckb/R/x86_64-pc-linux-gnu-library/3.4/igraph’
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpli2vyo/downloaded_packages’

如果有人可以帮助我解决问题,我将不胜感激。某个著名的搜索引擎并不是特别有用,可能是因为我不知道如何寻找答案。谢谢。

最佳答案

一种解决方法是为所有用户安装包,而不是只为 Rstudio session 中的一个用户安装包。我完全不清楚为什么我在尝试后者时会系统地出错。
Ubuntu中的cli是:

sudo su - -c "R -e \"install.packages('igraph', repos='http://cran.rstudio.com/')\""

关于ubuntu - 在 Ubuntu 17.04 中安装 igraph 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46332908/

相关文章:

html - 在 Ubuntu 14.04 上安装 Flash Player

基于 Swing 的项目的 Java 安装程序

shiny - 如何在 switch 语句中使用变量?

macos - 如何在Mac上管理不同版本的R?

java - Ubuntu 终端中的工作代码,在 Windows Eclipse 中不起作用

python - 在 Ubuntu 9.04 上构建 Numpy 1.6.1 时遇到问题——没有 __config__.py

android - Ubuntu 16.04 上的 aarch64-linux-android-gcc 错误 "poll.h"未找到

python - 如何在Python中安装包

python - 无法在 python 中导入 zmq(安装问题)

r - 无法退出 R session 或无法退出 RStudio