mattjj / pybasicbayes

MIT License
153 stars 60 forks source link

Import error in cstats... #3

Closed marcel12bell closed 10 years ago

marcel12bell commented 10 years ago

I don't know why: from util.cstats import sample_crp_tablecounts ImportError: No module named cstats

perhaps form last merge?

mattjj commented 10 years ago

The cstats module is compiled from cython, and that error can happen if the module isn't built. Be sure that all submodules are cloned (git submodule update --init --recursive), then run python setup.py build_ext --inplace in the pyhsmm directory. Afterwards, check that there are cstats.so files in both pyhsmm/util/ and pyhsmm/basic/pybasicbayes/util/.

marcel12bell commented 10 years ago

worked! Thanks...

mattjj commented 10 years ago

Just noticed this issue is on pybasicbayes and not pyhsmm! The way to build cstats.so without pyhsmm is just to go into the util directory and run the setup script there.

marcel12bell commented 10 years ago

That was the point why it didn't work on my first attempt. I wanted to use it with pyhsmm and did the build in the util directory...

mattjj commented 10 years ago

There are two util directories (a bit unfortunately) in pyhsmm: one in the pyhsmm root and one in pybasicbayes. However, the pyhsmm setup script uses cythonize's globbing to recursively search for cython files, so just running that one should build everything.