Linux – Installing setuptools for python 2.7.3 on SL6 returns an error that I don’t have zlib. But I do

easy-installpythonscientific-linuxzip

  • I have a machine running Scientific Linux 6
  • It comes with Python 2.6 by default
  • I've also installed Python 2.7.3 because I need to run some modules which only work with newest versions. This is working nicely.
  • I need to install more libraries for Python 2.7.3
  • I'm trying to install setuptools in order to grab these modules

[root@sa09b tmp]# wget http://peak.telecommunity.com/dist/ez_setup.py

[root@sa09b tmp]# python2.7 ez_setup.py Downloading

http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg

Traceback (most recent call last): File "ez_setup.py", line 278, in

main(sys.argv[1:]) File "ez_setup.py", line 212, in main

from setuptools.command.easy_install import main

zipimport.ZipImportError: can't decompress data; zlib not available

oh? I thought I had that installed.

[root@sa09b tmp]# yum install zlib Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

  • sl: ftp1.scientificlinux.org

  • sl-security: ftp1.scientificlinux.org

Setting up Install Process

Package zlib-1.2.3-27.el6.x86_64 already installed and latest version

Nothing to do

  • So I looked up various forums
  • Most tell me to install zlib-devel (done "Package zlib-devel-1.2.3-27.el6.x86_64 already installed and latest version"), zlib1g ("No package zlib1g available."), zlib1g-devel (same as before).

Any ideas?

🙂


Edit:

[root@sa09b tmp]# zlib

-bash: zlib: command not found

could that be it?


Edit 2:

  • So the line which fails is "from setuptools.command.easy_install import main"
  • I think this is because the .egg file with setuptools needs to be extracted with zlib
  • I tried installing pip, but that requires setuptools too.
  • I can't use easy_install-2.7 for some reason. But easy_install for 2.6 works fine.

Edit 3:

"find" can't actually find anything to do with zlib in the system, other than python, despite yum saying its installed.

[root@sa09b pip-1.2.1]# find / -name zlib
/tmp/Python-2.7.3/Demo/zlib
/tmp/Python-2.7.3/Modules/zlib

Best Answer

I found the answer from another stackoverflow user.

Basically you can just copy zlib pre gcc'd from 2.6 to 2.7:

cp /usr/lib64/python2.6/lib-dynload/zlibmodule.so /usr/local/lib/python2.7/lib-dynload/zlibmodule.so

Still hackish though.

Related Question