import gensim imports a file in an active module, not the root site-packages folder
Question: I'm running Anaconda Python 2.7 on Windows. I've installed gensim and pyLDAvis
to do some topic modeling. (Note installing pyLDAvis on python 2.7 in windows
is a little tricky as you have to make sure you are not using scikit-bio which
doesn't appear to compile on Windows 2.7... I think I have a workaround for
this, but I can't try it because of reasons to be outlined below!)

So I got pyLDAvis to install. However when running, it seems to have a problem
with an import statement.

pyLDAvis is installed in this folder....

    
    
    C:\Anaconda2\Lib\site-packages\pyLDAvis-1.3.2-py2.7.egg\pyLDAvis
    

`sys.path` returns this:

    
    
    ['',
    'C:\\Anaconda2\\lib\\site-packages\\pyldavis-1.3.2-py2.7.egg',
    'C:\\Anaconda2\\lib\\site-packages\\joblib-0.9.3-py2.7.egg',
    'C:\\Anaconda2\\python27.zip',
    'C:\\Anaconda2\\DLLs',
    'C:\\Anaconda2\\lib',
    'C:\\Anaconda2\\lib\\plat-win',
    'C:\\Anaconda2\\lib\\lib-tk',
    'C:\\Anaconda2',
    'C:\\Anaconda2\\Library\\bin',
    'c:\\anaconda2\\lib\\site-packages\\sphinx-1.3.1-py2.7.egg',
    'c:\\anaconda2\\lib\\site-packages\\setuptools-18.4-py2.7.egg',
    'C:\\Anaconda2\\lib\\site-packages',
    'C:\\Anaconda2\\lib\\site-packages\\cryptography-1.0.2-py2.7-win-amd64.egg',
    'C:\\Anaconda2\\lib\\site-packages\\win32',
    'C:\\Anaconda2\\lib\\site-packages\\win32\\lib',
    'C:\\Anaconda2\\lib\\site-packages\\Pythonwin',
    'C:\\Anaconda2\\lib\\site-packages\\IPython\\extensions']
    

What is happening is that when I try to run `pyLDAvis`, the library calls
`import gensim`. However, `gensim` is both a folder in the `site-packages` and
a file (`gensim.py`) inside `pyLDAvis`.

So when python tries to `import gensim` inside the `pyLDAvis` module, it
imports the `gensim.py` file within the `pyLDAvis` module, not the
``gensim`folder inside`site-packages`.

How do I go about fixing this?

Thanks.


Answer: File an issue report on [pyLDAvis's
GitHub](https://github.com/bmabey/pyLDAvis/issues). It looks like a [recent
change](https://github.com/bmabey/pyLDAvis/commit/848b247b77bb24b1e674aa0cf7c0d5f9b4f26a9d)
broke Python 2 compatibility by assuming Python 3 absolute import behavior for
`import gensim`.

In the meantime, I believe the bug isn't present in the 1.3.1 release, so you
could use that. Alternatively, you could edit `pyLDAvis/gensim.py` and add
`from __future__ import absolute_import` at the top. That'd _probably_ work as
a temporary fix, but I didn't try it.

