Skip to content
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

Help! Cobra toolbox with CobraPy doesn't work #517

Closed
Trizali opened this issue May 27, 2017 · 14 comments
Closed

Help! Cobra toolbox with CobraPy doesn't work #517

Trizali opened this issue May 27, 2017 · 14 comments
Labels
bug Matlab Related to the Python-Matlab bridge (via scipy).

Comments

@Trizali
Copy link

Trizali commented May 27, 2017

Hello,

Using cobra toolbox with CobraPy does not work for me.
I have a tool in matlab, and I need to execute it with Jupyter's Python.

I can connect with Matlab executing:

from pymatbridge import Matlab
mlab = Matlab(executable='/usr/local/MATLAB/R2016b/bin/matlab')
mlab.start()

But I can't convert a model sbml to matlab struct with:
model_to_pymatbridge(model, variable_name="model", matlab=pymatbridge.Matlab)
AttributeError: 'numpy.ndarray' object has no attribute 'todok'

I tried with magics, but I can't connect to Matlab
%load_ext pymatbridge
............................................................MATLAB session timed out after 60 seconds

How does it work? How I can execute a cobra toolbox in Jupyter with Python?

I will be grateful for any help you can provide.
Thank you in advance.

@Midnighter
Copy link
Member

Noone has worked on the Matlab interface in a while so thank you for reporting the issue. That also means that we don't have a lot of expertise right now. We'll look into it, of course.

@Trizali
Copy link
Author

Trizali commented May 27, 2017

I finally got connected to Matlab with %load_ext pymatbridge.
I'm following the cobrapy core official document, however model_to_pymatbridge doesn't work.

Any idea?

%load_ext pymatbridge
import cobra.test
m = cobra.test.create_test_model("textbook")

**model_to_pymatbridge**(model, variable_name="model")
**AttributeError: 'numpy.ndarray' object has no attribute 'todok'**

Thank in advance.

@Trizali Trizali changed the title Help! Doubt: Cobra toolbox with CobraPy Help! Cobra toolbox with CobraPy doesn't work May 30, 2017
@cdiener
Copy link
Member

cdiener commented Jun 21, 2017

Hi, could you check whether you have scipy installed, since that is required for that functionality. The error suggests that you are missing scipy.

We should probably make that clear when calling the function...

@beacamara
Copy link

Hello,
I am trying to work Using cobra toolbox with CobraPy and this bug it is not still fixed. I have checked that the scipy is installed, but still it does not work.

imagen
I am using Python 3.6.8 and IPython 7.8.0 --

Any help please?

@Midnighter Midnighter reopened this Sep 17, 2019
@Midnighter Midnighter added bug Matlab Related to the Python-Matlab bridge (via scipy). labels Sep 17, 2019
@Midnighter
Copy link
Member

@beacamara please post the output of cobra.show_versions() here.

@beacamara
Copy link

System Information

OS Linux
OS-release 4.4.0-148-generic
Python 3.6.8

Package Versions

cobra 0.16.0
depinfo 1.5.1
future 0.17.1
numpy 1.14.0
optlang 1.4.4
pandas 0.22.0
pip 19.2.3
python-libsbml-experimental 5.18.0
ruamel.yaml 0.16.5
setuptools 38.5.1
six 1.11.0
swiglpk 4.65.0
wheel 0.30.0

@cdiener
Copy link
Member

cdiener commented Sep 18, 2019

Looks like the error was introduced with the new create_stoichiometric_matrix function which now returns a sense array by default. Should be an easy fix but I have no way of testing whether it would work (no Matlab).

@beacamara
Copy link

I have an old version of Matlab (R2010b). I there a way a can help to fix it? If you lead me to do it I can try.

@cdiener
Copy link
Member

cdiener commented Sep 19, 2019

Cool, l'll send a PR with a potential fix and ping you with instructions on how to test it.

@waltersaj101
Copy link

@cdiener is this issue fixed? I just ran into the same issue

@cdiener
Copy link
Member

cdiener commented Apr 10, 2020

Not yet because I do not have access to Matlab and nobody was willing to help out by testing the proposed fix and some example code in #909. I you want to jump in and test the PR and whether pymatbridge still works we would definitely appreciate it.

@waltersaj101
Copy link

@cdiener I'd be happy to! Sorry for the delayed response. I can get to this next week sometime and I'll let you know what I figure out!

@cdiener
Copy link
Member

cdiener commented Apr 23, 2020

That would be great. For now it would be sufficient to run the code from my last comment in #909 and confirm that pymatbridge is still working. That does not require checking out the PR.

@akaviaLab
Copy link
Contributor

This should be closed since pymatbridge has been removed due to lack of maintainers. see #1197 which was merged as of release 0.25

@cdiener cdiener closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Matlab Related to the Python-Matlab bridge (via scipy).
Projects
None yet
Development

No branches or pull requests

6 participants