pymc-devs / pymc

Bayesian Modeling and Probabilistic Programming in Python
https://docs.pymc.io/
Other
8.7k stars 2.01k forks source link

Float type 'float128' causes issues and is unnecessary #4513

Closed anentropic closed 3 years ago

anentropic commented 3 years ago

I spent a while getting all the prerequisites in place via homebrew and pip, but was able to apparently install pymc3 successfully:

Successfully installed arviz-0.11.2 cftime-1.4.1 cycler-0.10.0 dill-0.3.3 fastprogress-1.0.0 filelock-3.0.12 matplotlib-3.3.4 netcdf4-1.5.6 pandas-1.2.3 patsy-0.5.1 pillow-8.1.2 pymc3-3.11.1 python-dateutil-2.8.1 pytz-2021.1 six-1.15.0 theano-pymc-1.1.2 typing-extensions-3.7.4.3 xarray-0.17.0

However I get an error on import:

In [1]: import pymc3 as pm

TypeError                                 Traceback (most recent call last)
<ipython-input-1-2e5c536b7c65> in <module>
----> 1 import pymc3 as pm

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/__init__.py in <module>
     39 __set_compiler_flags()
     40 
---> 41 from pymc3 import gp, ode, sampling
     42 from pymc3.backends import load_trace, save_trace
     43 from pymc3.backends.tracetab import *

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/gp/__init__.py in <module>
     14 
     15 from pymc3.gp import cov, mean, util
---> 16 from pymc3.gp.gp import TP, Latent, LatentKron, Marginal, MarginalKron, MarginalSparse

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/gp/gp.py in <module>
     23 import pymc3 as pm
     24 
---> 25 from pymc3.distributions import draw_values
     26 from pymc3.gp.cov import Constant, Covariance
     27 from pymc3.gp.mean import Zero

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/distributions/__init__.py in <module>
     13 #   limitations under the License.
     14 
---> 15 from pymc3.distributions import shape_utils, timeseries, transforms
     16 from pymc3.distributions.bart import BART
     17 from pymc3.distributions.bound import Bound

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/distributions/timeseries.py in <module>
     19 from theano import scan
     20 
---> 21 from pymc3.distributions import distribution, multivariate
     22 from pymc3.distributions.continuous import Flat, Normal, get_tau_sigma
     23 from pymc3.distributions.shape_utils import to_tuple

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/distributions/multivariate.py in <module>
     33 
     34 from pymc3.distributions import transforms
---> 35 from pymc3.distributions.continuous import ChiSquared, Normal
     36 from pymc3.distributions.dist_math import bound, factln, logpow
     37 from pymc3.distributions.distribution import (

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/distributions/continuous.py in <module>
     28 
     29 from pymc3.distributions import transforms
---> 30 from pymc3.distributions.dist_math import (
     31     SplineWrapper,
     32     betaln,

~/Documents/Dev/myproject/.venv/lib/python3.9/site-packages/pymc3/distributions/dist_math.py in <module>
     47 if platform.system() in ["Linux", "Darwin"]:
     48     _beta_clip_values["float128"] = (
---> 49         np.nextafter(0, 1, dtype="float128"),
     50         np.nextafter(1, 0, dtype="float128"),
     51     )

TypeError: data type 'float128' not understood

Versions and main components

twiecki commented 3 years ago

Thanks for the report. I did some quick googling at it seems that doing anything with float128 is basically pointless (e.g. https://stackoverflow.com/questions/29820829/cannot-use-128bit-float-in-python-on-64bit-architecture) so I'm not sure why that's even in here but can probably be removed/changed.