mattjj / pyhsmm

MIT License
546 stars 173 forks source link

Can't import pyhsmm on Mac OSX 10.9.3 #24

Closed sandeepklr closed 10 years ago

sandeepklr commented 10 years ago

I managed to build the pyhsmm package on Mac OSX 10.9.3, however when I try and import pyhsmm in ipython, this is the error I get. Any pointers or advice will be really helpful. Is this because I am using an incompatible version of numpy(1.6.2)?

import pyhsmm
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-ec224aa46867> in <module>()
----> 1 import pyhsmm    

/Users/sandeepklr/Downloads/pyhsmm/__init__.py in <module>()
      1 # __all__ = something
----> 2 import models
      3 import basic
      4 import basic.distributions as distributions # shortcut
      5 import plugins    

/Users/sandeepklr/Downloads/pyhsmm/models.py in <module>()
     10         ModelEM, ModelMAPEM, ModelMeanField, ModelMeanFieldSVI
     11 import basic.distributions
---> 12 from internals import hmm_states, hsmm_states, hsmm_inb_states, \
     13         initial_state, transitions
     14 import util.general    

/Users/sandeepklr/Downloads/pyhsmm/internals/transitions.py in <module>()
     13         MultinomialAndConcentration
     14 from ..util.general import rle, count_transitions, cumsum, rcumsum
---> 15 from ..util.cstats import sample_crp_tablecounts
     16 
     17 # TODO separate out bayesian and nonbayesian versions?    

/Users/sandeepklr/Downloads/__init__.pxd in init pyhsmm.util.cstats (util/cstats.c:26280)()    

ValueError: numpy.dtype has the wrong size, try recompiling
mattjj commented 10 years ago

I haven't tested with numpy 1.6.2 recently (I'm on 1.8.1), but I can't think of anything that would cause an error like that due to different versions. The setup.py script includes the numpy headers based on the numpy that python imports.

Maybe the numpy headers that were used when the code was built are different from the numpy library that is being loaded in ipython. Do you have two different python installations on your system? You might try running python (rather than ipython) and importing to see if it makes a difference.

sandeepklr commented 10 years ago

Actually, that did make a difference. For some reason that I haven't figured out yet, ipython imports an older version of numpy(1.6.0) from somewhere. However, putting it in a script and running it did import the right version of numpy that I have installed(1.8.0). Thanks for your prompt answer.