Installing Rglpk on CentOS 7

Rglpk is an R library that links the GLPK package with R interface. This package is required by the igraph package to perform cluster optimization tasks. Due to some CRAN policy update, the embedded GLPK in igraph (and Rglpk) is removed, and users can not longer get GLPK installed with a simple R installation command.

So here is the solution from stackoverflow:

https://stackoverflow.com/questions/25114771/glpk-no-such-file-or-directory-error-when-trying-to-install-r-package

Install GLPK in a local directory:

wget http://ftp.gnu.org/gnu/glpk/glpk-4.54.tar.gz
tar xfzv glpk-4.54.tar.gz
mkdir GLPK
cd glpk-4.54
./configure --prefix=/home/<username>/GLPK
make
make install

Install Rglpk (0.6-3):

cd ~
wget http://cran.r-project.org/src/contrib/Rglpk_0.6-4.tar.gz
export LIBRARY_PATH=/home/<username>/GLPK/lib
export LD_LIBRARY_PATH=/home/<username>/GLPK/lib
export CPATH=/home/<username>/GLPK/include
R CMD INSTALL Rglpk_0.6-4.tar.gz

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注