Error when importing hddm

155 views
Skip to first unread message

Selin Topel

unread,
Apr 12, 2023, 2:19:20 PM4/12/23
to hddm-users
Dear all, 

I have been struggling with the installation and importing the hddm package on a work laptop. I am using Anaconda (also tried colab, IPython, Jupyter, Spyder), and every time, I get an error message about numpy after "import hddm" command. I tried different things like reinstalling numpy, changing the versions, reinstalling Anaconda, installing hddm in environments with python 3.7 and 3.8. Some examples of the error messages are as follows: "DLL load failed while importing _multiarray_umath: The specified module could not be found.", "numpy.core.multiarray failed to import". I also tried to define the path in the system environment but this did not change anything. The last error I got is the following:

import hddm
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 import hddm

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\hddm\__init__.py:7
      3 __docformat__ = "restructuredtext"
      5 __version__ = "0.9.8"
----> 7 from . import simulators
      8 from . import likelihoods
      9 from . import likelihoods_mlp

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\hddm\simulators\__init__.py:2
      1 # from .drift_functions import *
----> 2 from ssms.basic_simulators.boundary_functions import *
      3 from ssms.basic_simulators.drift_functions import *
      5 # from .boundary_functions import *

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\ssms\__init__.py:3
      1 __version__ = "0.2.0"
----> 3 from . import basic_simulators
      4 from . import dataset_generators
      5 from . import config

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\ssms\basic_simulators\__init__.py:1
----> 1 from .boundary_functions import *
      2 from .drift_functions import *
      3 from .simulator import *

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\ssms\basic_simulators\boundary_functions.py:3
      1 # External
      2 # import scipy as scp
----> 3 from scipy.stats import gamma
      4 import numpy as np
      7 # Collection of boundary functions
      8
      9
     10 # Constant: (multiplicative)

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\stats\__init__.py:388
      1 """
      2 .. _statsrefmanual:
      3
   (...)
    386
    387 """
--> 388 from .stats import *
    389 from .distributions import *
    390 from .morestats import *

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\stats\stats.py:174
    171 import numpy as np
    172 from numpy import array, asarray, ma
--> 174 from scipy.spatial.distance import cdist
    175 from scipy.ndimage import measurements
    176 from scipy._lib._util import (_lazywhere, check_random_state, MapWrapper,
    177                               rng_integers)

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\spatial\__init__.py:102
    100 from ._plotutils import *
    101 from ._procrustes import procrustes
--> 102 from ._geometric_slerp import geometric_slerp
    104 __all__ = [s for s in dir() if not s.startswith('_')]
    105 __all__ += ['distance', 'transform']

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\spatial\_geometric_slerp.py:8
      5 import warnings
      7 import numpy as np
----> 8 from scipy.spatial.distance import euclidean
     11 def _geometric_slerp(start, end, t):
     12     # create an orthogonal basis using QR decomposition
     13     basis = np.vstack([start, end])

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\spatial\distance.py:121
    119 from . import _hausdorff
    120 from ..linalg import norm
--> 121 from ..special import rel_entr
    124 def _args_to_kwargs_xdist(args, kwargs, metric, func_name):
    125     """
    126     Convert legacy positional arguments to keyword arguments for pdist/cdist.
    127     """

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\special\__init__.py:636
    633 from . import _ufuncs
    634 from ._ufuncs import *
--> 636 from . import _basic
    637 from ._basic import *
    639 from ._logsumexp import logsumexp, softmax, log_softmax

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\special\_basic.py:16
     12 from ._ufuncs import (mathieu_a, mathieu_b, iv, jv, gamma,
     13                       psi, hankel1, hankel2, yv, kv, ndtri,
     14                       poch, binom, hyp0f1)
     15 from . import specfun
---> 16 from . import orthogonal
     17 from ._comb import _comb_int
     20 __all__ = [
     21     'ai_zeros',
     22     'assoc_laguerre',
   (...)
     90     'zeta'
     91 ]

File ~\AppData\Local\anaconda3\envs\ddm\lib\site-packages\scipy\special\orthogonal.py:79
     73 #
     74 # Author:  Travis Oliphant 2000
     75 # Updated Sep. 2003 (fixed bugs --- tested to be accurate)
     76
     77 # SciPy imports.
     78 import numpy as np
---> 79 from numpy import (exp, inf, pi, sqrt, floor, sin, cos, around, int,
     80                    hstack, arccos, arange)
     81 from scipy import linalg
     82 from scipy.special import airy

ImportError: cannot import name 'int' from 'numpy' (C:\Users\topels\AppData\Local\anaconda3\envs\ddm\lib\site-packages\numpy\__init__.py)

I figured it must be something simple but I have been stuck at this step for the last three days so I would appreciate any help. 

Thank you!

Selin

Kar-Wai Tang

unread,
Apr 13, 2023, 7:54:15 AM4/13/23
to hddm-users
Hi Selin

Was in the exact same position a week ago.
From what I gather, the installation is problematic due to non-maintained packages, which I think are being updated but will take time. 

I got things to work using docker HDDM - link. There are various threads about it in this group. 

Hope this solves it!

Best regards
Kar-Wai
Reply all
Reply to author
Forward
0 new messages