Error installing R package for Linux

自古美人都是妖i 提交于 2019-12-08 14:30:12

问题


Im trying to install a package named "rgeos" on R 3.3, but when I type

install.packages("rgeos")

But it returns me the following error (same happens with other packages, but not all the packages):

> * installing *source* package ‘rgeos’ ...
** package ‘rgeos’ successfully unpacked and MD5 sums checked
configure: CC: gcc
configure: CXX: g++
configure: rgeos: 0.3-19
checking for /usr/bin/svnversion... no
configure: svn revision: 524
checking for geos-config... no
no
configure: error: geos-config not found or not executable.
ERROR: configuration failed for package ‘rgeos’
* removing ‘/home/kdg/R/x86_64-pc-linux-gnu-library/3.3/rgeos’
> 
> The downloaded source packages are in
>   ‘/tmp/Rtmpsa5pDo/downloaded_packages’ Warning message: In
> install.packages("rgeos") :   installation of package ‘rgeos’ had
> non-zero exit status

Any clues how con install this package?


回答1:


It seems that when running R in Linux is necessary to install some build tools. As in this case, in the terminal:

sudo apt-get install libgeos-dev

Then try package install again.

hints from here




回答2:


I solved it with the following:

cd /opt
git clone https://github.com/libgeos/geos
cd geos
export CC='clang' && export CXX='clang++' && export OBJC='clang'
./autogen.sh
./configure
make
sudo -EH make install
R
install.packages('rgeos')

NB: export clang is particular to me; I am just pasting my exact solution.



来源:https://stackoverflow.com/questions/38924767/error-installing-r-package-for-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!