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

test_bng_boolean_multiply_number fails with SymPy 1.12 #577

Open
himoto opened this issue Jun 13, 2023 · 2 comments
Open

test_bng_boolean_multiply_number fails with SymPy 1.12 #577

himoto opened this issue Jun 13, 2023 · 2 comments

Comments

@himoto
Copy link
Contributor

himoto commented Jun 13, 2023

When running tests with the latest sympy 1.12, I got the following error message.

======================================================================
ERROR: pysb.tests.test_bng.test_bng_boolean_multiply_number
----------------------------------------------------------------------
ValueError: Error from parse_expr with transformed code: <code object <module> at 0x7f37c5f52450, file "<string>", line 1>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/share/miniconda/envs/pysb/lib/python3.9/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/runner/work/pysb/pysb/build/lib/pysb/tests/test_bng.py", line 425, in test_bng_boolean_multiply_number
    assert parse_bngl_expr('(2 > 1) * 4') == 4
  File "/home/runner/work/pysb/pysb/build/lib/pysb/bng.py", line 946, in parse_bngl_expr
    expr = sympy_parser.parse_expr(text, *args, transformations=trans,
  File "/usr/share/miniconda/envs/pysb/lib/python3.9/site-packages/sympy/parsing/sympy_parser.py", line 1087, in parse_expr
    raise e from ValueError(f"Error from parse_expr with transformed code: {code!r}")
  File "/usr/share/miniconda/envs/pysb/lib/python3.9/site-packages/sympy/parsing/sympy_parser.py", line 1078, in parse_expr
    rv = eval_expr(code, local_dict, global_dict)
  File "/usr/share/miniconda/envs/pysb/lib/python3.9/site-packages/sympy/parsing/sympy_parser.py", line 906, in eval_expr
    expr = eval(
  File "<string>", line 1, in <module>
  File "/usr/share/miniconda/envs/pysb/lib/python3.9/site-packages/sympy/core/cache.py", line 72, in wrapper
    retval = cfunc(*args, **kwargs)
  File "/usr/share/miniconda/envs/pysb/lib/python3.9/site-packages/sympy/core/operations.py", line 64, in __new__
    raise TypeError("Relational cannot be used in %s" % cls.__name__)
TypeError: Relational cannot be used in Mul

If I use sympy<1.12, it threw SymPyDeprecationWarning but not TypeError.

Reproducibility:

  • OS: Ubuntu 22.04
  • Python version: 3.9
  • PySB version: 1.15
  • SymPy version: 1.12
@jmuhlich
Copy link
Member

jmuhlich commented Jul 5, 2023

Thanks for the report. It looks like sympy 1.12 is not released yet, but we will try to get this pysb issue fixed before then.

@jmuhlich
Copy link
Member

Addressed for now in #581, but we'll leave this issue open as a reminder to fix the underlying issue for sympy 1.12 compatibility.

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

2 participants