解決:在ubuntu下安裝R語言ks包時的error:configuration failed for package ‘rgl’

在做Multivariate kernel density estimation


用到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

發佈了38 篇原創文章 · 獲贊 14 · 訪問量 18萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章