"GLPK: No such file or directory" error when installing Rglpk on MacOS when gplk already installed via Homebrew

I am troubleshooting the installation of the Rglpk package on MacOS 12.6.5 (Monterrey).

The error message when trying to install Rglpk version 0.6-4 (from source) is:

'/bin/sh: line 0: cd: GLPK: No such file or directory'
make: *** [GLPK.ts] Error 1
ERROR: compilation file for package 'Rglpk'

Here is what I have verified so far:

  • Per CRAN, Rglpk requires (as a system dependency) installation of glpk (GLPK - GNU Project - Free Software Foundation (FSF)).
  • Using Homebrew, I can see both glpk and its dependency gmp are installed. They are installed under /usr/local/Cellar/, with symlinks created under /usr/local/opt/ and /usr/local/bin/.
  • Other Mac users have been able to install glpk and then install Rglpk without issue
  • Running 'brew link' did not solve the issue
  • I verified that a version of gcc is installed (gcc6), other packages are working to compile from source (using gcc), and and that flags are set in the Makevars file referencing the correct version of gcc

$PATH /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin

sessionInfo:
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X Snow Leopard 12.6.5

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1]
compiler_3.6.1 tools_3.6.1

Update:

-We ultimately resolved this by installing Rglpk version 0.6-3 from MRAN, which happened to have a Mac binary available for version 0.6-3 (but not 0.6-4), but given MRAN is being shut down on July 1, 2023, this won't be an option farther in the future

install.packages("Rglpk" ,repos ="https://cran.microsoft.com/snapshot/2019-02-08/")

This S/O post suggestion at the bottom to set CPATH may help.

Your sessionInfo shows Snow Leopard rather than Monterrey and R3.6.1. This poses the possibility of mounting deferred maintenance debt.

While RStudio officially supports macOS current releases and the two most recent before, whether it runs on older versions is potentially dicey. At least, it’s worth running to ground why Snow Leopard, rather than Monterrey, is showing.

As far as R, I like to keep close to the current release. I’m not in a hurry to go from 4.2 to 4.3, but if I slipped behind while it went to 4.5 I’d make the time to do make it happen. When things break it can take a long time to realize that R versioning is the cause.

I would try to use the glpk build that CRAN uses. You can download it from here: Index of /bin/darwin17/x86_64/

curl -LO https://mac.r-project.org/bin/darwin17/x86_64/glpk-5.0-darwin.17-x86_64.tar.xz
sudo tar xzf glpk-5.0-darwin.17-x86_64.tar.xz -C /

After this I can install Rglpk without issues:

install.packages("Rglpk", type = "source")

Alternatively, you can install the CRAN binary package from the CRAN archive repository. This is a slightly older version, but it does not need any external libraries:

install.packages(
  "Rglpk", 
  repos = "https://cran-archive.r-project.org", 
  type = "binary"
)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.