To begin, you'll need to install the Gurobi package in R. The R command for doing this is:
install.packages('<R-package-file>', repos=NULL)
The R package file can be found in the <installdir>/R directory of your Gurobi installation.
For a default Linux installation of Gurobi 12.0.0, the command would be:
install.packages('/opt/gurobi1200/linux64/R/gurobi_12.0-0_R_4.4.1.tar.gz', repos=NULL)
You will need to adjust the path to match your installation directory and version.
Ensure that both the R binary and the Gurobi package are compatible with the same instruction set. To use the Gurobi R package, you must use the 64-bit version of R.
If you are using R from RStudio Server and you get an error indicating that R is unable to load the Gurobi shared object, you may need to set the rsession-ld-library-path entry in the server config file. Please consult the RStudio documentation for more information.
Note: The macOS R packages for Gurobi version 12.0 and higher are incompatible with older macOS machines with x86_64 architecture. In this case, try the following:
Open a terminal on your macOS machine, navigate to a folder of your choosing (such as your home directory) and run the following commands:
wget https://packages.gurobi.com/12.0/gurobi12.0.0_R.tar.gz tar -xvzf gurobi12.0.0_R.tar.gz cd gurobiR make -f Makefile.mac
This will produce a file named gurobi_12.0-0.tgz that should be used in the install command within R:
install.packages('<path to gurobi_12.0-0.tgz>', repos=NULL)
Comments
0 comments
Article is closed for comments.