1

I have just started (as in 30 minutes ago) to use Ubuntu 12.04 (all my previous experience is with windows) and I just started to learn how to program a couple of weeks ago so this is probably a really beginner question. I have also posted this on the Unix and Linux Stack Exchange, but I thought maybe people around here would be able to help as well

I am trying to install python 3.2, and to get setuptools and pip in python 3.2. Everything seems to work right in python 2.7. However when I try to install setuptools using this code wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python3.2 I get the following error

Extracting in /tmp/tmpcwnav_
Traceback (most recent call last):
  File "<stdin>", line 332, in <module>
  File "<stdin>", line 329, in main
  File "<stdin>", line 51, in _install
  File "/usr/local/lib/python3.2/contextlib.py", line 28, in __enter__
    return next(self.gen)
  File "<stdin>", line 101, in archive_context
  File "/usr/local/lib/python3.2/zipfile.py", line 1004, in extractall
    self.extract(zipinfo, path, pwd)
  File "/usr/local/lib/python3.2/zipfile.py", line 992, in extract
    return self._extract_member(member, path, pwd)
  File "/usr/local/lib/python3.2/zipfile.py", line 1035, in _extract_member
    source = self.open(member, pwd=pwd)
  File "/usr/local/lib/python3.2/zipfile.py", line 978, in open
    close_fileobj=not self._filePassed)
  File "/usr/local/lib/python3.2/zipfile.py", line 487, in __init__
    self._decompressor = zlib.decompressobj(-15)
AttributeError: 'NoneType' object has no attribute 'decompressobj'

Based on some googling, it looks like I am getting the problem because zlib has not been installed. I do not have this problem when trying to install setuptools for python 2.7. I went into python 3.2 and tried to import zlib and got an error message when I tried that. I also tried to do 'sudo apt-get install zliband got the error messageE: Unable to locate package zlib. I did not get error messages when I triedsudo apt-get install zlib1gor sudo apt-get install zlib1g-dev I really have no idea what's going on. How do I get zlib for python 3.2 (or otherwise fix this problem?)

0

1 Answer 1

0

First of all, I (strongly) advice you to remove the python3 version that you installed in /usr/local/lib and use the one that you get from the repo. Having python(3) versions in /usr/local only makes sense if you need different versions from the ones that you can get using apt-get or if you really need a version compiled differently.

You can easily get python3.2 from the Ubuntu repositories on 12.04:

sudo apt-get install python3

Same thing for setuptools:

sudo apt-get install python3-setuptools

To get pip3 please look at How to install pip for python 3 in ubuntu 12.04 LTS.

2
  • Thanks. For some reason stack exchange only informed me know the question was answered, so apologies for the late response.
    – Ravi
    Nov 4, 2014 at 21:26
  • @Ravi: No problem, glad it solved your problem. Nov 4, 2014 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .