Warning in install.packages : package ‘RGtk2’ is not available for this version of R

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Warning in install.packages : package ‘RGtk2’ is not available for this version of R相关的知识,希望对你有一定的参考价值。

Warning in install.packages : package ‘RGtk2’ is not available for this version of R、install.packages("RGtk2")

目录

Warning in install.packages : package ‘RGtk2’ is not available for this version of R、install.packages("RGtk2")

问题:

解决:

完整错误:


问题:

启动rattle进行数据挖掘报错:

> library(rattle)
> rattle()
Error in rattle() : 
The RGtk2 package is not available but is required. 
Please install the package using, for example: 

install.packages("RGtk2")

然后,按照提示install.packages("RGtk2")

说CRAN已经没有这个包了,,,

解决:

搜索,要会利用搜索引擎啊

#找到历史版本在哪里。

#有很多个版本自己选咯,然后下载

 使用Rstudio中的tools中的install pcakage手动安装本地包

#接着发生如下错误;

#可能原因是Rtools的问题,

确实没有找到make所以没法安装。

 > Sys.which("make")
make 
  "" 

> pkgbuild::find_rtools(debug = TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

> install.packages("D:/Downloads/RGtk2_2.20.36.3.tar.gz", repos = NULL, type = "source")
* installing *source* package 'RGtk2' ...
** 成功将'RGtk2'程序包解包并MD5和检查
** using staged installation
** libs

*** arch - i386
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'RGtk2'
* removing 'D:/R/R-4.0.5/library/RGtk2'
Warning in install.packages :
  installation of package ‘D:/Downloads/RGtk2_2.20.36.3.tar.gz’ had non-zero exit status

 #R版本和Rtools需要匹配哦

 安装Rtools

#如下操作(记得如果操作之后没有反应,需要重启Rstudio)

writeLines('PATH="$RTOOLS40_HOME\\\\usr\\\\bin;$PATH"', con = "~/.Renviron")

> Sys.which("make")
                                      make 
"D:\\\\Rtools\\\\rtools40\\\\usr\\\\bin\\\\make.exe" 

> pkgbuild::find_rtools(debug = TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

#接着出现如下问题:

> install.packages("D:/Downloads/RGtk2_2.20.36.3.tar.gz", repos = NULL, type = "source")
* installing *source* package 'RGtk2' ...
** 成功将'RGtk2'程序包解包并MD5和检查
** using staged installation
** libs

*** arch - i386
"D:/Rtools/rtools40/mingw32/bin/"gcc  -I"D:/R/R-40~1.5/include" -DNDEBUG -D_R_=1 -DUSE_R=1 -mms-bitfields -I/include/gtk-2.0 -I/lib/gtk-2.0/include -I/include/atk-1.0 -I/include/cairo -I/include/pango-1.0 -I/include/glib-2.0 -I/lib/glib-2.0/include -I/include/libxml2  -I/include/gdk-pixbuf-2.0 -I/include -I. -DR_LEGACY_S_DEFS=1         -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c RGtkDataFrame.c -o RGtkDataFrame.o
In file included from ./RGtk2/atk.h:4,
                 from RGtk2/gtk.h:4,
                 from RGtkDataFrame.h:1,
                 from RGtkDataFrame.c:1:
./RGtk2/gobject.h:7:10: fatal error: glib.h: No such file or directory
 #include <glib.h>
          ^~~~~~~~
compilation terminated.
make: *** [D:/R/R-40~1.5/etc/i386/Makeconf:222: RGtkDataFrame.o] Error 1
ERROR: compilation failed for package 'RGtk2'
* removing 'D:/R/R-4.0.5/library/RGtk2'
Warning in install.packages :
  installation of package ‘D:/Downloads/RGtk2_2.20.36.3.tar.gz’ had non-zero exit status

此处glib.h依赖是需要windows系统提供的基础文件。参考如下链接进行处理。

./RGtk2/gobject.h:7:10: fatal error: glib.h: No such file or directory

参考:RGtk2 installation fails on Windows 11 - General - RStudio Community

参考:The GTK Project - A free and open-source cross-platform widget toolkit

完整错误:

> library(rattle)
> rattle()
Error in rattle() : 
The RGtk2 package is not available but is required. 
Please install the package using, for example: 

install.packages("RGtk2")

> install.packages("RGtk2")
Warning in install.packages :
  package ‘RGtk2’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

参考:R

参考:Index of /src/contrib/Archive/RGtk2

以上是关于Warning in install.packages : package ‘RGtk2’ is not available for this version of R的主要内容,如果未能解决你的问题,请参考以下文章

warning: LF will be replaced by CRLF in xxxxxx

warning: LF will be replaced by CRLF in xxxxxx

关于Moment.js warning:Deprecation warning: value provided is not in a recognized RFC2822 or ISO format

Warning: Attempt to present on whose view is not in the window hierarchy!

[WARNING] [INS-13014] Target environment do not meet some optional requirements.

Error in file(file, “rt“) : cannot open the connection In addition: Warning message:In file(file, “