R 3.6.1 + Gurobi 9.0.1
AnsweredHi all,
I followed the "Gurobi Optimizer Quick Start Guide" to install Gurobi 9.0.1 under (64 bit) Pop OS 19.10 (~Ubuntu). I also installed the "gurobi" R-package in R 3.6.1. The installation was successful. But I can't load the package (library(gurobi)).
I get the following error message:
```
Error: package or namespace load failed for ‘gurobi’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/home/dirk/R/x86_64-pc-linux-gnu-library/3.6/gurobi/libs/gurobi.so': libgurobi90.so: cannot open shared object file: No such file or directory
```
The directory "/home/dirk/R/x86_64-pc-linux-gnu-library/3.6/gurobi/libs/gurobi.so" exists but I can't "open" "gurobi.so" to figure out if "libgurobi90.so" exists.
Has someone an idea how to solve this issue or what actually is the problem?
Thanks a lot in advance,
Dirk
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Dirk,
Did you follow the guide about installing Gurobi (without R)? Especially the part about setting the "LD_LIBRARY_PATH" environment variable seems to be incorrect on your system. You need to tell the Linux system where to find the runtime libraries of Gurobi. To test your installation, you can also try running "gurobi_cl" in the terminal.
Cheers,
Matthias0 -
Hi Matthias,
Thanks a lot for your quick reply. Yes, I followed the instructions given in the "software installation guide". I'm using the bash shell and was running the 3 commands, especially "export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib". The gurobi command line tool (gurobi_cl) and the interactive shell (gurobi.sh) are both working. I can also invoke gurobi from Julia/JuMP.
Also the installation of the R package itself was successful (did not exit with an error message). It seems that the R package itself is somehow broken. In the directory
".../R/x86_64-pc-linux-gnu-library/3.6/gurobi/libs/"
only "gurobi.so" exists but not "libgurobi90.so".
Maybe R is not supported in gurobi 9?
Cheers,
Dirk
0 -
Hi Dirk,
I just set up a new fresh Rstudio installation using R 3.6.3 and Gurobi 9.0.1 on Windows. Everything works fine after installing Rtools and slam.
I will repeat this process on Ubuntu to check whether there are any issues.
Cheers,
Matthias0 -
Hi Dirk,
To make Gurobi 9.0.1 work in Rstudio you need to define the LD_LIBRARY_PATH to point to the lib directory in your Gurobi installation. To check whether your system can find the Gurobi library, you can run this:
ldd ~/R/x86_64-pc-linux-gnu-library/3.6/gurobi/libs/gurobi.so
There should be no undefined references in the output. This is how it looks on my system:
linux-vdso.so.1 (0x00007ffd9b990000)
libgurobi90.so => /home/miltenberger/gurobi901/linux64/lib/libgurobi90.so (0x00007f8c9dcd1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8c9dc9c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8c9daab000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8c9daa0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8c9da9a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8c9d949000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8ca079b000)Cheers,
Matthias0 -
Hi Matthias,
Thanks a lot again for your help!
On my system it looks like this:
linux-vdso.so.1 (0x00007ffeb9126000)
libgurobi90.so => /opt/gurobi901/linux64/lib/libgurobi90.so (0x00007f068eb89000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f068eb4f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f068e95e000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f068e953000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f068e94d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f068e7fe000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0691653000)If I understand it correctly it looks fine. The only difference I can see is that gurobi is installed into "opt" instead of "home". But I think that's ok (That is the default in the installation guide)?
Cheers Dirk
0 -
Hi Dirk,
Yes, this looks good. Can you confirm that the LD_LIBRARY_PATH also works in any fresh terminal?
Thanks,
Matthias0 -
Hi Matthias,
Yes, if I reboot the machine and run again the command:
ldd ~/R/x86_64-pc-linux-gnu-library/3.6/gurobi/libs/gurobi.so
I get again the same output as above. What confuses me is that the path stated in this output is:
libgurobi90.so => /opt/gurobi901/linux64/lib/libgurobi90.so (0x00007f932a80c000)
But the "R" error message says that the file or directory "libgurobi90.so" can't be found in:
/home/dirk/R/x86_64-pc-linux-gnu-library/3.6/gurobi/libs/gurobi.so
Is the problem maybe related to this?
Thanks a lot for your help.
Cheers Dirk
0 -
The problem for me was I had to include the environmental variable changes in both ~/.bashrc and ~/.profile.
You might notice that you'll get this error starting r-studio from double clicking an rfile but not when starting r-studio from the terminal. This is because bash reads from .bashrc but many gui programs only read from .profile.
2 -
I have exactly the same problem.
I added the variables also in .profile, but it didn't work when I double click my RStudio. It works when I run Rstudio by terminal anyway.1
Post is closed for comments.
Comments
10 comments