You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Follow instructions to install sbi with uv and Python3.12
Minimal code example that triggers the bug: from sbi.inference import NPE
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
...
Reacted by manuelgloeckler, Shamik and Brian Groenke
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.
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?
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.
Activity
florianehmann commentedon Mar 16, 2026
Workaround is to
janfb commentedon Mar 16, 2026
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
sbirelease this issue will likely be solved.Let's keep the issue here open until then.
patelshivani2283-lab commentedon Mar 22, 2026
Hi, I took a quick look into this and noticed that
sbiis still importingInferenceDatafromarviz.datain a couple of places:sbi/samplers/mcmc/pymc_wrapper.pysbi/inference/posteriors/mcmc_posterior.pySince
arviz.datawas 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?manuelgloeckler commentedon Mar 23, 2026
Hey @patelshivani2283-lab ,
Thanks for checking, but I cannot find any imports in
sbi/samplers/mcmc/pymc_wrapper.pysbi/inference/posteriors/mcmc_posterior.pyMight 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.
patelshivani2283-lab commentedon Mar 31, 2026
Thanks for the clarification!
Got it — that makes sense. It seems like the issue mainly affects the current released version, where
pymcstill brings inarviz>=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.manuelgloeckler commentedon Apr 2, 2026
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.
saithaandra-glitch commentedon Aug 9, 2026
@janfb can i work on this
janfb commentedon Aug 10, 2026
Hi @saithaandra-glitch, thanks for the offer, and thanks @patelshivani2283-lab for looking into it earlier.
This is solved. In
sbi0.27.0 we movedpymcto an optional extra, so a plainpip install sbino longer installsarvizat all. Andsbi[pymc]needspymc>=5.28.1on Python 3.12+, which pinsarviz<1.0itself. I checked the resolution from 3.10 to 3.12, there is no broken combination left. Thearviz<1.0workaround is only needed for 0.26.1 and older.So there is nothing left to change here and I am closing it.