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

Import error involving numpy and cobra #173

Open
CNelias opened this issue Jul 4, 2023 · 4 comments
Open

Import error involving numpy and cobra #173

CNelias opened this issue Jul 4, 2023 · 4 comments

Comments

@CNelias
Copy link

CNelias commented Jul 4, 2023

When trying to import mass (or cobra), I get the following error:

ImportError: cannot import name 'object' from 'numpy' (C:\Users\Corentin offline\AppData\Roaming\Python\Python310\site-packages\numpy\__init__.py)

The full stack trace goes as follow:

C:\ProgramData\anaconda3\lib\site-packages\cobra\io\mat.py:13: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  from numpy import object as np_object
Traceback (most recent call last):

  Cell In[2], line 1
    import mass

  File C:\ProgramData\anaconda3\lib\site-packages\mass\__init__.py:7
    from mass import enzyme_modules, io

  File C:\ProgramData\anaconda3\lib\site-packages\mass\enzyme_modules\__init__.py:2
    from mass.enzyme_modules.enzyme_module import EnzymeModule

  File C:\ProgramData\anaconda3\lib\site-packages\mass\enzyme_modules\enzyme_module.py:58
    from cobra.core.dictlist import DictList

  File C:\ProgramData\anaconda3\lib\site-packages\cobra\__init__.py:17
    from cobra import io

  File C:\ProgramData\anaconda3\lib\site-packages\cobra\io\__init__.py:6
    from cobra.io.mat import load_matlab_model, save_matlab_model

  File C:\ProgramData\anaconda3\lib\site-packages\cobra\io\mat.py:13
    from numpy import object as np_object

Any idea what's causing it and how I can fix this? I'm running Python 3.10 on windows 11. I have tried on another machine (also windows 11) and get the same error.

@CNelias CNelias changed the title Import error implying numpy Import error involving numpy and cobra Jul 4, 2023
@AlbanMariette
Copy link

Hi @CNelias, did you find a fix for this issue? I some how have the same issue with MassPy, updating numpy and scipy does not fix the issue and updating Cobra to the last version does not work because of incompatibilities

@CNelias
Copy link
Author

CNelias commented Feb 18, 2024

Unfortunately not, and I decided to switch to another framework at some point.

@AlbanMariette
Copy link

Hi @CNelias, thanks for your answer, may I ask to which framework you switched because I do not think COBRA would allow me to simulate enzyme inhibition or to integrate enzyme activities as MASSPY would have allowed me?

@luciansmith
Copy link

According to https://stackoverflow.com/questions/75069062/module-numpy-has-no-attribute-object, the 'object' child of numpy was removed in 1.24.0, so until masspy updates their code to match the new numpy, you'll need to install 1.23.5 or earlier (pip install numpy==1.23.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants