zlib module missing
Asked Answered
P

5

29

I have compiled and installed python 2.7 on my ubuntu lucid.
But I am unable to install setuptools for python 2.7 because the data decompression module zlib is not present. This is the exact error:

 Traceback (most recent call last):
  File "setup.py", line 94, in <module>
    scripts = scripts,
  File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/rohan/setuptools-0.6c11/setuptools/command/install.py", line 76, in run
    self.do_egg_install()
  File "/home/rohan/setuptools-0.6c11/setuptools/command/install.py", line 96, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/rohan/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in run
    dry_run=self.dry_run, mode=self.gen_header())
  File "/home/rohan/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 527, in make_zipfile
    z = zipfile.ZipFile(zip_filename, mode, compression=compression)
  File "/usr/local/lib/python2.7/zipfile.py", line 651, in __init__
    "Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module

Also when i try to use setuptools 2.7 .egg, it gives this error:

Traceback (most recent call last):
File "<string>", line 1, in <module>
zipimport.ZipImportError: can't decompress data; zlib not available
Proverb answered 11/10, 2010 at 11:6 Comment(0)
T
52

You forgot to install zlib1g-dev before building Python.

Teleplay answered 11/10, 2010 at 11:12 Comment(3)
thanx....i will always do apt-get build-dep python before compiling :), i think it will fix my HTTPSHandler error too..Proverb
zlib-devel if you're using RHEL/CentOSTooth
coming here during a matplotlib install, I needed libjpeg-dev to satisfy Pillow tooDominoes
R
16

first install the companents with the following command

yum install zlib
yum install zlib-devel

then remake python

make
make install
Rann answered 24/8, 2016 at 4:28 Comment(1)
*for then remake pythonPokpoke
B
11

Please install this before proceeding.

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libreadline-dev libbz2-dev libsqlite3-dev wget curl llvm libncurses5-dev

Pyenv - Common build problems

Bowls answered 11/11, 2015 at 2:29 Comment(1)
On centOS 6.7: yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel from hereFaggoting
P
4

for debian

sudo apt-get install zlib1g-dev

then run in your python folder

make install 
Pulley answered 29/9, 2020 at 15:14 Comment(0)
V
3

My solution to this problem is slightly different only because I was trying to install python on a remote computer which I cannot access as a root user AND has no access to the internet. Here is my slightly modified solution:

  1. Extract python (ie: tar -xzf Python-3.6.4.tgz)
  2. Make a directory to house the local python (ie: mkdir localpy)
  3. Navigate into the Modules/zlib folder in the extracted python directory (ie: cd ./Python-3.6.4/Modules/zlib)
  4. Configure zlib locally (ie: ./configure --prefix='/usr/h/testing/localpy' )
  5. Make and install zlib (make install)
  6. Naviage back to the extracted python folder (ie: cd ../../ )
  7. Configure python locally and point to zlib (ie: ./configure --prefix='/usr/h/testing/localpy' --with-zlib='/usr/h/testing/localpy')
  8. Make python (ie: make)
  9. Install python (ie: make install)

This may not work for everyone, but it worked for me today.

Vinna answered 29/1, 2018 at 22:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.