I am trying to install sparkTable
in R 3.1.0 which depends on Rglpk
. I manually installed GPLK on the system and added the libs folder to LD_LIBRARY_PATH
before going into R for the install.packages("sparkTable")
procedure. I get this error during the installation process. Any ideas?
* installing *source* package ‘Rglpk’ ...
** package ‘Rglpk’ successfully unpacked and MD5 sums checked
** libs
/bin/sh: line 0: cd: GLPK: No such file or directory
make: *** [GLPK.ts] Error 1
ERROR: compilation failed for package ‘Rglpk’
* removing ‘/opt/R/R-3.1.0/lib64/R/library/Rglpk’
ERROR: dependency ‘Rglpk’ is not available for package ‘sparkTable’
* removing ‘/opt/R/R-3.1.0/lib64/R/library/sparkTable’
I landed on this page, because I could not update igraph
under Windows 10/11
, since igraph
also requires glpk
as per OP. Specifically:
igraph_glpk_support.h:36:10: fatal error: glpk.h: No such file or directory #include <glpk.h> ^~~~~~~~ compilation terminated. make: *** [C:/PROGRA~1/R/R-4.1.1/etc/x64/Makeconf:238: feedback_arc_set.o] Error 1 ERROR: compilation failed for package 'igraph'
- removing 'C:/Users/xxx/Documents/R/win-library/4.1/igraph'
- restoring previous 'C:/Users/xxx/Documents/R/win-library/4.1/igraph' Warning in install.packages : installation of package ‘igraph’ had non-zero exit status
I am under Windows 11
(but would be same for Windows 10
).
Simple resolution is suggested here:
Rtools Bash
(found in all apps
, Rtools 4.0
in the Windows
menu)pacman -S mingw-w64-x86_64-glpk
and confirm with yes
(y)pacman -S mingw-w64-x86_64-libxml2
and confirm with yes
(y)igraph
in Rstudio
now leads to a cleanDONE (igraph)
(there is no need to install anything, add any path, etc... just the above 4 steps)
sudo apt-get install libglpk-dev
did the trick for me.
I had this problem and took a good bit of digging in the package to understand what was happening. If Rgplk can't compile its test program when installing, it does something weird, including this bizarre cd to nowhere. Assuming glpk-devel is installed, the reason it can't compile the test program is that it can't find the gplk header as it is in a non-standard directory.
Just set the environment variable CPATH=/usr/include/glpk
and the test program will compile, allowing the package install to proceed normally.
I had this problem too. The following steps solved this issue for me. My current setup:
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-3.tar.gz
export LIBRARY_PATH=/home/<username>/GLPK/lib
R CMD INSTALL Rglpk_0.6-3.tar.gz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With