1

I found different links that answers this problem but it does not work

what seems to be the problem? from pip freeze:

pyLDAvis==3.3.1

from code:

import pyLDAvis
import pyLDAvis.gensim_models as gensim_vis

error:

File "my_py.py", line 2, in <module>
import pyLDAvis.gensim_models as gensim_vis
ModuleNotFoundError: No module named 'pyLDAvis.gensim_models'
Led
  • 662
  • 1
  • 19
  • 41

2 Answers2

2

If you are working in jupyter notebook (python vs3.3.0) "the No module named ‘pyLDAvis.gensim’" error can be solved by using:

      import pyLDAvis.gensim_models
Gjuri
  • 61
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 02 '21 at 22:55
  • It does fix the problem ... but why do you have to explicitly import it and `import pyLDAvis` is not sufficient? – robertspierre Sep 29 '22 at 20:18
1

I had the same problem. This worked for me:

    !pip install pyLDAvis==3.3.1

And then do:

    import pyLDAvis.gensim_models
Dhaval Rao
  • 11
  • 2