I am encountering an issue related to the deprecation of np.bool
in NumPy version 1.20.0 and later, which seems to be affecting my PyMC3 code due to its dependency on Theano. When I try to run my script, I get the following error:
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Here is the relevant part of the stack trace:
File "C:\Users\XXX\anaconda3\Lib\site-packages\theano\scalar\basic.py", line 2412, in __init__
self.ctor = getattr(np, o_type.dtype)
I understand that this is a known issue and has been addressed in later versions of Theano. However, I am still encountering this issue and am unsure how to proceed. Here are the versions of the relevant libraries I am using:
- PyMC3: [5.9.0]
- NumPy: [1.26.0]
- ArviZ: [0.16.1]
when downgrading to numpy==1.19.5
:
Additional Issue After Downgrading NumPy
After attempting to resolve the initial issue by downgrading NumPy to version 1.19.5, I encountered another error:
AttributeError: module 'arviz' has no attribute 'from_pymc3'. Did you mean: 'from_pyro'?
Here is the relevant part of the stack trace:
File "C:\Users\XXX\anaconda3\Lib\site-packages\pymc3\sampling.py", line 639, in sample
idata = arviz.from_pymc3(trace, **ikwargs)
It seems like there might be an issue with the ArviZ version I am using (0.16.1) and its compatibility with PyMC3 version 3.11.4, particularly regarding the from_pymc3
function. I have tried to ensure that all libraries are updated to their latest versions, but this error persists.
Any insights or suggestions on how to navigate this new error while also addressing the initial np.bool
deprecation issue would be immensely helpful. Thank you again for your time and assistance!