opencobra / cobrapy

COBRApy is a package for constraint-based modeling of metabolic networks.
http://opencobra.github.io/cobrapy/
GNU General Public License v2.0
465 stars 218 forks source link

test_summary_methods fails #277

Closed matthiaskoenig closed 8 years ago

matthiaskoenig commented 8 years ago

Hi all,

I just did a clean install from the git repository. The summary method test fails when running test_all() with tabulate (0.7.5) pandas (0.18.1) and I get the following error

FAIL: test_summary_methods (cobra.test.flux_analysis.TestCobraFluxAnalysis)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cobra-0.4.2b2.post25-py2.7-linux-x86_64.egg/cobra/test/flux_analysis.py", line 403, in test_summary_methods
    self.check_entries(out, desired_entries)
  File "/usr/local/lib/python2.7/dist-packages/cobra-0.4.2b2.post25-py2.7-linux-x86_64.egg/cobra/test/flux_analysis.py", line 336, in check_entries
    self.assertIn(re.sub('\s', '', item), output_set)
AssertionError: '100%43.6CYTBD2.0h_c+0.5o2_c+q8h2_c-->h2o_c+2.0h_e...' not found in set([u'', u'96%995FRD7fum_c+q8h2_c-->q8_c+succ_c', u'4%43.6CYTBD2.0h_c+0.5o2_c+q8h2_c-->h2o_c+2.0h_e...', u'4%38.5NADH164.0h_c+nadh_c+q8_c-->3.0h_e+nad_c+q...', u'96%1e+03SUCDiq8_c+succ_c-->fum_c+q8h2_c', u'--------------------------------------------------------------------', u'%FLUXRXNIDREACTION', u'CONSUMINGREACTIONS--Ubiquinone-8(q8_c)', u'------------------------------------------', u'PRODUCINGREACTIONS--Ubiquinone-8(q8_c)'])

In addition the requirements pandas tabulate should be added to the install instructions. Only after reading through all the warning did I find out that tabulate is needed.

The best Matthias

cdiener commented 8 years ago

Hi, since you built from source could you give your installed solvers (GLPK, Gurobi, etc) and their versions. The problem seems to be that you get another solution for the fluxes. Tabulate definitely needs to be added to setup.py...

pstjohn commented 8 years ago

tabulate is included in setup.py, right after pandas:

    'display': ["matplotlib", "palettable", "pandas>=0.17.0", "tabulate"]

I'm not sure if these get installed by default, though. Not sure why pandas was included under display.

matthiaskoenig commented 8 years ago

I just installed the latest gurobi and mosek.

cobra.solvers.solver_dict
Out[2]: 
{'gurobi': <module 'cobra.solvers.gurobi_solver' from '/usr/local/lib/python2.7/dist-packages/cobra-0.4.2b2.post25-py2.7-linux-x86_64.egg/cobra/solvers/gurobi_solver.pyc'>,
 'mosek': <module 'cobra.solvers.mosek' from '/usr/local/lib/python2.7/dist-packages/cobra-0.4.2b2.post25-py2.7-linux-x86_64.egg/cobra/solvers/mosek.pyc'>}

I wanted to try pyglpk first but was unable to get a working pyglpk on Ubuntu 16.04. The basic installation does not work and the import of the solver fails with

/usr/local/lib/python2.7/dist-packages/ply/yacc.pyc in yacc(method, debug, module, tabmodule, start, check_recursion, optimize, write_tables, debugfile, outputdir, debuglog, errorlog, picklefile)
   3283             read_signature = lr.read_pickle(picklefile)
   3284         else:
-> 3285             read_signature = lr.read_table(tabmodule)
   3286         if optimize or (read_signature == signature):
   3287             try:

/usr/local/lib/python2.7/dist-packages/ply/yacc.pyc in read_table(self, module)
   1983             parsetab = sys.modules[module]
   1984 
-> 1985         if parsetab._tabversion != __tabversion__:
   1986             raise VersionError('yacc table file version is out of date')
   1987 

AttributeError: 'module' object has no attribute '_tabversion'

I tried to install with

sudo apt-get install python-dev libglpk-dev python-glpk

which worked on Ubuntu 14.04, but does not work on 16.04 any more. So if someone has pyglpk as solver working on Ubuntu 16.04 I would like to know how (without conda or downgrading packages). M

matthiaskoenig commented 8 years ago

Just noticed the versions are missing: Gurobi Interactive Shell (linux64), Version 6.5.2 MOSEK Version 7.1.0.55 (Build date: 2016-8-26 12:20:25)

matthiaskoenig commented 8 years ago

@pstjohn The extras are not installed default. I think they can be installed via

setup.py install -e .[matlab,sbml,array,display]
cdiener commented 8 years ago

Ah ok, perfect.

On Wed, Sep 7, 2016, 09:04 Peter St. John notifications@github.com wrote:

tabulate is included in setup.py, right after pandas:

'display': ["matplotlib", "palettable", "pandas>=0.17.0", "tabulate"]

I'm not sure if these get installed by default, though. Not sure why pandas was included under display.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencobra/cobrapy/issues/277#issuecomment-245290657, or mute the thread https://github.com/notifications/unsubscribe-auth/AG0pDzxfKO2RSjVaVBoIzCBlg7u3VRVaks5qnsRpgaJpZM4J2sXO .

Christian Diener <mail@cdiener.com ch.diener@gmail.com>

For encrypted communication you may use the following public key: https://cdiener.com/key

cdiener commented 8 years ago

Okay great. That explains the different solutions. The reference solution was calculated with GLPK I think. Pyglpk is not active anymore if I'm not mistaken. However, cobrapy has its own bindings to GLPK so you only need to install libplgk-dev and python and rebuild cobrapy. This will compile and use cobrapy's own bindings.

Just for completeness on Ubuntu 16.04 the recommended mode of installation is to use pip which will use the new manylinux builds which already include all external dependencies.

On Wed, Sep 7, 2016, 09:54 Matthias König notifications@github.com wrote:

I just installed the latest gurobi and mosek.

cobra.solvers.solver_dict Out[2]: {'gurobi': <module 'cobra.solvers.gurobi_solver' from '/usr/local/lib/python2.7/dist-packages/cobra-0.4.2b2.post25-py2.7-linux-x86_64.egg/cobra/solvers/gurobi_solver.pyc'>, 'mosek': <module 'cobra.solvers.mosek' from '/usr/local/lib/python2.7/dist-packages/cobra-0.4.2b2.post25-py2.7-linux-x86_64.egg/cobra/solvers/mosek.pyc'>}

I wanted to try pyglpk first but was unable to get a working pyglpk on Ubuntu 16.04. The basic installation does not work and the import of the solver fails with

/usr/local/lib/python2.7/dist-packages/ply/yacc.pyc in yacc(method, debug, module, tabmodule, start, check_recursion, optimize, write_tables, debugfile, outputdir, debuglog, errorlog, picklefile) 3283 read_signature = lr.read_pickle(picklefile) 3284 else: -> 3285 read_signature = lr.read_table(tabmodule) 3286 if optimize or (read_signature == signature): 3287 try:

/usr/local/lib/python2.7/dist-packages/ply/yacc.pyc in read_table(self, module) 1983 parsetab = sys.modules[module] 1984 -> 1985 if parsetab._tabversion != tabversion: 1986 raise VersionError('yacc table file version is out of date') 1987

AttributeError: 'module' object has no attribute '_tabversion'

I tried to install with

sudo apt-get install python-dev libglpk-dev python-glpk

which worked on Ubuntu 14.04, but does not work on 16.04 any more. So if someone has pyglpk as solver working on Ubuntu 16.04 I would like to know how (without conda or downgrading packages).

M

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencobra/cobrapy/issues/277#issuecomment-245306837, or mute the thread https://github.com/notifications/unsubscribe-auth/AG0pDxATeI1NlJ3R9AX5l-ugPSsnU31Eks5qntAzgaJpZM4J2sXO .

Christian Diener <mail@cdiener.com ch.diener@gmail.com>

For encrypted communication you may use the following public key: https://cdiener.com/key

matthiaskoenig commented 8 years ago

Works now and all tests pass. The cglpk solver is found after installing Cython. Thanks for the help.