0

I am working with the 3.3.1 version of R studio and I am trying to download the package lpsolve but it is not working.

So far I have tried (many times)

When downloading in RStudio I kept getting an error saying

    Error: could not find function "lp"

When defining Lp as a function the long way from the link provided I got the error

   Error in .C("lpslink", direction = as.integer(direction), x.count 
    = as.integer(x.count),  : 
    "lpslink" not available for .C() for package "lpSolve"

Any help on figuring out how to either download lpsolve or fix the code for the lpsolve provided would be very greatly appreciated.

Thank you very much in advance for your time.

Edit: This was the exact output when I tried to download the package in RStudio

    Do you want to install from sources the package which needs 
    compilation?
    y/n: y
    installing the source package ‘lpSolve’

    trying URL 
   'https://cran.rstudio.com/src/contrib/lpSolve_5.6.15.tar.gz'
    Content type 'application/x-gzip' length 467646 bytes (456 KB)
    ==================================================
    downloaded 456 KB

    Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
    unknown timezone 'zone/tz/2020d.1.0/zoneinfo/America/New_York'
    * installing *source* package ‘lpSolve’ ...
    ** package ‘lpSolve’ successfully unpacked and MD5 sums checked
    ** libs
    xcrun: error: invalid active developer path 
    (/Library/Developer/CommandLineTools), missing xcrun at: 
    /Library/Developer/CommandLineTools/usr/bin/xcrun
    ERROR: compilation failed for package ‘lpSolve’
    * removing 


   ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/
   library/lpSolve’
   * restoring previous 
   ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/
  lpSolve’
  Warning in install.packages :
  installation of package ‘lpSolve’ had non-zero exit status

  The downloaded source packages are in
 
 ‘/private/var/folders/wx/rf42z3zx7d7ffk7zpcy49c6w0000gn/
 T/Rtmp5JGjqw/downloaded_packages’
  • When it asked you to install from source, you said "y" (yes). Do you really need to compile yourself? It doesn't sounds like you have xcode installed on your mac. You would need to install that if you want to compile the package yourself. It would be easier to choose "n" and just use the precompiled version. – MrFlick Nov 28 '20 at 00:16
  • I tried that too and unfortunately I still get the same error Error: could not find function "lp" when I try to use lp – mathemagician617 Nov 28 '20 at 00:29
  • Well what happened when you tried that exactly? At the very lease you should get different output. Are you loading the package after you install it with `library()`? – MrFlick Nov 28 '20 at 00:30
  • No I haven't tried that. So I should write library(lpSolve) and then follow it by the install? I will try that now. – mathemagician617 Nov 28 '20 at 00:32
  • @MrFlick you are my hero. Thank you !! It worked. – mathemagician617 Nov 28 '20 at 00:38

0 Answers0