SBRG/cobrame

CobraPy version not being correctly detected

Closed this issue · 2 comments

Hello,

I installed CobraPy v0.5.11 as indicated in the documentation (note, I had to install this version manually since pip couldn't find that version).

I get the following error:

---> 22     from cobra.io.json import metabolite_from_dict, save_json_model
ImportError: cannot import name 'metabolite_from_dict' from 'cobra.io.json'

I'm wondering if the logic in detecting the CobraPy version is correct, given that it is using optlang and somehow inferring cobrapy version because of it?

This is the line in the code I'm referring to:
https://github.com/SBRG/cobrame/blob/559ebcb7687ceefcc5905e46e688ea88bae3eb05/cobrame/io/json.py#L17C1-L22C35

Thanks!

Hello,

I agree that the logic in that code snippet is incorrect. You can't infer the cobrapy version based on an error while importing optlang.

Is it possible that you have multiple versions of cobrapy installed in your environment? If you import cobrapy and print cobra.__version__ does it print 0.5.11?

Colton

It seems I did have an older version as well, cleaned that out to only install 0.5.11 and no longer get that error. Thanks!