You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I was trying to set up the Gurobi solver within COBRApy, within a Python application container.
I followed the installation instructions for Gurobi in a Python-based docker container, either with a Gurobi-based image or with a Python-based image and simply installing gurobipy during build (this is working).
I requested a free academic WLS license and made it available within the container according to the indicated specifications. Finally, I tested the license with a couple of optimization examples (not involving COBRApy) and it was working.
However, when I was trying to execute COBRApy with the gurobi solver, I got an error while reading a VALID (XML format) model with cobra.io.read_sbml_model. This error is
CobraSBMLError: Something went wrong reading the SBML model. Most likely the SBML model is not valid. Please check that your model is valid using the `cobra.io.sbml.validate_sbml_model` function or via the online validator at https://sbml.org/validator_servlet/ . (model, errors) = validate_sbml_model(filename)` If the model is valid and cannot be read please open an issue at https://github.com/opencobra/cobrapy/issues.
When executing (model, errors) = cobra.io.validate_sbml_model(modelpath), other than warnings there is a ‘COBRA_FATAL’ entry indicating ['addConstr() takes at most 3 positional arguments (4 given)'], which is unfamiliar to me.
Regarding my system, I am using python:3.12-slim as base image for the container, creating and executing a Python environment (version 3.12 again) within the container and installing libraries (cobra==0.29.0, gurobipy==12.0.0) within this environment.
Note that available solvers are displayed when I execute cobra.core.configuration.SOLVERS ('gurobi': <module 'optlang.gurobi_interface' from '/opt/intvenv/lib/python3.12/site-packages/optlang/gurobi_interface.py'>), and that a connection is established (a token is created) when my code tries to access my Gurobi WLS license.
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value ...
[client] info : [...]
[client] info : Validate token ...
[client] info : *** Academic license ... - for non-commercial use only - registered to [email address]
[client] info: Token is valid
Could you please help me? Also do not hesitate to ask for additional information in case I forgot to provide it. Thank you very much!
Environment
### Package Information
Package
Version
cobra
0.29.0
Dependency Information
Package
Version
appdirs
1.4.4
black
missing
bumpversion
missing
depinfo
2.2.0
diskcache
5.6.3
future
1.0.0
httpx
0.28.1
importlib-resources
6.4.5
isort
missing
numpy
2.1.1
optlang
1.8.2
pandas
2.2.2
pydantic
2.10.3
python-libsbml
5.20.4
rich
13.9.4
ruamel.yaml
0.18.6
scipy
1.14.1
swiglpk
5.0.12
tox
missing
Build Tools Information
Package
Version
pip
24.3.1
setuptools
75.6.0
Platform Information
Linux
6.8.0-49-generic-x86_64
CPython
3.12.8
The text was updated successfully, but these errors were encountered:
As @cambordas said this was due to an incompatibility in optlang. It is already fixed there and will be part of the next release. Downgrading gurobi will work for now.
Is there an existing issue for this?
Problem description
Hi! I was trying to set up the Gurobi solver within COBRApy, within a Python application container.
I followed the installation instructions for Gurobi in a Python-based docker container, either with a Gurobi-based image or with a Python-based image and simply installing gurobipy during build (this is working).
I requested a free academic WLS license and made it available within the container according to the indicated specifications. Finally, I tested the license with a couple of optimization examples (not involving COBRApy) and it was working.
However, when I was trying to execute COBRApy with the gurobi solver, I got an error while reading a VALID (XML format) model with
cobra.io.read_sbml_model
. This error isWhen executing
(model, errors) = cobra.io.validate_sbml_model(modelpath)
, other than warnings there is a ‘COBRA_FATAL’ entry indicating['addConstr() takes at most 3 positional arguments (4 given)']
, which is unfamiliar to me.Regarding my system, I am using python:3.12-slim as base image for the container, creating and executing a Python environment (version 3.12 again) within the container and installing libraries (cobra==0.29.0, gurobipy==12.0.0) within this environment.
Note that available solvers are displayed when I execute
cobra.core.configuration.SOLVERS
('gurobi': <module 'optlang.gurobi_interface' from '/opt/intvenv/lib/python3.12/site-packages/optlang/gurobi_interface.py'>
), and that a connection is established (a token is created) when my code tries to access my Gurobi WLS license.Could you please help me? Also do not hesitate to ask for additional information in case I forgot to provide it. Thank you very much!
Environment
Dependency Information
Build Tools Information
Platform Information
The text was updated successfully, but these errors were encountered: