google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11k stars 2.1k forks source link

OR-Tools not finding Gurobi #3154

Closed igheorghita closed 2 years ago

igheorghita commented 2 years ago

What version of OR-Tools and what language are you using? Version: ortools-9.2.9972 Language: Python

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi) Gurobi

What operating system (Linux, Windows, ...) and version? macOS Big Sur (version 11.6)

What did you do? Sorry if this isn't a bug, but I couldn't find a satisfactory answer anywhere. I installed ortools with pip and I downloaded Gurobi and I have a license. I can use Gurobi through gurobipy currently, but I'd like to create a solver using pywraplp.Solver.CreateSolver('GUROBI'). But when I make a solver this way, it returns None. Basically I'm experiencing the same issue as described here, but reinstalling doesn't work. I tried setting GUROBI_HOME to /Library/gurobi951/macos_universal2 but that didn't help. Should I set GUROBI_HOME to something else? I read this page and it seems to imply that there's nothing I need to do to get them to see each other?

Thank you in advance!

lperron commented 2 years ago

following the code, it will search for:
potential_paths.push_back( absl::StrCat(gurobi_home_from_env, "/lib/libgurobi", lib, ".dylib"));

where lib will be 95.

Is it the case?

igheorghita commented 2 years ago

Yes, actually, that file exists (/Library/gurobi951/macos_universal2/lib/libgurobi95.dylib). So maybe that's not the issue?

Thanks for the quick response by the way!

lperron commented 2 years ago

Are you ou on Mac M1?

Le jeu. 3 mars 2022, 19:04, Iulia Gheorghita @.***> a écrit :

Yes, actually, that file exists ( /Library/gurobi951/macos_universal2/lib/libgurobi95.dylib). So maybe that's not the issue?

Thanks for the quick response by the way!

— Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/3154#issuecomment-1058684014, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3K5SFAXAM4VSX4OWZ3U6FHQ5ANCNFSM5P3X3OQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

igheorghita commented 2 years ago

No, Intel

igheorghita commented 2 years ago

Previously I was using a jupyter notebook and not getting any error (just None for the solver), but when I tried just creating the solver from the command line I got:

>>> from ortools.linear_solver import pywraplp
>>> solver = pywraplp.Solver.CreateSolver('GUROBI')
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0303 19:07:31.808168     1 environment.cc:738] Found the Gurobi library in '/Library/gurobi951/macos_universal2/lib/libgurobi95.dylib.
F0303 19:07:31.808506     1 dynamic_library.h:68] Check failed: function_address != nullptr Error: could not find function GRBsetlogfile in /Library/gurobi951/macos_universal2/lib/libgurobi95.dylib
*** Check failure stack trace: ***
zsh: abort      python

Any strangely, when I write those two lines:

from ortools.linear_solver import pywraplp

solver = pywraplp.Solver.CreateSolver('GUROBI')

in a file in PyCharm and run it I get:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0303 19:14:51.082323     1 linear_solver.cc:616] Support for GUROBI not linked in, or the license was not found.

So I'm a bit confused...

lperron commented 2 years ago

Sorry, I forgot. known bug. It is fixed in 9.3 released tomorrow or early next week.

Le jeu. 3 mars 2022, 19:18, Iulia Gheorghita @.***> a écrit :

Previously I was using a jupyter notebook and not getting any error (just None for the solver), but when I tried just creating the solver from the command line I got:

from ortools.linear_solver import pywraplp solver = pywraplp.Solver.CreateSolver('GUROBI') WARNING: Logging before InitGoogleLogging() is written to STDERR I0303 19:07:31.808168 1 environment.cc:738] Found the Gurobi library in '/Library/gurobi951/macos_universal2/lib/libgurobi95.dylib. F0303 19:07:31.808506 1 dynamic_library.h:68] Check failed: function_address != nullptr Error: could not find function GRBsetlogfile in /Library/gurobi951/macos_universal2/lib/libgurobi95.dylib Check failure stack trace: zsh: abort python

Any strangely, when I write those two lines:

from ortools.linear_solver import pywraplp solver = pywraplp.Solver.CreateSolver('GUROBI')

in a file in PyCharm and run it I get:

WARNING: Logging before InitGoogleLogging() is written to STDERR W0303 19:14:51.082323 1 linear_solver.cc:616] Support for GUROBI not linked in, or the license was not found.

So I'm a bit confused...

— Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/3154#issuecomment-1058692014, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3PWXVYLZVRKL3XECBDU6FJFHANCNFSM5P3X3OQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

lperron commented 2 years ago

The import should already be fixed. I have added the new path to the master branch.

igheorghita commented 2 years ago

~Great, thanks! I'm curious - which commit fixed it?~

Nevermind! I see your commit

lperron commented 2 years ago

https://github.com/google/or-tools/commit/6f05109075aac7cf7b1868fdbb997deaf65b8cfc Laurent Perron | Operations Research | @.*** | (33) 1 42 68 53 00

Le ven. 4 mars 2022 à 02:27, Iulia Gheorghita @.***> a écrit :

Great, thanks! I'm curious - which commit fixed it?

— Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/3154#issuecomment-1058734586, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3LGJTSCKGJV6LTI5GTU6FRJ7ANCNFSM5P3X3OQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>