Skip to content

Gurobi package name changed from gurobi to com.gurobi.gurobi in new version and cause package not found error in COMETS #52

@gaospecial

Description

@gaospecial

I found when using COMETS with gurobi 11.0.2, there is a error cause by Gurobi.

The original error in cometspy is as follows:

RuntimeError: COMETS simulation did not complete:JAVA could not find gurobi.
try the following:
>>> import os
>>> os.environ['GUROBI_COMETS_HOME']
if there is nothing there try setting that variable
to the location of gurobi.jar, for example:
>>> os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi900/inux64'

After investigation, I identified it is a java class definition not found error raised by COMETS.

Exception in thread "main" java.lang.NoClassDefFoundError: gurobi/GRBException
        at edu.bu.segrelab.comets.fba.FBAModel.(FBAModel.java:224)
        at edu.bu.segrelab.comets.fba.FBAModel.(FBAModel.java:287)
        at edu.bu.segrelab.comets.fba.FBAModel.loadModelFromFile(FBAModel.java:2648)
        at edu.bu.segrelab.comets.fba.FBACometsLoader.loadModelFromFile(FBACometsLoader.java:2918)
        at edu.bu.segrelab.comets.fba.FBACometsLoader.parseModelFileLine(FBACometsLoader.java:1168)
        at edu.bu.segrelab.comets.fba.FBACometsLoader.loadLayoutFile(FBACometsLoader.java:316)
        at edu.bu.segrelab.comets.Comets.loadLayoutFile(Comets.java:1657)
        at edu.bu.segrelab.comets.Comets.runScript(Comets.java:541)
        at edu.bu.segrelab.comets.Comets.(Comets.java:233)
        at edu.bu.segrelab.comets.Comets.main(Comets.java:2159)

In of source of COMETS, the format used to import is no longer work in new version of gurobi.

import gurobi.GRBConstr;
import gurobi.GRBEnv;
import gurobi.GRBException;
import gurobi.GRBLinExpr;
import gurobi.GRBModel;
import gurobi.GRBVar;
import gurobi.GRB.DoubleAttr;
import gurobi.GRB.IntAttr;
import gurobi.GRB.IntParam;
import gurobi.GRB.StringAttr;

I believed these lines should be updated to the latter format.

import com.gurobi.gurobi.GRB

Or, (to users) using gurobi v10.0.0 can work with current release of COMETS.

Hope this could be help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions