1
$\begingroup$

I have been using Pyomo with a free Academic license for Gurobi and so far it worked quite well. Now my license expired and I received a new license that is stored in the folder

"C:/Gurobi/gurobi.lic"

However, when I now run Pyomo I get the error message:

"ApplicationError: Solver (gurobi) did not exit normally"

and the error is thrown by the last of the following lines:

solver = pyo.SolverFactory('gurobi')
solver.options['MIPGap'] = 0.1
solver.options['TimeLimit'] = 100
solution = solver.solve(model, tee=True)

Do you have any idea why I now get this error? The license itself should be okay according to the Gurobi website (it expires in 2022). I just downloaded it to the before mentioned folder as recommended by Gurobi. Do I have to do anything else?

I'd appreciate every comment.

Update: Here is the full error message:

runfile('C:/Users/wi9632/bwSyncShare3/Eigene Arbeit/Code/Python/Demand_Side_Management/Building_1_mHP_EV.py', wdir='C:/Users/wi9632/bwSyncShare3/Eigene Arbeit/Code/Python/Demand_Side_Management')
Traceback (most recent call last):

  File "C:\Users\wi9632\bwSyncShare3\Eigene Arbeit\Code\Python\Demand_Side_Management\Building_1_mHP_EV.py", line 589, in <module>
    solution = solver.solve(model, tee=True)

  File "C:\Users\wi9632\Anaconda3\envs\tf\lib\site-packages\pyomo\opt\base\solvers.py", line 602, in solve
    "Solver (%s) did not exit normally" % self.name)

ApplicationError: Solver (gurobi) did not exit normally
$\endgroup$
1
  • 2
    $\begingroup$ Peter - Can you please open a support request with Gurobi? It looks like there is an issue with your license. Thanks. $\endgroup$
    – Gwyneth
    Jul 2 at 14:30
3
$\begingroup$

This does not look like a license issue. This is a Pyomo error code. You should share some more info about the error message and other output before. If your new license is stored in C:\gurobi\gurobi.lic, Gurobi will find the license automatically and there is usually nothing else required to make it work.

Update: To test the license, it is better to either run gurobi_cl from the full Gurobi installation or running this little Python code if only gurobipy is installed:

import gurobipy as gp
m = gp.Model()
m.optimize()
$\endgroup$
14
  • $\begingroup$ Thanks mattmitlen for your comment. I added the full error message in the question. Basically last weak everything worked fine but then I had to renew my license. I just did what is told at the Gurobi website (download the license into the folder C:\gurobi\gurobi.lic) via the Windows command prompt. There it was said that there is alreay a license at that path and I decided to overwrite it. Since then, I get this error message on every Pyomo model that I have. $\endgroup$
    – PeterBe
    Jun 29 at 12:46
  • $\begingroup$ Any comments to my last comment? I'd highly appreciate every further comment from you. $\endgroup$
    – PeterBe
    Jun 30 at 14:03
  • $\begingroup$ I just updated my answer. Hope that helps. $\endgroup$
    – mattmilten
    Jun 30 at 20:27
  • $\begingroup$ Thanks for your answer mattmilten. When using your suggested code I get the error message "ModuleNotFoundError: No module named 'gurobipy'" $\endgroup$
    – PeterBe
    Jul 1 at 8:10
  • $\begingroup$ Basically I do not understand why Gurobi does not work anymore in my installation. As said before, one week ago everything was perfect but the license expired. After that I renewed it and did exactly what is told at the Gurobi website (run a command on windows prompt). The strange thing is that I get a message in the windows command prompt that everything was successfull and the new license is stored at a certain location. However, when running a Pyomo model I get the error message ApplicationError: Solver (gurobi) did not exit normally $\endgroup$
    – PeterBe
    Jul 1 at 8:13
1
$\begingroup$

You need to put the new licence in your terminal and run it

Installation To install this license on a computer where Gurobi Optimizer is installed, copy and paste the following command to the Start/Run menu (Windows only) or a command/terminal prompt (any system like mac):

Let's assume your licence is as follows

grbgetkey 58eab684-cd60-12eb-b669-0242ac120002

The grbgetkey command requires an active internet connection.

$\endgroup$
6
  • $\begingroup$ Thanks Optimization team for your answer. What do you mean by terminal and how can I put the licence file there and run it? $\endgroup$
    – PeterBe
    Jun 29 at 9:37
  • $\begingroup$ I guess PeterBe is using Windows instead of Linux because he mentioned C:/Gurobi/gurobi.lic. Erh. Linux is usually better than windows in terms of performance. $\endgroup$ Jun 29 at 15:45
  • $\begingroup$ Thanks Optimization team for your answer. Basically I had already done what you suggested before posting my question. I just did it again. The problem still exists. Basically last weak everything worked fine but then I had to renew my license. I just did what is told at the Gurobi website but now I get this error message. $\endgroup$
    – PeterBe
    Jun 30 at 7:43
  • $\begingroup$ C:\WINDOWS\System32>grbgetkey 61e390b2-d587-11eb-8dc0-0242ac130004 info : grbgetkey version , build v9.1.1rc0 info : Contacting Gurobi license server... info : License file for license ID 656694 was successfully retrieved info : License expires at the end of the day on 2022-06-20 info : Saving license file... In which directory would you like to store the Gurobi license file? [hit Enter to store it in C:\Users\wi9632]: A license file already exists in 'C:\Users\wi9632\gurobi.lic' Continue? [Y/n] info : License 656694 written to file C:\Users\wi9632\gurobi.lic $\endgroup$
    – PeterBe
    Jun 30 at 7:44
  • $\begingroup$ Here is the output of the command prompt in Windows. Basically it just tells that everything was okay and a new license is saved. I can also find the license file. What else do I have to do in order to activate the license? $\endgroup$
    – PeterBe
    Jun 30 at 7:47
1
$\begingroup$

thanks for all your answers. I just wanted to say that the problem was in fact related to the Gurobi license file. I contacted Gurobi and they could reproduce the error and they just gave me a new license. Now everything is okay again.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.