Gurobi 7.0.2 library fails to load in R on Linux Mint

241 views
Skip to first unread message

jfl...@ucsb.edu

unread,
Jul 13, 2017, 6:54:19 PM7/13/17
to Gurobi Optimization
Hi,

I am running Gurobi 7.0.2 on Linux Mint 18.2 Sonya and am trying to load the Gurobi library in R 3.4.1, but get the following error:

Error: package or namespace load failed for ‘gurobi’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/jason/R/x86_64-pc-linux-gnu-library/3.4/gurobi/libs/gurobi.so':
  libgurobi70.so: cannot open shared object file: No such file or directory

Gurobi seems to be installed properly as running 'gurobi_cl ${GUROBI_HOME}/examples/data/afiro' from the command line returns the following:

Gurobi Optimizer version 7.0.2 build v7.0.2rc1 (linux64)
Copyright (c) 2017, Gurobi Optimization, Inc.

Read MPS format model from file /opt/gurobi702/linux64/examples/data/afiro.mps
Reading time = 0.07 seconds
AFIRO: 27 rows, 32 columns, 83 nonzeros
Optimize a model with 27 rows, 32 columns and 83 nonzeros
Coefficient statistics:
  Matrix range     [1e-01, 2e+00]
  Objective range  [3e-01, 1e+01]
  Bounds range     [0e+00, 0e+00]
  RHS range        [4e+01, 5e+02]
Presolve removed 18 rows and 20 columns
Presolve time: 0.07s
Presolved: 9 rows, 12 columns, 32 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0   -4.8565680e+02   1.363638e+02   0.000000e+00      0s
       3   -4.6475314e+02   0.000000e+00   0.000000e+00      0s

Solved in 3 iterations and 0.10 seconds
Optimal objective -4.647531429e+02

Any help much appreciated,

Jason

des...@gurobi.com

unread,
Jul 13, 2017, 7:03:42 PM7/13/17
to Gurobi Optimization

jfl...@ucsb.edu

unread,
Jul 14, 2017, 5:08:49 PM7/14/17
to Gurobi Optimization
Hi Amal,

Thanks for the reply. Yes, I have installed the Gurobi R package and I can see it in my list of installed packages in R. The error occurs when I attempt to load the package using 'library(gurobi)'

Jason

jfl...@ucsb.edu

unread,
Jul 20, 2017, 9:45:13 AM7/20/17
to Gurobi Optimization
Posting a solution I managed to work out to my own problem just in case anyone finds this helpful:

Two things is did:
1. Installed the latest version of Gurobi (7.5.1)

2. Added the following at the end of the .bashrc script:

export GUROBI_HOME="/opt/gurobi751/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${GUROBI_HOME}/lib"

I had tried setting these paths in other places (profile.d), but the library path was not being read, hence R could not find the libraries.

Seems to have fixed my problems and Gurobi is now running in R.

Michael Winkler

unread,
Jul 20, 2017, 10:11:10 AM7/20/17
to Gurobi Optimization
This is also stated in the quickstart guide for Linux. See http://www.gurobi.com/documentation/7.5/quickstart_linux.pdf page 7.

Best,
Michael

Reply all
Reply to author
Forward
0 new messages