Skip to content

TypeError: data type "float128" not understood using Raspberry Pi4 #4443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andrybicio opened this issue Jan 27, 2021 · 6 comments
Closed

TypeError: data type "float128" not understood using Raspberry Pi4 #4443

andrybicio opened this issue Jan 27, 2021 · 6 comments

Comments

@andrybicio
Copy link

andrybicio commented Jan 27, 2021

Importing pym3 results in error and cannot find any type "float128". I installed everything needed onto my RaspBerry 4 using pip3.

Description of your problem

Please provide a minimal, self-contained, and reproducible example.

import pymc3 as pm

Please provide the full traceback.

TypeError                                 Traceback (most recent call last)
<ipython-input-5-4f5a3b962f49> in <module>
     11 
     12 
---> 13 import pymc3 as pm
     14 import pandas as pd
     15 import covsirphy as cs

~/.local/lib/python3.7/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 *

~/.local/lib/python3.7/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

~/.local/lib/python3.7/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

~/.local/lib/python3.7/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

~/.local/lib/python3.7/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

~/.local/lib/python3.7/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 (

~/.local/lib/python3.7/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     alltrue_elemwise,

~/.local/lib/python3.7/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

Please provide any additional information below.
I tried also

import numpy
a = numpy.float128(3)

and the output is

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-d07c2c9201f9> in <module>
      1 import numpy
----> 2 a = numpy.float128(3)

~/.local/lib/python3.7/site-packages/numpy/__init__.py in __getattr__(attr)
    218             else:
    219                 raise AttributeError("module {!r} has no attribute "
--> 220                                      "{!r}".format(__name__, attr))
    221 
    222         def __dir__():

AttributeError: module 'numpy' has no attribute 'float128'

I'm pretty sure I cannot do anything and this is something hardware related, since the OS is 32 bit, but still I'm giving it a try.

Versions and main components

  • PyMC3 Version: 3.11.0
  • Theano Version: 1.1.0
  • Python Version: 3.7.3
  • numpy Version: 1.18.5
  • Operating system: Raspbian GNU/Linux 10 (buster)
  • How did you install PyMC3: pip

in addition

uname -a

returns output

Linux raspberrypi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux
@ericmjl
Copy link
Member

ericmjl commented Jan 28, 2021

Wow! This is a first for me to see an Armv7 user of PyMC3. I have a few Pi 4s, happy to try reproducing the error on them. I’ll loop back on the weekend if nobody else does first.

@ColCarroll
Copy link
Member

Also, I am very interested in hearing about (helping with?) embedded projects, if it isn't too secret! I've seen some ML on RPi, but never MCMC.

@andrybicio
Copy link
Author

andrybicio commented Jan 28, 2021

Oh, I didn't expect so much interest 😅 I bought a Pi4 with comes with a larger RAM to exploit and try to create a cluster (I saw the "OctaPi" Raspberry project) with "dask" and do ML for university purposes. Unfortunately I had some problems with SSH connections, I think due to my Ubuntu firewall and had to give up (I'm not such an expert). Then another project came (the one linked below), where I had to use Bayesian inference and run MCMC to estimate the reproduction rate for Italy. I'm running another MChain now on my laptop (4 cores, 4chains×(1'000tune+9'000 draws)×21 regions) and it's been working the whole night. I'm only halfway, this is why I would prefer to use Raspberry, at least I can use my laptop freely in the meanwhile... However, you can take a look to my project, of course! (If you spot some errors for example due to poor inizialization of hyperparameter setting, please let me know, it would be appreciated since I'm new to this library).

My notebook, specially on this topic:
https://github.com/andrybicio/LDE_Project/blob/main/R_MCMC_Ita_Regions__Corr.ipynb

And it was inspired by a work made by:
https://github.com/micheletizzoni/covid-19

Which in turn was inspired by another American guy, that instead used R language. Really glad and surprised of your interest!

@michaelosthege
Copy link
Member

@andrybicio super cool that you're trying to run PyMC3 on a Raspberry!
I hope you're aware that you forked an outdated version of the Rtlive model? Check out https://github.com/rtcovidlive/ and particularly https://github.com/rtcovidlive/rtlive-global that already implements regional data loaders for Italy. It feeds https://Rtlive.de/global and if you want to improve the model that'll be much appreciated!

@andrybicio
Copy link
Author

andrybicio commented Jan 28, 2021

Nope, I wasn't aware I was looking at a outdated version... Thank you for letting me know! I'm experiencing some problems indeed with some regions due to instability/convergence errors, as you can see from my (trial) notebook above. I will try to implement the new version, as soon as it finishes the aforementioned run (hopefully in 7-8hs) which has been running for already 12hs. Unfortunately I am new to this library and MCMC methods for Python (I did exploit it in R, JAGS library and so on and so forth), but due to the lack of time (deadline is in 2 weeks) I'm groping around and cannot go deep too much into it. Therefore I'm trying to use things as more out-of-the box as possible, despite I'm aware it's not the best way to proceed...
By the way thank you again, I really appreciate!

@ricardoV94
Copy link
Member

ricardoV94 commented Apr 17, 2021

Should we close given: #4514 ?

@twiecki twiecki closed this as completed Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants