jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.35k stars 589 forks source link

ImportError: No module named pyximport #135

Closed koaning closed 8 years ago

koaning commented 8 years ago

A simple pip freeze gives this;

appnope (0.1.0)
backports.shutil-get-terminal-size (1.0.0)
Cython (0.24)
decorator (4.0.9)
entrypoints (0.2.2)
gnureadline (6.3.3)
ipykernel (4.3.1)
ipython (4.2.0)
ipython-genutils (0.1.0)
ipywidgets (5.1.5)
Jinja2 (2.8)
joblib (0.9.4)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.2.2)
jupyter-console (4.1.1)
jupyter-core (4.1.0)
MarkupSafe (0.23)
mistune (0.7.2)
nbconvert (4.2.0)
nbformat (4.0.1)
networkx (1.11)
notebook (4.2.0)
numpy (1.11.0)
pexpect (4.1.0)
pickleshare (0.7.2)
pip (8.1.2)
pomegranate (0.4.0)
ptyprocess (0.5.1)
Pygments (2.1.3)
pyzmq (15.2.0)
qtconsole (4.2.1)
scipy (0.17.1)
setuptools (21.2.1)
simplegeneric (0.8.1)
terminado (0.6)
tornado (4.3)
traitlets (4.2.1)
widgetsnbextension (1.2.3)

This should include all dependencies. Yet still, when I try to import the library I get;

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-030c232bad4b> in <module>()
      3 from cytoolz import dicttoolz as dt
      4 # import grabbel.helpers as hlp
----> 5 import pomegranate as pg

/Library/Python/2.7/site-packages/pomegranate/__init__.py in <module>()
      9 import numpy as np
     10 import os
---> 11 import pyximport
     12 
     13 # Adapted from Cython docs https://github.com/cython/cython/wiki/>

ImportError: No module named pyximport

It seems like a library is missing from the dependencies. My impression was that pyximport was part of cython but even with the most recent version I keep getting this error on a fresh virtualenv.

koaning commented 8 years ago

This issue can be closed. This is a textbook of example of conda and pip not always playing nice.

For other people with the same issue; check if from the command line import cython works. If it doesn't it may be an indication of paths being wrong someplace. Something else to note is that the jupyer notebook sometimes picks the wrong kernel. If you start a notebook from a python3 virtualenv, jupyer may still try to start a python2 notebook.

jmschrei commented 8 years ago

Excellent, glad I could be of assistance.