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

Getting error with Numpy #765

Open
carolinasisco opened this issue Jun 19, 2024 · 7 comments
Open

Getting error with Numpy #765

carolinasisco opened this issue Jun 19, 2024 · 7 comments
Labels
needs information Progress is blocked until more information can be provided.

Comments

@carolinasisco
Copy link

hello,

Code used: memote report snapshot --filename "report_model.html" ~/Desktop//model.xml
Error:
Traceback (most recent call last):
File "/home/carol/miniconda3/envs/metabolic_model_env/bin/memote", line 5, in
from memote.suite.cli.runner import cli
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/memote/suite/cli/runner.py", line 42, in
import memote.suite.cli.callbacks as callbacks
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/memote/suite/cli/callbacks.py", line 30, in
from memote.experimental import ExperimentConfiguration
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/memote/experimental/init.py", line 22, in
from memote.experimental.config import *
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/memote/experimental/config.py", line 39, in
from memote.experimental.essentiality import EssentialityExperiment
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/memote/experimental/essentiality.py", line 25, in
import pandera as pa
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/init.py", line 5, in
import pandera.backends
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/backends/init.py", line 4, in
import pandera.backends.base.builtin_checks
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/backends/base/builtin_checks.py", line 14, in
from pandera.api.checks import Check
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/api/checks.py", line 17, in
from pandera.strategies.base_strategies import SearchStrategy
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/strategies/init.py", line 3, in
from pandera.strategies.pandas_strategies import *
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/strategies/pandas_strategies.py", line 42, in
from pandera.engines import numpy_engine, pandas_engine
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/pandera/engines/pandas_engine.py", line 757, in
np.string_,
^^^^^^^^^^
File "/home/carol/miniconda3/envs/metabolic_model_env/lib/python3.11/site-packages/numpy/init.py", line 397, in getattr
raise AttributeError(

Any suggestions?

Thanks!

@Midnighter
Copy link
Member

Hi,

Thanks for the report. You have cut off the most important part of the error message, i.e., what comes after AttributeError. Also, please provide version information like we ask for in the bug report template.

@Midnighter Midnighter added the needs information Progress is blocked until more information can be provided. label Jun 19, 2024
@jjkoehorst
Copy link

I might have the same issue after a pip install in a clean venv

memote report snapshot --filename "test_report.html" ~/Documents/protein_model_carve 
Traceback (most recent call last):
  File "/home/peiyi/venv_memote/bin/memote", line 5, in <module>
    from memote.suite.cli.runner import cli
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/memote/suite/cli/runner.py", line 42, in <module>
    import memote.suite.cli.callbacks as callbacks
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/memote/suite/cli/callbacks.py", line 30, in <module>
    from memote.experimental import ExperimentConfiguration
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/memote/experimental/__init__.py", line 22, in <module>
    from memote.experimental.config import *
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/memote/experimental/config.py", line 39, in <module>
    from memote.experimental.essentiality import EssentialityExperiment
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/memote/experimental/essentiality.py", line 25, in <module>
    import pandera as pa
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/__init__.py", line 5, in <module>
    import pandera.backends
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/backends/__init__.py", line 4, in <module>
    import pandera.backends.base.builtin_checks
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/backends/base/builtin_checks.py", line 14, in <module>
    from pandera.api.checks import Check
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/api/checks.py", line 17, in <module>
    from pandera.strategies.base_strategies import SearchStrategy
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/strategies/__init__.py", line 3, in <module>
    from pandera.strategies.pandas_strategies import *
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/strategies/pandas_strategies.py", line 42, in <module>
    from pandera.engines import numpy_engine, pandas_engine
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/pandera/engines/pandas_engine.py", line 757, in <module>
    np.string_,
    ^^^^^^^^^^
  File "/home/peiyi/venv_memote/lib/python3.12/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.string_` was removed in the NumPy 2.0 release. Use `np.bytes_` instead.. Did you mean: 'strings'?

@jjkoehorst
Copy link

pip install 'numpy<2.0.0' did the trick as this major release made some breaking changes (probably why its a major release).

@Midnighter
Copy link
Member

This is coming from the pandera dependency and has already been addressed there. Hopefully, they will release the fix soon.

unionai-oss/pandera#1656

@HossFir
Copy link

HossFir commented Jul 15, 2024

I encountered the same issue with NumPy regarding the deprecation and removal of the np.float alias in recent versions. Here's how I fixed it in the cobra library:

In the repository, locate the file cobra/io/dict.py.

Change this line:

value: Union[str, np.float, np.bool, Set, Dict]

to:

value: Union[str, float, bool, Set, Dict]

After making this change, Memote ran successfully. However, to ensure that CobraPy continues to work correctly, you need to revert this line back to its original state after running Memote.

@Midnighter
Copy link
Member

Did anyone of you try this again with the recent pandera release 0.20.x? That should fix it on their end. Maybe there are further issues in cobrapy or optlang to consider.

@HossFir
Copy link

HossFir commented Jul 15, 2024

I have been using pandera 0.20.1
I got this with numpy: 0.2 when I used memote:
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Fixing that line in cobrapy will set the issue for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs information Progress is blocked until more information can be provided.
Projects
None yet
Development

No branches or pull requests

4 participants