Can not use GUROBI with CVXPY
AnsweredI have successfully installed the GUROBIPY and CVXPY. When I try to use the groubi solver in CVXPY, an error popped out.
result = prob.solve(solver=cvxpy.GUROBI)
The solver GUROBI is not installed.
Did I miss anything in the installation?
Here are the information about two packages.
Name: cvxpy Version: 1.1.5 Summary: A domain-specific language for modeling convex optimization problems in Python. Home-page: http://github.com/cvxgrp/cvxpy/ Author: Steven Diamond, Eric Chu, Stephen Boyd Author-email: stevend2@stanford.edu, akshayka@cs.stanford.edu, echu508@stanford.edu, boyd@stanford.edu License: Apache License, Version 2.0 Location: /Users/yongkang/opt/anaconda3/lib/python3.7/site-packages Requires: scipy, scs, ecos, osqp, numpy Required-by: Note: you may need to restart the kernel to use updated packages.
Name: gurobipy Version: 9.0.3 Summary: The Gurobi optimization engines represent the next generation in high-performance optimization software. Home-page: http://www.gurobi.com/ Author: Gurobi Optimization, LLC Author-email: UNKNOWN License: This software is covered by the Gurobi End User License Agreement. By completing the Gurobi installation process and using the software, you are accepting the terms of this agreement. Location: /Users/yongkang/opt/anaconda3/lib/python3.7/site-packages Requires: Required-by: Note: you may need to restart the kernel to use updated packages.
-
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,
Are you able to use Gurobi in Python. You can test it by trying to run one of our example files, e.g., \(\texttt{mip1.py}\) found in \(\texttt{<gurobiFolder>/examples/python}\).
If the above does not work, please install the Gurobi Python interface as described here first.
In case the Gurobi Python interface works properly, could you try running
print(cvxpy.installed_solvers())
in \(\texttt{CVXPY}\) and provide the output?
Best regards,
Jaromił0 -
Yes I can directly import gurobipy in python.
The output of the code is
['ECOS', 'GUROBI', 'OSQP', 'SCS']
0 -
Hi,
This problem seems to come from CVXPY and is related to this Github issue in the cvxpy Github. Could you try applying what is suggested by the CVXPY developers in their Github?
Please let us know whether you were able to solve this issue.
Best regards,
Jaromił0 -
Yes, that solved my problem. Thank you so much for your help!
0 -
Hi, I also have the same problem and I followed the github site but still doesn't work.
0 -
Could you post the exact error you are getting and the output of
print(cvxpy.installed_solvers())
and of
your_application.INSTALLED_SOLVERS
as in this Github issue in the cvxpy Github.
Best regards,
Jaromił0 -
0
-
This seems like a CVXPY issue. Did you try rebooting the jupyter notebook? Are you using the latest version of CXVPY?
I would recommend posting your question in the CVXPY Github for better input.
Best regards,
Jaromił0
Post is closed for comments.
Comments
9 comments