pomegranate: pip install error
Hi, When I try to install via pip (clean virtualenvs, trying both python 2.7 and 3.5) I get the follow exception upon import:
(env_pomegranate-p3.5)tacos:projects richard$ python
Python 3.5.1 (default, Dec 7 2015, 21:59:10)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pomegranate import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/richard/projects/env_pomegranate-p3.5/lib/python3.5/site-packages/pomegranate/__init__.py", line 38, in <module>
from .hmm import *
File "pomegranate/hmm.pyx", line 1, in init pomegranate.hmm (pomegranate/hmm.c:53522)
File "pomegranate/distributions.pxd", line 9, in init pomegranate.base (pomegranate/base.c:22884)
File "pomegranate/distributions.pyx", line 1, in init pomegranate.distributions (pomegranate/distributions.c:67644)
ImportError: No module named 'pomegranate.utils'
Indeed, when I look in site-packages/pomegranate, there isn’t a utils.so shared library included. In contrast, when I checkout and build from source, utils.so is compiled and the importing works fine.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (6 by maintainers)
FYI: I had the same issue with
When installing on a conda environment. As suggested it was fixed with
ok, I just cloned the repo and installed, that works.
My suspicion is that occasionally, for whatever reason,
utils.so(or one of the other library files) will fail to compile during installation. However, it must be some odd edge case, because I just tried about a dozen times and it succeeded for all of them.Moreover, I think the reason that uninstalling and reinstalling sometimes doesn’t work is that pip will bundle the compiled libraries into a wheel and store that wheel file in a local cache. The first time I ran into this problem, when I examined the wheel file it didn’t have the
utils.solibrary. But since the malformed wheel was cached, uninstalling and reinstalling just restored that same bad set of libraries. I even tried creating new virtualenv environments, but since the wheel cache was located outside of the virtualenv path, the problem continued.So in case someone else runs into this problem, and uninstalling/reinstalling doesn’t help, I suggest also trying to track down and delete and wheel files that might be cached. On my Mac, I was able to find where pip hides that file:
Unfortunately, this is one of those edge cases that are really annoying. I’ve tried to reproduce the error state, but it has compiled successfully ever time since. I agree with @danstowell that it might be a subtle dependency or order-of-compilation corner-case, but I don’t really know what to do to nail it down when it is so transient.