AWS支持的R Studio安装Rattle库时出现RGtk2配置失败错误
Hey there, let's tackle that RGtk2 installation error you're facing when trying to set up the rattle package in your AWS RStudio environment. The root issue here is that your system is missing the required GTK 2.8.0+ libraries—let's walk through how to fix this step by step.
Step 1: Install System-Level GTK Dependencies
First, you need to install the GTK 2 development libraries directly on your AWS instance. The command depends on which Linux distribution your RStudio environment is running:
For Amazon Linux 2 / CentOS / RHEL
Run these commands in your instance's terminal (you can open a terminal tab in RStudio):
sudo yum groupinstall "Development Tools" sudo yum install gtk2-devel gtk2 gtk2-devel.x86_64
For Ubuntu / Debian
If your environment uses Debian/Ubuntu, use these commands instead:
sudo apt-get update sudo apt-get install libgtk2.0-dev libgtk2.0-0
Step 2: Reinstall RGtk2 and Rattle in RStudio
Once the system libraries are installed, go back to your RStudio console and run these commands to install the packages:
install.packages("RGtk2", dependencies = TRUE) install.packages("rattle", dependencies = TRUE)
Troubleshooting Tip (If Issues Persist)
If you still run into configuration errors, try setting the PKG_CONFIG_PATH environment variable temporarily before installing RGtk2, to ensure R can find the GTK libraries:
Sys.setenv(PKG_CONFIG_PATH = "/usr/lib64/pkgconfig:/usr/share/pkgconfig") install.packages("RGtk2", dependencies = TRUE)
That should resolve the "GTK version 2.8.0 required" error and let you use rattle without problems.
内容的提问来源于stack exchange,提问作者Rohi

