0

I have the below problem with installing an R Package.

Context: I am working on a optimization problem and i have to use RGLPK package for the required functionalities of linear programming.

This is what I tried:

  1. Installing package using install.package (error was on GLPK Dependencies)

  2. Tried loading RGLPK File manually into library and installing, got error.

  3. followed step in this link- "GLPK: No such file or directory error when trying to install R package"

it throws an error saying "Rglpk.h:1:18: fatal error: glpk.h: No such file or directory"

Tried lot of other google/stack overflow methods and was not successful.

seeking help from this community and any advise would be greatly appreciated.

4
  • You have to install the GLPK library (not the R package, but the system library).
    – nicola
    Mar 1, 2019 at 16:15
  • It'll probably be helpful here if you provide sessionInfo() in your question.
    – jay.sf
    Mar 1, 2019 at 16:42
  • yes i did install GLPK. and moved that GLPK inside RGLPK src folder as mentioned in the above link and got that glpk.h missing error. Mar 1, 2019 at 16:46
  • @shreenidhiks I was definitely not mocking you. I'm sorry if you took it that way. I do not yet have permission to edit other peoples questions. Leaving a comment was the only mechanism I had to suggest removing what looked like your phone number.
    – Dan
    Mar 4, 2019 at 2:50

1 Answer 1

1

I have finally found the answer through some R&D. Posting here hoping it may help someone in future.

Operating system of Databricks ​is Ubuntu and it requires few dependencies like GLPK,Slam etc.

Slam could be installed easily but GLPK dependency was the main challenge. I did checke in various forums on installing GLPK in ubuntu and majorly all were suggesting installing using sudo command like below:

sudo apt-get install glpk-utils libglpk-dev But it was not installing and stuck in one place for more then 3 hours. Then i installed in my local ubuntu to understand the flow and noticed that since sudo apt install command was meant for interactive installation, it requires user to enter Yes couple of time. But Databricks shell terminal is not a interactive window and hence it required a command to force Yes all the time and below is the working command for that:

%sh

sudo apt-get install -y glpk-utils libglpk-dev

Post this you can use install.packages("Rglpk") and it will work like a charm :) above process can be followed for all non cran packages in Databricks.

1
  • sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper ; sudo: a password is required
    – PM0087
    Apr 6 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.