Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package does not install without Gurobi installed #517

Closed
gmantegna opened this issue Aug 17, 2023 · 4 comments
Closed

Package does not install without Gurobi installed #517

gmantegna opened this issue Aug 17, 2023 · 4 comments

Comments

@gmantegna
Copy link

I work on development of an open source Julia package for power systems optimization, GenX, which allows users to use multiple solvers including Gurobi. However, we are currently not able to include Gurobi.jl in our dependencies, because if we did, then users who did not have Gurobi installed would encounter an error during installation of Gurobi.jl. This is annoying for those users of our package who do want to use Gurobi as they have to manually add the package, and uncomment the "using Gurobi" line of code in the package itself. This last step in particular is problematic for those seeking to use the package without cloning the repo and modifying code. Would it be possible to add functionality to Gurobi.jl that would allow users to install the package without having Gurobi installed? Perhaps a warning could be thrown instead of an error?

@odow
Copy link
Member

odow commented Aug 17, 2023

See jump-dev/CPLEX.jl#406 for the discussion I had with other GenX developers on this.

You can set the GUROBI_JL_SKIP_LIB_CHECK environment variable to skip the error. Documented in the installation section https://github.com/jump-dev/Gurobi.jl#installation

@odow
Copy link
Member

odow commented Aug 17, 2023

users of our package who do want to use Gurobi as they have to manually add the package, and uncomment the "using Gurobi" line of code in the package itself

To reiterate jump-dev/CPLEX.jl#406 (comment): the approach of hard-coding the solvers into the package should be changed:

https://github.com/GenXProject/GenX/blob/ae19f20978255a3cfdc40e2e0292cf322095a90d/src/GenX.jl#L42

In the run file of a user's code, they should write something like (entirely made up functions):

using GenX, Gurobi
GenX.run(optimizer = Gurobi.Optimizer)

Don't do

using GenX
GenX.run(optimizer = "gurobi")

where the dispatch happens inside GenX.

@mlubin
Copy link
Member

mlubin commented Aug 17, 2023

Package extensions (https://docs.julialang.org/en/v1/manual/code-loading/#man-extensions) also provide a solution to this problem.

@gmantegna
Copy link
Author

Thanks so much all. We are going to try to implement @odow's suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants