Skip to content

BUG: ImportError: cannot import name 'RNGConsumerOp' from 'pytensor.tensor.random.op' #7867

@maresb

Description

@maresb

Describe the issue:

This was caused by the accidental publication of a broken PyMC package on conda-forge.

Solution:

conda update pytensor

Ref: #7820 (comment)

Reproduceable code example:

conda install -c conda-forge pymc "pytensor==2.31.2"
python -c "import pymc"

Error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import pymc
  File "/opt/conda/lib/python3.13/site-packages/pymc/__init__.py", line 50, in <module>
    from pymc import _version, gp, ode, sampling
  File "/opt/conda/lib/python3.13/site-packages/pymc/gp/__init__.py", line 17, in <module>
    from pymc.gp import cov, mean, util
  File "/opt/conda/lib/python3.13/site-packages/pymc/gp/cov.py", line 52, in <module>
    from pymc.pytensorf import constant_fold
  File "/opt/conda/lib/python3.13/site-packages/pymc/pytensorf.py", line 44, in <module>
    from pytensor.tensor.random.op import RandomVariable, RNGConsumerOp
ImportError: cannot import name 'RNGConsumerOp' from 'pytensor.tensor.random.op' (/opt/conda/lib/python3.13/site-packages/pytensor/tensor/random/op.py)

PyMC version information:

PyMC v5.25.0
PyTensor <2.31.7
Installed via conda-forge
All platforms

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions