cdanielmachado / carveme

CarveMe: genome-scale metabolic model reconstruction
Other
159 stars 54 forks source link

How to change the default solver cplex to gurobi? #175

Closed wupeng1998 closed 1 year ago

wupeng1998 commented 1 year ago

I have some problems when using cplex. How can I change the default solver of carveme to gurobi?

cdanielmachado commented 1 year ago

You can now do this in the latest version (1.5.2). Just use --solver gurobi :)

jmol0917 commented 1 year ago

I am having issues setting gurobi as my solver. This is my input; carve --dna genomic.fna --init M9 --solver gurobi --fbc2 -o carved_model.xml Which produces the following error:

Traceback (most recent call last):
  File "C:\Users\mol131\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\mol131\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\mol131\Anaconda3\Scripts\carve.exe\__main__.py", line 4, in <module>
  File "C:\Users\mol131\Anaconda3\lib\site-packages\carveme\__init__.py", line 14, in <module>
    set_default_solver(config.get('solver', 'default_solver'))
  File "C:\Users\mol131\Anaconda3\lib\site-packages\reframed\solvers\__init__.py", line 82, in set_default_solver
    raise RuntimeError(f"Solver {solvername} not available.")
RuntimeError: Solver cplex not available.

Thanks for your help

Robaina commented 1 year ago

Hey @jmol0917,

I found the same error, I think due to a single uncommented line. See this issue

Cheers

jmol0917 commented 1 year ago

Thanks @Robaina! That solved my issue