hddm import error - AttributeError: module 'pymc' has no attribute 'stochastic_from_dist'

377 views
Skip to first unread message

Alexei Dawes

unread,
Aug 3, 2022, 2:27:37 AM8/3/22
to hddm-users
Disclaimer: I have also posted this in pyMC Discourse. I apologise in advance if this counts as cross-posting. 

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.

Any help greatly appreciated!

The code:

!pip install scikit-learn
!pip install tensorflow-gpu==1.15 
!pip install h5py==2.10.0
!pip install cython
!pip install pymc
!pip install kabuki
!pip install git+https://github.com/hddm-devs/hddm

import hddm

The error:

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

4 frames
/usr/local/lib/python3.7/dist-packages/kabuki/utils.py in ()
310 return pm.flib.cauchy(x, 0, S) + len(x) * np.log(2)
311
→ 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’



Michael J Frank

unread,
Aug 3, 2022, 2:31:18 PM8/3/22
to hddm-...@googlegroups.com

Try changing “pip install pymc” to “pip install pymc==2.3.8”

Currently hddm relies on earlier version of pymc and we will be updating the documentation to clarify this - and ultimately upgrading the whole thing but that will take some time 

M

--
You received this message because you are subscribed to the Google Groups "hddm-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hddm-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hddm-users/da744687-abf4-4b15-a745-c12c4b91a043n%40googlegroups.com.
--
Michael J Frank, PhD | Edgar L. Marston Professor
Brown University
website 

Dengxinyi Wei

unread,
Aug 3, 2022, 2:51:04 PM8/3/22
to hddm-users
Hi, I have the same problem. I tried to install pymc 2.3.8, but it still returned error.
Screen Shot 2022-08-03 at 11.49.49 AM.png

Matt McCabe

unread,
Aug 19, 2022, 8:28:53 AM8/19/22
to hddm-users
I had the same issue with a fresh conda environment. My experience getting it to work was very messy. Figured I'd share my experience here in case it's helpful.

The first step was to downgrade to pymc==2.3.8 as suggested.

However, that created a compiler issue with Python==3.10. Downgraded Python to 3.7 and compilation went fine.

Here's where it got messy.
After compilation, hddm failed to import with error `ImportError: libmkl_rt.so.1: cannot open shared object file: No such file or directory` on line 14 of pymc.utils (i.e. importing flib). Tried to reinstall mkl, but still failed to import hddm with the same error. After some reading I thought it could be due to the default version of MKL being 2022.0.1, and hoped 2020.2 might work. Also, when running `find $CONDA_PREFIX -iname 'libmkl_rt.so*'` I found that libmkl_rt.so and  libmkl_rt.so.2 were present, but not libmkl_rt.so.1. I downgraded MKL to 2020.2, but still had the same error, and ` find $CONDA_PREFIX -iname 'libmkl_rt.so*'` showed that only libmkl_rt.so was present. I then realized my conda was v4.10, but the link I shared suggested conda v4.11 had the right libmkl. So I upgraded conda (to the most recent v4.13), then re-installed the most updated version of MKL. And now it is at least importing fine and seems to be working. If I manage to break something else, I will be reporting back :)
Reply all
Reply to author
Forward
0 new messages