0

I am running Ubuntu 12.04 and I have a distribution of Python 3.3.1 installed. I want to install some packages, so I first sought to install distribute-0.6.38. During the "install" phase, I am encountering the following runtime error ($HOME is the location of my Python3.3 installation):

File "$HOME/Python-3.3.1/Lib/zipfile.py", line 583, in _check_compression
  "Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module

I tracked back through the files and function calls, but cannot tell why the creation of the zipfile (I assume this is the root of the error) failed.

Is there something missing from the package? Or is there an issue with the fact that this is a secondary installation of Python?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
txmystic
  • 3
  • 2

2 Answers2

2

It is an issue with the fact you installed Python from source.

You need to install the zlib1g-dev package to provide the headers to Python to be able to compile in zlib support:

sudo apt-get install zlib1g-dev

You may be missing other dependencies; here is a list of packages I'd install if I were to compile Python on an Ubuntu machine:

build-essential
libbz2-dev
libncursesw5-dev
libreadline5-dev
libssl-dev
libgdbm-dev
libc6-dev
libsqlite3-dev
tk-dev
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Thank you. I installed everything you suggested, but still got the error. This answer [link](/q/9328014) made me realize that rebuilding my python3 install with zlib was necessary for the file to appear. Following those directions, distribute installs correctly! – txmystic May 12 '13 at 11:50
0

You need to have the zlib1g-dev library installed.

Try

sudo apt-get install zlib1g-dev

and reinstall.

If that doesn't work you may need to specify where zlib installs like so;

python setup.py install
Ewan
  • 14,592
  • 6
  • 48
  • 62