I’m attempting to run code from the “Linear Regression” section of the pymc_overview page on the pymc.io site, and I’m running into an error I’m uncertain of how to resolve. When I run the following code:
with basic_model:
# draw 1000 posterior samples
idata = pm.sample()
I receive the following error:
ContextualVersionConflict: (xarray 0.20.1 (c:\programdata\anaconda3\lib\site-packages), Requirement.parse(‘xarray>=0.21.0’), {‘arviz’})
When I check the version of xarray, either from within the Jupyter notebook or via the command line with pip, my version of xarray comes back as “2023.2.0”, which would seem to satisfy the requirements stated in the requirement parse. Any help in fixing would be appreciated.
1 Like
Welcome!
Could you provide the result of running conda list
in the environment you are using?
It looks like you installed pymc via pip. It’s strongly recommended that you use the provided installation instructions (which use conda). If it’s not too much trouble, you might try creating a new environment and installing pymc in it to see if the issue goes away. I’m not 100% confident that it will, but there are other good reasons to prefer a conda installation (and your error does seem like it’s likely an installation issue).
1 Like
Heh, as it turns out we were thinking along the same lines. I was actually just preparing to post a comment along these lines. So I did create an environment in conda and added PyMC that way and it appears to have resolved the issue. Not sure if this is related or not, but when I installed PyMC this way the version of xarray is “2022.11.0”, which is slightly older than what I had with my previous installation. In any case, it appears to be running fine now. Thank you for all your help! Very much appreciated.
1 Like