Struggling to import HDDM - AttributeError: module 'pymc' has no attribute 'stochastic_from_dist'

I’m trying to import HDDM to do drift diffusion modelling for a psychology reaction time experiment.

I’m getting the following AttributeError irrespective of whether I try to install pymc and import hddm on Google Colab OR locally (macOS Monterey v12.1; python version 3.9.12) on JupyterLab desktop.

The code:

!pip install scikit-learn
!pip install tensorflow-gpu==1.15 # tf 1.15 ~ 4 times faster (feel free to test this out)
!pip install h5py==2.10.0
!pip install cython
!pip install pymc
!pip install kabuki
!pip install -U --no-deps git+

import hddm

The error:

AttributeError Traceback (most recent call last)
in ()
7 #
----> 8 import hddm
10 # Make simulators visible

4 frames
/usr/local/lib/python3.7/dist-packages/kabuki/ in ()
310 return pm.flib.cauchy(x, 0, S) + len(x) * np.log(2)
→ 312 HalfCauchy = pm.stochastic_from_dist(name=“Half Cauchy”,
313 random=centered_half_cauchy_rand,
314 logp=centered_half_cauchy_logp,

AttributeError: module ‘pymc’ has no attribute ‘stochastic_from_dist’

HDDM depends on pymc v2, which you need to install via

pip install pymc==2.3.8

I am also trying to use pymc for HDDM and am having the same issue as @alexeijoel. When I attempt to install version 2.3.8, I get the following error:

ERROR: Failed building wheel for pymc

and then ultimately:

error: legacy-install-failure

Am I doing something wrong? Are there any other steps I should take? Any help would be appreciated. Thanks

I’m having the same issue. I’m trying to import hddm, and get the error AttributeError: module ‘pymc’ has no attribute ‘stochastic_from_dist’

When I try to install pymc 2.3.8 as suggested here, I’m getting the ERROR: Failed building wheel for pymc followed by a bunch of errors.

Has this been resolved?

My guess is you have a version of python that is too new to support pymc 2.x. The 2.3.8 release from 2020 is a patch release to warn users about the upcoming major version. Development of pymc 2.x stopped in 2015. You can see the whole release history (excluding 3.x versions) at pymc · PyPI.

I very strongly recommend you update to PyMC 5.x if possible, otherwise try a python version that was available already around 2015

The issue is the the HDDM project still requires pymc==2.3.8. Those wishing to use an up-to-date version of python (and PyMC) should open an issue on the HDDM repository and ask the maintainers to update the package accordingly.