0

My virtualenv doesn't have the bz2 lib for whatever reason. I know I have bz2 becuase the system python can import it, how come my newly created virtualenv doesn't get it?

$ mkvirtualenv sentry
$ python -c "import bz2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named bz2
$ deactivate
$ python -c "import bz2"

I also tried to recompile python into the virtualenv directory, but it didn't seem to work.

Kit Sunde
  • 35,972
  • 25
  • 125
  • 179
  • 2
    This might help you: http://stackoverflow.com/questions/812781/pythons-bz2-module-not-compiled-by-default – Weetu Mar 02 '12 at 07:43

2 Answers2

1

If you can actually import bz2 try to explicitly create a new virtualenv with that particular Python:

virtualenv foo -p /path/to/system/python

You might want to do which python to check which Python you are using.

Zach Kelling
  • 52,505
  • 13
  • 109
  • 108
1

So the reason why my compilation failed is either that I was missing bzip2-devel or that I gave the wrong path to ./configure when I did (not sure which of the two):

./configure --prefix=/home/deploy/.virtualenv/sentry

after which running

make
make install

worked fine

Kit Sunde
  • 35,972
  • 25
  • 125
  • 179