sbmlteam / libsbml

LibSBML is a native library for reading, writing and manipulating files and data streams containing the Systems Biology Markup Language (SBML). It offers language bindings for C, C++, C#, Java, JavaScript, MATLAB, Perl, PHP, Python, R and Ruby.

Home Page:https://sbml.org/software/libsbml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libsbml 5.20.* python libraries miss symbols on win and mac distributions

matthiaskoenig opened this issue · comments

The Mac and Win releases miss the UnitDefinition_reorder, perhaps also other symbols/attributes in python

  File "C:\Users\Dsintara\.conda\envs\xresearch\lib\site-packages\sbmlsim\units.py", line 377, in udef_to_str
    libsbml.UnitDefinition_reorder(udef)
AttributeError: module 'libsbml' has no attribute 'UnitDefinition_reorder'

Workaround:

pip install python-libsbml==5.19.7

Things work on linux, but symbols are missing on mac and win.

This is due to how swig4 works these days. If you use UnitDefinition.reorder instead of UnitDefinition_reorder it will work.

Hi Frank,
thanks.

It is just confusing that I see the other symbols on linux and get this via autocomplete. So it is difficult to say which symbols should be different so that the code will work on mac and win also. For instance why is libsbml.UnitKind_toString not libsbml.UnitKind.toString but UnitDefinition_reorder is UnitDefinition.reorder?

I will close this as soon as tested on mac and win.
Best Matthias

All the symbols with underscores were additionally produced by SWIG < 4, the others should have been available too. With SWIG 4 those underscore ones are no longer generated. I agree this is confusing. Sorry for the inconvenience. If you look into the site-packages/libsbml/__init__.py it will say which swig version was used to build it. If you need me to change something let me know.

I think this issue is resolved (@matthiaskoenig please feel free to reopen, if you think it needs an action)