wesselb / stheno

Gaussian process modelling in Python
MIT License
214 stars 18 forks source link

TypeError: __init__() got multiple values for argument 'measure' #14

Closed nipunbatra closed 3 years ago

nipunbatra commented 3 years ago

Hi @wesselb

I was having some issues with Stheno. The minimal code was failing with the error

In [1]: from stheno import GP

In [2]: f = GP(1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-47d7da13e50a> in <module>
----> 1 f = GP(1)

/usr/local/anaconda3/lib/python3.8/site-packages/plum/function.cpython-38-darwin.so in plum.function._BoundFunction.__call__()

/usr/local/anaconda3/lib/python3.8/site-packages/plum/function.cpython-38-darwin.so in plum.function.Function.__call__()

/usr/local/anaconda3/lib/python3.8/site-packages/stheno/model/gp.py in __init__(self, kernel, measure, name)
    100     @_dispatch
    101     def __init__(self, kernel, measure=None, name=None):
--> 102         self.__init__(ZeroMean(), kernel, measure=measure, name=name)
    103 
    104     @_dispatch

/usr/local/anaconda3/lib/python3.8/site-packages/plum/function.cpython-38-darwin.so in plum.function._BoundFunction.__call__()

/usr/local/anaconda3/lib/python3.8/site-packages/plum/function.cpython-38-darwin.so in plum.function.Function.__call__()

TypeError: __init__() got multiple values for argument 'measure'

I thus purged my Anaconda environment and installed Stheno again to no effect.

This is the output I get from running pip install --upgrade --upgrade-strategy eager stheno

Successfully installed algebra-1.1.0 backends-1.3.6 backends-matrix-1.1.2 
cftime-1.5.0 charset-normalizer-2.0.4 fdm-0.4.1 idna-3.2 matplotlib-3.4.3 
mlkernels-0.3.0 netCDF4-1.5.7 numpy-1.21.2 pandas-1.3.2 plum-dispatch-1.5.3 
python-slugify-5.0.2 requests-2.26.0 scipy-1.7.1 setuptools-57.4.0 sklearn-0.0 
stheno-1.1.3 text-unidecode-1.3 varz-0.7.2 wbml-0.3.4 xarray-0.19.0
wesselb commented 3 years ago

Hey @nipunbatra,

The latest update of plum-dispatch seems to have broken this. I'm very sorry! Could you try a pip install stheno plum-dispatch==1.5.2 in a fresh environment and see if that works for you?

nipunbatra commented 3 years ago

Thanks, @wesselb I can confirm that fixing plum-dispatch to 1.5.2 did the trick. Thanks so much for looking at this at such a short notice!

Would it be useful to have a accessible version attribute? (say like how Numpy does?)

In [9]: import numpy as np

In [10]: np.__version__
Out[10]: '1.21.2'

In [11]: import stheno as st

In [12]: st.__version__
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-fa81aa6e8f47> in <module>
----> 1 st.__version__

AttributeError: module 'stheno' has no attribute '__version__'

I think perhaps requiring this information via Github issue template could ensure a reporter provides all the details and thus reducing the time required for the core team.

wesselb commented 3 years ago

The latest version v1.1.5 fixes this bug and also adds stheno.__version__:

>>> import stheno

>>> stheno.__version__
'1.1.5'
wesselb commented 3 years ago

I think perhaps requiring this information via Github issue template could ensure a reporter provides all the details and thus reducing the time required for the core team.

And thanks for this suggestion! I'll indeed add that. :) (Sorry, I closed the issue too hastily!)

nipunbatra commented 3 years ago

Thanks, @wesselb I can confirm that the new version (1.1.5) works perfectly. Thanks again for the quick response.