0

When installing distribute-0.6.49 with python3.3.2 in Ubuntu system, error encountered

....blablabla followed by...

"Compression requires the (missing) zlib module")
RuntimeError: Compression requires the (missing) zlib module

I have checked previous solutions that I need to install zlib package, but Should I re install my python again before that? can't I install zlib over it?

If re-installing of python needed, Where can I find python 3.3 with zlib already therein so that i can install python as usual?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
xavi
  • 29
  • 1
  • 1
  • 8

2 Answers2

2

To compile Python with zlib support, you need to install the zlib1g-dev package so that Python can find the headers.

You'd need to re-install your source-compiled Python to take this along.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • you mean first I should install zlib1g-dev package separately before python , then install python version? – xavi Jul 27 '13 at 17:13
  • Yes; the python configure script won't be able to find the zlib include files otherwise. – Martijn Pieters Jul 27 '13 at 17:14
  • is that? I already did tis just now, but still cant import zlib – xavi Jul 27 '13 at 17:21
  • 2
    No, that is not what I said. Use the Ubuntu package manager to install `zlib1g-dev`, then `cd Python-3.3.0`, `./configure --prefix=/opt/python3.3`, `make`, `sudo make install`. – Martijn Pieters Jul 27 '13 at 17:21
  • If you installed `zlib` from source too, you'd need to add the headers location to the python configure call; with the Ubuntu package that's not needed (as the headers can then be found in a standard location). – Martijn Pieters Jul 27 '13 at 17:24
  • would this [zlib_1.2.3.3.dfsg.orig.tar.gz] version of zlib would be fine for python3.3.1 or 3.3.2 version? – xavi Jul 27 '13 at 17:25
  • Turns out I answered this exact same question before, see the proposed dupe. – Martijn Pieters Jul 27 '13 at 17:25
  • Install the `zlib1g-dev` package for *your* version of Ubuntu. 1.2.3.3 is fine. – Martijn Pieters Jul 27 '13 at 17:26
  • Don't install all the dependencies from source. *There is no point in doing that* as the versions in Ubuntu are plenty new and *maintained*. – Martijn Pieters Jul 27 '13 at 17:27
  • Otherwise, use `./configure -with-zlib=/path/to/directory/with/zlib/header/files`. – Martijn Pieters Jul 27 '13 at 17:29
  • The above dupe is when installing zlib, right? in the zlib package directory. – xavi Jul 27 '13 at 17:33
  • No, the dupe is for when you are installing Python 3 from source and `zlib` can not be imported. **There is no need to install `zlib` from source**. There is no good reason to do so. Don't do it. – Martijn Pieters Jul 27 '13 at 17:33
  • I linked to the package in my answer. Pick the right version (there are links for lucid, precise, etc.), then the right platform (amd64 or i386); the latter link to the mirror list for downloading. Download the `.deb` file, and use `dpkg -i filename.deb` to install. – Martijn Pieters Jul 27 '13 at 17:46
  • Finally I have zlib. I installed latest ubuntu 13.04, already available there. Thanks though. Helped me to learn – xavi Jul 28 '13 at 04:34
0

If you are running ubuntu then it is usually recomended that you use the package from the package manager. You can get python 3 - currently 3.3.1 with either sudo apt-get install python3 if I recall correctly or by using the software centre.

I am reasonably sure that the default distribution includes zlib.

Python 3.3.1 (default, Apr 17 2013, 22:30:32) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zlib
>>> exit()
Steve Barnes
  • 27,618
  • 6
  • 63
  • 73