Issue with glpk solver on Cobra Matlab for Mac

230 views
Skip to first unread message

Louis Coplan

unread,
Mar 24, 2017, 1:54:17 PM3/24/17
to COBRA Toolbox
Hello COBRA community,
My name is Louis Coplan, and I just downloaded the COBRA toolbox for Matlab (on a Mac, OS is El Capitan). I am having some technical difficulties doing linear programming (ie flux balance analysis) problems, specifically with the cplex_direct and glpk solvers, and I was wondering if I could get some assistance from you. Attached is a pdf of the Matlab code that I ran, along with the output from the code. Any and all help would be greatly appreciated. 

Thank you for your time and help.

All the best,
Louis
FBA_practice_problem2.pdf

Laurent Heirendt

unread,
Mar 25, 2017, 10:34:22 AM3/25/17
to COBRA Toolbox
Dear Louis,

Does this error occur even though you already ran the following commands from your Terminal?

git submodule update --init

This will be fixed soon, so that you won't have to do this installation step manually anymore.

From the code output, it also seems as if you don't have the latest version.

Best,

Laurent

Louis Coplan

unread,
Mar 25, 2017, 5:22:52 PM3/25/17
to COBRA Toolbox
Hi Laurent,
I just used that command, and restarted Matlab (the version is R2016a), but I still received the same message that was listed in the attachment above. When you say I do not have the latest version, are you referring to the COBRA toolbox itself, or of Matlab? As an additional point of query (I do not know if this is relevant to the issue at hand), but whenever I try to run the 'testAll' command as listed on the GitHub instructions, Matlab always quits and turns off. Please let me know if there is anything else I can provide to help solve this problem.

Thank you for your time and help.

All the best.
Louis

Thomas Pfau

unread,
Mar 27, 2017, 12:45:11 AM3/27/17
to cobra-...@googlegroups.com

Hi Louis,

Which CPLEX version do you use? From all I know, only the latest CPLEX version (12.7) is only compatible with Matlab 2016a, any other CPLEX version is likely to lead to crashing MATLAB and even that latest version only supports 2016a and nothing newer.

The glpk issue is indeed odd. Could you please run "which glpkcc" on your matlab command window and let us know the output.
Apart from that, are you sure, that the error you get is exactly the same after having initialized the submodules (as mentioned by Laurent)?

Kind Regards

Thomas

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu

Almut Heinken

unread,
Mar 27, 2017, 10:32:21 AM3/27/17
to cobra-...@googlegroups.com
Dear all,
we recently had the same error "Undefined function 'glpkcc' for input arguments of type 'struct'." when we used glpk. The error happened even though the test for glpk as LP solver passed. We used the latest COBRA release.
Best
Almut

To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

Laurent Heirendt

unread,
Mar 27, 2017, 11:11:27 AM3/27/17
to COBRA Toolbox
Hi Louis,

I tried reproducing the error using Matlab R2016b on macOS (Sierra) and the latest version of The COBRA Toolbox, but everything worked fine.

I did the following from the Terminal (you can open the Terminal by navigating to /Applications/Utilities and clicking on Terminal.app):

- cd cobratoolbox
- git submodule update --init

Then, I started Matlab, browsed to the folder cobratoolbox, and typed:

>> initCobraToolbox
>> which glpkcc
~/cobratoolbox/binary/bin/mac/glpkcc.mexmaci64
>> load ecoli_core_model.mat
>> stat = changeCobraSolver('glpk')

stat =

  logical

   1

>> FBAsolution = optimizeCbModel(model,'max')

FBAsolution =

  struct with fields:

           x: [951 double]
           f: 0.8739
           y: [721 double]
           w: [951 double]
        stat: 1
    origStat: 5
      solver: 'glpk'
        time: 0.1676

Please let me know if this helps.

Best,

Laurent
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.

Laurent Heirendt

unread,
Mar 27, 2017, 11:16:53 AM3/27/17
to COBRA Toolbox
Hi Louis,

As for the crash of Matlab when typing >> testAll:

This happened in the past when you launched testAll from a folder different that the root folder of The COBRA Toolbox. However, this has been fixed in this PR (https://github.com/opencobra/cobratoolbox/pull/337). It seems as if your version is not the latest.

You can get the latest version by either doing (from the terminal):

- cd cobratoolbox
- git submodule update --init

or, from your current cobratoolbox folder (cd cobratoolbox):

- git pull
- git submodule update --init

Please let me know if this helps.

Best,

Laurent

Louis Coplan

unread,
Mar 27, 2017, 11:20:14 AM3/27/17
to COBRA Toolbox
Hi Thomas,

I am currently running R2016a on my computer, and I am using the version of CPLEX that came with the COBRA toolbox itself. Regarding the glpk issue,  this is the output from the command you suggested:

>> which glpkcc
'glpkcc' not found.

As an aside, I don't know if this has to do with the fact that the glpkcc in the toolbox is a .cpp file and not a .m file. 
I tried running the command that Laurent suggested, and then restarted Matlab, but I received the same error message. 

Thank you for your assistance. 

All the best,
Louis

Louis Coplan

unread,
Mar 27, 2017, 11:33:06 AM3/27/17
to COBRA Toolbox
Laurent,
As an update, I just ran the code you suggested, and everything worked! Attached is my new code. To Thomas, after running the commands that Laurent suggested, the output for the 'which' command is:

>> which glpkcc
/Users/louiecoplan/cobratoolbox/binary/bin/mac/glpkcc.mexmaci64

Thank you all so much for your assistance!

Best,
Louis
FBA_practice_problem.pdf

Laurent Heirendt

unread,
Mar 27, 2017, 11:48:05 AM3/27/17
to COBRA Toolbox
Great to hear that! 

You are very welcome.

Laurent
Reply all
Reply to author
Forward
0 new messages