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

That command worked for me. Thank you very much!

really thanks it’s working

pymc3=3.9.3; arviz=0.11.2. Same problem. Solution suggested by Allen worked. Might be good to sort this out in the package repo.

This is already sorted out in the newer releases (in fact, this was never broken with the latest releases of the two packages, we already have extensive testing for that, but it’s not possible to test all old versions) and we can’t go back to already released versions of the packages to edit their requirements. I don’t think there is anything else we can do, if there were please let us know and/or volunteer and help us do it.

Fresh conda environment → conda install pymc3 → immediately get the above problem. Solution suggested by Allen did NOT work for me (instead my kernel dies as soon as I try to import pymc3). python=3.8.8; pymc3=3.8; arviz = 0.11.0 (after downgrade)

conda create -n myenv -c conda-forge
conda activate myenv
conda install pymc3 -c conda-forge

Remember to use conda-forge channel.

2 Likes

That did the trick - thank you @ahartikainen !

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 https://github.com/pymc-devs/pymc3/blob/master/requirements.txt 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

I’ve tried to create a new fresh environment in Windows 10, but even by using conda-forge channel, it seems that current distribution is not setting theano properly.

My attempt here was very simple, installation was performed by running:

conda create -n env_pymc3 -c conda-forge pymc3 ipython

As soon as I import theano or pymc3, i get the following warning related to blas setup.

In [1]: import pymc3
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

Then sampling runs very slowly. Any hint on how to setup the current version of theano/pymc3 appropriately in Windows 10?

I think you need to install compiler

conda install m2w64-toolchain -c msys2

I’ve tried now to install it with the following conda commands in Windows 10:

conda create -n env_stats -y
conda activate env_stats 
conda install m2w64-toolchain -c msys2  -y
conda install -c conda-forge pymc3 ipython -y 
ipython

Warning persists, after importing pymc3:

In [1]: import pymc3
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

Any more hints?

Oh, I think I forgot the libpython

conda install libpython -c conda-forge

(I think it actually uses the default channel, but adding conda-forge channel there keeps everything else as is)

Still not there. Strangely, warning persists.

conda create -n env_stats -y
conda activate env_stats 
conda install m2w64-toolchain -c msys2  -y
conda install libpython -c conda-forge -y
conda install pymc3 ipython -c conda-forge -y 
ipython
In [1]: import pymc3
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

What else could I be missing? Annoying warning, indeed. Should I lock to some specific version of python or any of dependency packages? I think conda-forge was working seamlessly for some of the previous versions of pymc3/theano, but it seems that there is this issue in current versions.