Skip to content

SBI Dependency Arviz Introduced Breaking Changes #1816

Closed

Description

@florianehmann

🐛 Bug Description

When you currently install the sbi package through one of the recommended ways, it will also install the dependency arviz. They recently had their 1.0.0. release and that seems to have introduced breaking changes. Notably, the arviz.data module can no longer be found.

🔄 Steps to Reproduce

  1. Follow instructions to install sbi with uv and Python3.12
  2. Minimal code example that triggers the bug: from sbi.inference import NPE
  3. Error message:
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'arviz.data'
    

✅ Expected Behavior

Would have expected import to work without error.

📌 Additional Context

...

Activity

  1. added
    bug
    on Mar 16, 2026
  2. florianehmann commented on Mar 16, 2026

    @florianehmann
    Author

    Workaround is to

    pip uninstall arviz
    pip install "arviz<1.0"
    
  3. janfb commented on Mar 16, 2026

    @janfb
    Contributor

    Hi @florianehmann, thanks for reporting this and posting a workaround 🙏

    In a recent PR we dropped the explicit dependency on arviz (now only indirectly via pymc), but we will not have any direct use of arviz anymore. Thus, in the upcoming sbi release this issue will likely be solved.

    Let's keep the issue here open until then.

  4. patelshivani2283-lab commented on Mar 22, 2026

    @patelshivani2283-lab
    Contributor

    Hi, I took a quick look into this and noticed that sbi is still importing InferenceData from arviz.data in a couple of places:

    • sbi/samplers/mcmc/pymc_wrapper.py
    • sbi/inference/posteriors/mcmc_posterior.py

    Since arviz.data was removed in ArviZ ≥1.0, this seems to be the direct cause of the error.

    I’m thinking of updating these imports to use from arviz import InferenceData (with a small fallback for older versions). Does that sound like a reasonable approach, or would you prefer handling this differently given the upcoming release?

  5. manuelgloeckler commented on Mar 23, 2026

    @manuelgloeckler
    Contributor

    Hey @patelshivani2283-lab ,

    Thanks for checking, but I cannot find any imports in

    • sbi/samplers/mcmc/pymc_wrapper.py
    • sbi/inference/posteriors/mcmc_posterior.py

    Might have been merged in/you considered a earlier version. Given that we no longer depend on arviz there should not be any import from arviz.

  6. patelshivani2283-lab commented on Mar 31, 2026

    @patelshivani2283-lab
    Contributor

    Thanks for the clarification!

    Got it — that makes sense. It seems like the issue mainly affects the current released version, where pymc still brings in arviz>=1.0.

    Maybe it could help to mention the workaround (pinning arviz<1.0) in the docs until the next release is out? Happy to help with that if needed.

  7. manuelgloeckler commented on Apr 2, 2026

    @manuelgloeckler
    Contributor

    This should be resolved with the new release which is almost done i.e. see #1718 . Will keep this issue open which contains the workaround.

  8. saithaandra-glitch commented on Aug 9, 2026

    @saithaandra-glitch

    @janfb can i work on this

  9. janfb commented on Aug 10, 2026

    @janfb
    Contributor

    Hi @saithaandra-glitch, thanks for the offer, and thanks @patelshivani2283-lab for looking into it earlier.

    This is solved. In sbi 0.27.0 we moved pymc to an optional extra, so a plain pip install sbi no longer installs arviz at all. And sbi[pymc] needs pymc>=5.28.1 on Python 3.12+, which pins arviz<1.0 itself. I checked the resolution from 3.10 to 3.12, there is no broken combination left. The arviz<1.0 workaround is only needed for 0.26.1 and older.

    So there is nothing left to change here and I am closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions