pymc-devs / pymc-devs/pytensor

BUG: Tests fail: ValueError: The tag 'local_0_dot_x' is already present in the database

Open
#355 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs info
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Describe the issue:
============================================================================================================ ERRORS ============================================================================================================
_____________________________________________________________________________________ ERROR collecting pytensor/misc/elemwise_time_test.py _____________________________________________________________________________________
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:972: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:972: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:850: in exec_module
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:2674: in <module>
    local_one_plus_erf = PatternNodeRewriter(
pytensor/graph/rewriting/basic.py:1570: in __init__
    from pytensor.graph.rewriting.unify import convert_strs_to_vars
pytensor/graph/rewriting/unify.py:19: in <module>
    from etuples import apply, etuple, etuplize
/usr/local/lib/python3.9/site-packages/etuples/__init__.py:2: in <module>
    from .core import etuple
/usr/local/lib/python3.9/site-packages/etuples/core.py:343: in <module>
    def etuple(*args, **kwargs):
/usr/local/lib/python3.9/site-packages/multipledispatch/core.py:68: in _
    dispatcher.add(types, func, on_ambiguity=on_ambiguity)
/usr/local/lib/python3.9/site-packages/multipledispatch/dispatcher.py:133: in add
    raise TypeError("Tried to dispatch on non-type: %s\n"
E   TypeError: Tried to dispatch on non-type: [<class 'object'>]
E   In signature: <[<class 'object'>]>
E   In function: etuple
__________________________________________________________________________________________ ERROR collecting tests/test_breakpoint.py ___________________________________________________________________________________________
tests/test_breakpoint.py:3: in <module>
    from pytensor.breakpoint import PdbBreakpoint
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
____________________________________________________________________________________________ ERROR collecting tests/test_config.py _____________________________________________________________________________________________
tests/test_config.py:8: in <module>
    from pytensor import configdefaults, configparser
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
___________________________________________________________________________________________ ERROR collecting tests/test_gradient.py ____________________________________________________________________________________________
tests/test_gradient.py:6: in <module>
    import pytensor
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
____________________________________________________________________________________________ ERROR collecting tests/test_ifelse.py _____________________________________________________________________________________________
tests/test_ifelse.py:7: in <module>
    import pytensor
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
___________________________________________________________________________________________ ERROR collecting tests/test_printing.py ____________________________________________________________________________________________
tests/test_printing.py:11: in <module>
    import pytensor
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
___________________________________________________________________________________________ ERROR collecting tests/test_raise_op.py ____________________________________________________________________________________________
tests/test_raise_op.py:5: in <module>
    import pytensor
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
______________________________________________________________________________________________ ERROR collecting tests/test_rop.py ______________________________________________________________________________________________
tests/test_rop.py:18: in <module>
    import pytensor
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
____________________________________________________________________________________________ ERROR collecting tests/test_updates.py ____________________________________________________________________________________________
tests/test_updates.py:3: in <module>
    import pytensor
pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
pytensor/tensor/__init__.py:112: in <module>
    import pytensor.tensor.rewriting
pytensor/tensor/rewriting/__init__.py:11: in <module>
    import pytensor.tensor.rewriting.math
pytensor/tensor/rewriting/math.py:161: in <module>
    def local_0_dot_x(fgraph, node):
pytensor/tensor/rewriting/basic.py:166: in register_stabilize
    compile.optdb["stabilize"].register(
pytensor/graph/rewriting/db.py:339: in register
    super().register(name, rewriter, *tags, **kwargs)
pytensor/graph/rewriting/db.py:71: in register
    raise ValueError(f"The tag '{name}' is already present in the database.")
E   ValueError: The tag 'local_0_dot_x' is already present in the database.
======================================================================================================= warnings summary =======================================================================================================
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
../../../../../local/lib/python3.9/site-packages/multipledispatch/core.py:79
  /usr/local/lib/python3.9/site-packages/multipledispatch/core.py:79: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
    spec = inspect.getargspec(func)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 9 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================================ 8 warnings, 9 errors in 10.00s ================================================================================================
Reproducable code example:
pytest .
Error message:
See above.
PyTensor version information:

2.12.3

Context for the issue:

Python-3.9
FreeBSD 13.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pytensor/tensor/rewriting/math.py at the local_0_dot_x definition and trace registration into pytensor/graph/rewriting/db.py. Reproduce the import-collection failures shown in pytensor/misc/elemwise_time_test.py and the listed tests, then identify why the tag is registered twice. Done means the affected tests collect and run without the duplicate-tag ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.