解决:在ubuntu下安装R语言ks包时的error:configuration failed for package ‘rgl’

在做Multivariate kernel density estimation

解决:在ubuntu下安装R语言ks包时的error:configuration failed for package ‘rgl’_第1张图片

用到R语言的ks包,在ubuntu下(R studio)安装遇到了问题:

> install.packages("ks")
Installing package into ‘/home/coolwaterld/R/i686-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
also installing the dependency ‘rgl’

trying URL 'http://cran.rstudio.com/src/contrib/rgl_0.95.1158.tar.gz'
Content type 'application/x-gzip' length 1783656 bytes (1.7 Mb)
opened URL
==================================================
downloaded 1.7 Mb

trying URL 'http://cran.rstudio.com/src/contrib/ks_1.9.3.tar.gz'
Content type 'application/x-gzip' length 308363 bytes (301 Kb)
opened URL
==================================================
downloaded 301 Kb

* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for gcc... (cached) gcc -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -std=gnu99 accepts -g... (cached) yes
checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed
checking whether __attribute__((visibility())) is supported... yes
checking whether gcc -std=gnu99 accepts -fvisibility... yes
checking whether  accepts -fvisibility... no
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/coolwaterld/R/i686-pc-linux-gnu-library/3.0/rgl’
Warning in install.packages :
  installation of package ‘rgl’ had non-zero exit status
ERROR: dependency ‘rgl’ is not available for package ‘ks’
* removing ‘/home/coolwaterld/R/i686-pc-linux-gnu-library/3.0/ks’
Warning in install.packages :
  installation of package ‘ks’ had non-zero exit status

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

发现为rgl包的问题,可以在终端中安装rgl

sudo apt-get install r-cran-rgl
再次安装ks包

> install.packages("ks")
Installing package into ‘/home/coolwaterld/R/i686-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/ks_1.9.3.tar.gz'
Content type 'application/x-gzip' length 308363 bytes (301 Kb)
opened URL
==================================================
downloaded 301 Kb

* installing *source* package ‘ks’ ...
** package ‘ks’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c ks.c -o ks.o
gcc -std=gnu99 -shared -o ks.so ks.o -L/usr/lib/R/lib -lR
installing to /home/coolwaterld/R/i686-pc-linux-gnu-library/3.0/ks/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ks)

The downloaded source packages are in
	‘/tmp/Rtmp2FbviI/downloaded_packages’
成功

参考:http://ubuntuforums.org/showthread.php?t=787464

你可能感兴趣的:(R,语言)