-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
symengine will conflict with libsbml on Python 3.9 and Linux #1056
Comments
So is this something we should address or do we need an upstream fix in libSBML? (Please open an issue on depinfo when you can say clearly what is going wrong.) |
I think this is upstream but there is a potential workaround by using No idea about depinfo. It shows the correct versions for some deps but not others. Maybe it's something with my setup. |
Okay, it is not upstream per se, but there is something weird going on with our imports because the following fixes it: Python 3.9.2 (default, Feb 28 2021, 17:03:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import libsbml
In [2]: from cobra.io import read_sbml_model
In [3]: mod = read_sbml_model("src/cobra/test/data/iJO1366.xml.gz")
In [4]: mod.reactions.LDH_D.annotation
Out[4]:
{'sbo': 'SBO:0000375',
'bigg.reaction': 'LDH_D',
'biocyc': 'META:DLACTDEHYDROGNAD-RXN',
'ec-code': '1.1.1.28',
'kegg.reaction': 'R00704',
'metanetx.reaction': 'MNXR101037',
'rhea': ['16369', '16370', '16371', '16372']} So just by importing libsbml before cobrapy it has no issues anymore. I could also reproduce this in a fresh Python env. |
Strange, I don't have that issue at all in the following environment: Python 3.9.0 (default, Nov 29 2020, 14:58:16)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from cobra.io import read_sbml_model
In [2]: mod = read_sbml_model("src/cobra/test/data/iJO1366.xml.gz")
In [3]: mod.reactions.LDH_D.annotation
Out[3]:
{'sbo': 'SBO:0000375',
'bigg.reaction': 'LDH_D',
'biocyc': 'META:DLACTDEHYDROGNAD-RXN',
'ec-code': '1.1.1.28',
'kegg.reaction': 'R00704',
'metanetx.reaction': 'MNXR101037',
'rhea': ['16369', '16370', '16371', '16372']}
|
Here is a more minimal version that triggers the error for me: Python 3.9.0 (default, Nov 15 2020, 14:28:56)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import cobra
In [2]: import libsbml
In [3]: doc = libsbml.readSBML("iJO1366.xml.gz")
In [4]: doc.getModel().getReaction("R_LDH_D").getSBOTermID()
Out[4]: 'SBO:' |
The problem is a conflict between libsbml and symengine. Uninstalling symengine fixes the bug. |
Python 3.9.0 (default, Nov 29 2020, 14:58:16)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import libsbml
In [2]: doc = libsbml.readSBML("cobrapy/src/cobra/test/data/iJO1366.xml.gz")
In [3]: doc.getModel().getReaction("R_LDH_D").getSBOTermID()
Out[3]: 'SBO:0000375' 😆 which libSBML is that using? |
Wow, what? |
I had those issues before. Something in the symengine wheels breaks other packages, I'll open a report there. See for instance: numba/llvmlite#587 |
Minimal example: In [1]: import symengine
In [2]: import libsbml
In [3]: doc = libsbml.readSBML("iJO1366.xml.gz")
In [4]: doc.getModel().getReaction("R_LDH_D").getSBOTermID()
Out[4]: 'SBO:' Removing the symengine import will change the output to: Python 3.9.0 (default, Nov 15 2020, 14:28:56)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import libsbml
In [2]: doc = libsbml.readSBML("iJO1366.xml.gz")
In [3]: doc.getModel().getReaction("R_LDH_D").getSBOTermID()
Out[3]: 'SBO:0000375' |
I was wondering if symengine causes libsbml to load a different shared library but as far as I can tell that is not the case.
Unless it's a local |
But one is a manylinux1 image and the other manylinux2010, so there may be different versions of the same lib. But if they are built cleanly they should not export overlapping symbols. |
Most likely this is due to C++ symbols being overwritten within the swig packages. |
Symengine is not a swig package though. But I do think you are right, ergo same symbols. I thought that the point of the new many linux images was to isolate this better but that does not seem to be the case. |
Fixed in symengine 0.7.1.
|
Problem description
This will hit us when we support Python 3.9. There seems to be serious bug in libSBML that breaks reading of SBO terms completely. This will make several of our tests fail.
Code Sample
Create a minimal, complete, verifiable example.
This uses the E. coli model from our repo.
On Python < 3.9
On Python 3.9
This is due to a bug in libsbml where
libsbml.SBase.getSBOTermID()
always returns "SBO:" (without the ID).libsbml.SBase.getSBOTerm()
still works (returns375
in this case).Context
I think depinfo is a bit buggy as well. Here is the correct libsbml version:
The text was updated successfully, but these errors were encountered: