1

I have libbz2-dev installed however I am still getting the following import error while importing gensim :

>>> import gensim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/krishna/gensimenv/lib/python2.7/site-packages/gensim/__init__.py", line 6, in <module>
    from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization
  File "/home/krishna/gensimenv/lib/python2.7/site-packages/gensim/corpora/__init__.py", line 14, in <module>
    from .wikicorpus import WikiCorpus
  File "/home/krishna/gensimenv/lib/python2.7/site-packages/gensim/corpora/wikicorpus.py", line 21, in <module>
    import bz2
ImportError: No module named bz2
1

2 Answers 2

1

I'm having the same issue and the tip above didn't resolve it. Perhaps before creating the virtual env you need to:

sudo apt-get install libbz2-dev

related: missing python bz2 module

Sign up to request clarification or add additional context in comments.

Comments

0

you can try to do

pip install bz2file

1 Comment

i did try that did not work. I had to reinstall python recreate virtualenv and it got resolved. Still don't know what might have caused it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.