AttributeError: module 'arviz' has no attribute 'geweke'

Still seems to be an issue:

conda create -n pymc3 -c conda-forge python=3.8.8
conda activate pymc3
conda install pandas seaborn arviz pymc3 jupyter

still getting

$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymc3 as pm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hartlc/anaconda3/envs/pymc3/lib/python3.8/site-packages/pymc3/__init__.py", line 13, in <module>
    from .stats import *
  File "/home/hartlc/anaconda3/envs/pymc3/lib/python3.8/site-packages/pymc3/stats/__init__.py", line 32, in <module>
    geweke = map_args(az.geweke)
AttributeError: module 'arviz' has no attribute 'geweke'
>>> 

Allen’s post (AttributeError: module 'arviz' has no attribute 'geweke' - #13 by AllenDowney) worked – one has to downgrade to arviz 0.11.0

Your install line is missing -c conda-forge

3 Likes

I was under the impression that if you created an environment and specified extra channels, they would be used for subsequent installs as well. I suppose this is not the case.

You need to configure that explicitly for conda forge to be used by default, setting it when creating the environment does not do the trick. Conda forge docs have some guidance on that: Tips & tricks — conda-forge 2021.04.27 documentation

Hi, new to the forum. I had quite a bit of trouble installing PyMC3 on my machine yesterday and today. I am using conda 4.10.1 on a mac (10.15.7).

I followed the install instructions:
conda install -c conda-forge pymc3
just importing the library gave me an error, then I did what AllenDowney suggested and I can confirm that worked! (thanks so much!).

I know it is not possible to test against every base OS, but is it perhaps possible to at least publish the versions that work with a specific conda release? My (limited) understanding is that arviz is bound to a specific version of pymc3. Is that published somewhere?

On a second note at the homepage there is this function:
X, y = linear_training_data()
when you copy and paste it just to see if you have a working install, it bombs. Perhaps we could put a very small test dataset in the install so a function like this works out of the box?

Thanks so much for this thread everyone! I know I could not have gotten this installed without the ideas here! thanks so much!

This has nothing to do with the conda version. It is related to the python version. The latest pymc3, numpy, pandas, matplotlib, scipy… no longer support python 3.6 whereas latest ArviZ does (for now, we haven’t yet gotten to the drop py3.6 release but it should happen in the next release), and latest ArviZ is compatible with latest pymc3 which is what we test. The problem is that as the latest pymc3 doesn’t support python 3.6, the default installation for python 3.6 is an old pymc3 with the latest arviz which doesn’t work.

This is why my first recommendation was to upgrade the python version in order to be able to use latest versions of both pymc3 and arviz. Only if this is not possible I would then downgrade arviz, because in keeping python 3.6 you are renouncing to all updates of the scientific python ecosystem.

Then there is also an issue with conda not wanting to install latest pymc3 even if using a python version that is compatible with it which I sincerely have no idea why it happens and it clearly should not but ends up having the same effect (but the root causes are completely unrelated afaik) as it seems from other answers in the thread that it has no problems installing latest arviz :man_shrugging:

The bound is not with specific versions but with ranges and we are continuously working to get these ranges to be wider every time. There is therefore no document that does exactly what you ask, but the requirements.txt in pymc3 is always updated to make sure it has a correct lower bound. Therefore, if you go to pymc3/requirements.txt at master · pymc-devs/pymc3 · GitHub and then select the PyMC3 version you are interested in from the branch dropdown (all versions are tagged and accessible from the “tag” tab) you’ll see something like:

arviz>=0.9.0    # taken from v3.10.0 tag

which means that 0.9.0 is an arviz version compatible with pymc3 3.10.0. Follow up versions will probably be compatible too (in this particular case, I think 0.11.0 is still compatible with 3.10) but there are no guarantees anymore. By the time arviz 0.10.0 is released, maybe pymc3 has already released 3.11.0 and 0.10.0 is therefore tested against it and is never tested against 3.10.0

This is a great idea, can you open an issue for that on github?

Done! Thanks so much for your help!

I rebuilt all of the affected conda-forge packages for pymc3. They should all now install a compatible version of arviz so that this “geweke” import error no longer occurs.

1 Like