problem with setuptools on linux

General discussions related to Python.

Moderators: KDoiron, ChrJim, mawe, python

problem with setuptools on linux

Postby CryingSaul on Sat Jan 17, 2009 9:57 pm

hi all,

i would like to install the ipython interactive shell on my ubuntu 8.10 distribution. to do that i needed to install setuptools. but when i type 'sh setuptools-etc.egg' i get the error 'zipimport.ZipImportError: can't decompress data; zlib not available'.

in synaptic, zlib1g is already installed. i tried adding zlibc for good measure but it didn't help. then i followed the zlib installation instructions to the letter, and still no dice. i logged out and back in, but i still get the same error.

any ideas?

thanks.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: problem with setuptools on linux

Postby Wacky on Sun Jan 18, 2009 9:26 am

Google nets me this:

munichlinux.blogspot.com wrote:install the python-dev package or install python from source

Let me know if it doesn't work. Good luck.
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: problem with setuptools on linux

Postby CryingSaul on Sun Jan 18, 2009 3:09 pm

python has been installed from source so as not to interfere with the version that comes with ubuntu (i installed 2.6.1 with --prefix=/usr/local, as you may recall, wacky). also, because of the above reason, i didn't want to install python-dev because i was worried of what it could do to the system (i'm not an expert on making two python versions coexist).

but anyway, since it's the first suggestion i got since the problem surfaced, i tried it. through synaptic, i installed python-dev (which required python2.5-dev as well). logged out and back in, same error.

i should point out that what i'm trying to do is this:

Code: Select all
sh setuptools-0.6.c9-py2.6.egg


i.e., the setuptools installer for python 2.6, which is the version i installed into /usr/local and which works just fine (including numpy which was also installed with --prefix=/usr/local). this is the version i wish to use ipython with.

now, if i download the 2.5 version of setuptools and do:

Code: Select all
sh setuptools-0.6.c9-py2.5.egg


then i don't get the zlib error, only a permission denied error because i didn't use 'sudo'. but i suppose that if i go ahead and do that, files will go in the wrong places and probably won't work with 2.6.1. this is why i installed zlib from source in the first place (which didn't work, as i wrote).

do you have any idea on what i should do (while avoiding messing up ubuntu)? i remind you that 'which python' gives '/usr/local/bin/python' and 'where is python' gives:

Code: Select all
python: /usr/bin/python2.5 /usr/bin/python /etc/python2.5 /etc/python /usr/lib/python2.4 /usr/lib/python2.5 /usr/local/bin/python2.6-config /usr/local/bin/python2.6 /usr/local/bin/python /usr/local/lib/python2.6 /usr/local/lib/python2.5 /usr/include/python2.4 /usr/include/python2.5 /usr/share/python /usr/share/man/man1/python.1.gz


thanks.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: problem with setuptools on linux

Postby CryingSaul on Sun Jan 18, 2009 3:24 pm

UPDATE

i tried ignoring the setuptools method and built ipython 0.9.1 from source (http://ipython.scipy.org/dist/), as usual using the --prefix=/usr/local. now launching ipython works ok (in turn launching 2.6.1) but the readline module is absent. still without setuptools, i built readline 5.2 (ftp://ftp.gnu.org/gnu/readline) from source, but it doesn't work.

note that if i cd into /usr/bin (not local), and enter 'python2.5' then i get the 2.5.2 interpreter which import readline just fine.

i'm stumped.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: problem with setuptools on linux

Postby Wacky on Sun Jan 18, 2009 3:35 pm

CryingSaul wrote:python has been installed from source so as not to interfere with the version that comes with ubuntu (i installed 2.6.1 with --prefix=/usr/local, as you may recall, wacky).

Huh. Of course. Now I remember. :D

but anyway, since it's the first suggestion i got since the problem surfaced, i tried it. through synaptic, i installed python-dev (which required python2.5-dev as well). logged out and back in, same error.

Yeah, I was a bit dubious about the suggestion I quoted (as it stands), but someone elsewhere said it worked for them, so I thought it was worth a try.

i should point out that what i'm trying to do is this:

Code: Select all
sh setuptools-0.6.c9-py2.6.egg


i.e., the setuptools installer for python 2.6, which is the version i installed into /usr/local and which works just fine (including numpy which was also installed with --prefix=/usr/local). this is the version i wish to use ipython with.

now, if i download the 2.5 version of setuptools and do:

Code: Select all
sh setuptools-0.6.c9-py2.5.egg


then i don't get the zlib error, only a permission denied error because i didn't use 'sudo'. but i suppose that if i go ahead and do that, files will go in the wrong places and probably won't work with 2.6.1.

You're probably right. For reference, you can do this (when you get zlib working) to put a 2.6-friendly setuptools in a specific location:

Code: Select all
sh setuptools-0.6.c9-py2.6.egg --prefix=/path/to/wherever

You can then use "easy_install-2.6 deadparrot" to install a package for 2.6. Or so the docs claim; I've never tried it.

this is why i installed zlib from source in the first place (which didn't work, as i wrote).

do you have any idea on what i should do (while avoiding messing up ubuntu)?

I can only make an educated guess, I'm afraid, as my experience of installing multiple Pythons is still fairly limited. I looked at the setuptools-0.6.c9-py2.6.egg, and it definitely runs itself explicitly using Python 2.6, so that's one thing ruled out. Try recompiling Python from source (run "make clean" in, or overwrite, the source directory first), but with this configure line:

Code: Select all
./configure –with-zlib=/path/to/your/downloaded/zlib/source

It might work. :? Good luck!
Last edited by Wacky on Mon Jan 19, 2009 4:26 pm, edited 1 time in total.
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: problem with setuptools on linux

Postby Wacky on Sun Jan 18, 2009 3:41 pm

CryingSaul wrote:UPDATE

i tried ignoring the setuptools method and built ipython 0.9.1 from source (http://ipython.scipy.org/dist/), as usual using the --prefix=/usr/local. now launching ipython works ok (in turn launching 2.6.1) but the readline module is absent. still without setuptools, i built readline 5.2 (ftp://ftp.gnu.org/gnu/readline) from source, but it doesn't work.

note that if i cd into /usr/bin (not local), and enter 'python2.5' then i get the 2.5.2 interpreter which import readline just fine.

I think that readline has already been compiled into a module by that point, but I'm really not sure... This is getting past my depth when it comes to Python innards.

Try adding this to the ./configure line:

Code: Select all
--with-readline-dir=/usr/include/readline

Or a different path, as suits. I just happened to fine mine ^there.
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: problem with setuptools on linux

Postby CryingSaul on Mon Jan 19, 2009 1:04 am

wacky, you are a very precious individual... i've tried modifying your suggestions a little (i didn't even know the option --with existed), and typed this in the python 2.6.1 source dir (after doing 'make clean' and 'make distclean' for good measure in all source dirs):

Code: Select all
./configure --prefix=/usr/local --with-zlib=/path/to/source/zlib-1.2.3 --with-readline=/path/to/source/readline-5.2


and went through the compiling process all over again. now everything works: 'python' launches 2.6.1, 'import readline' works, ipython and numpy both work (they were both previously installed from sources into /usr/local and were not overwritten, and from the messages i got during compilation it seems the python installer found them and left them alone), and even the setuptools egg stopped complaining about zlib (although with ipython finally working i don't need that anymore...)

i have still no way of knowing if ubuntu will like what i did or not, i'll let you know if something weird happens. for the time being, i finally got what i needed: numpy and 2.6.1 in a paperback-sized device...

it's been such a headache that i think i'll write a tutorial about how to resolve these issues. a lot of this knowledge is scattered all over the net and newbies have a hard time assembling the puzzle.

i hope to be able to help you out someday.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: problem with setuptools on linux

Postby Wacky on Mon Jan 19, 2009 9:34 am

CryingSaul wrote:wacky, you are a very precious individual...

Aww, shucks. :mrgreen:

i've tried modifying your suggestions a little (i didn't even know the option --with existed), and typed this in the python 2.6.1 source dir (after doing 'make clean' and 'make distclean' for good measure in all source dirs):

Code: Select all
./configure --prefix=/usr/local --with-zlib=/path/to/source/zlib-1.2.3 --with-readline=/path/to/source/readline-5.2


and went through the compiling process all over again. now everything works: 'python' launches 2.6.1, 'import readline' works, ipython and numpy both work (they were both previously installed from sources into /usr/local and were not overwritten, and from the messages i got during compilation it seems the python installer found them and left them alone), and even the setuptools egg stopped complaining about zlib (although with ipython finally working i don't need that anymore...)

Fantastic! I'm very glad (and somewhat relieved) to hear that. This was really starting to push the boundaries of my compiling-things-from-source knowledge, so it's nice to see a successful outcome before I start floundering. I learnt the "--with-xyz" from compiling PHP, but tend to forget how consistent compilation procedures usually are in Unix-land, so didn't think to suggest it for this until a Google result mentioned it.

i have still no way of knowing if ubuntu will like what i did or not, i'll let you know if something weird happens.

Thanks. As long as the Ubuntu Python scripts are using the right version, and as long as you installed your Python somewhere different so it didn't overwrite the old standard library or other such bits, and as long as you kept your "new" sources (e.g. zlib) separate from the system ones, I'm fairly sure that everything will be fine.

for the time being, i finally got what i needed: numpy and 2.6.1 in a paperback-sized device...

They are cute little things, aren't they? If I could find a good enough excuse, I'd get one myself.

it's been such a headache that i think i'll write a tutorial about how to resolve these issues. a lot of this knowledge is scattered all over the net and newbies have a hard time assembling the puzzle.

You're right; I've been thinking of fleshing-out my "install many Pythons side-by-side" guide, but something that covered installing modules and such would be good, too. It's a tricky business making sure that all the right library versions are available (such as zlib).

i hope to be able to help you out someday.

If you write that tutorial, I'm sure I'd find it useful. :D
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: problem with setuptools on linux

Postby CryingSaul on Mon Jan 19, 2009 2:30 pm

the hope of a near-perfect solution to the above problem has been shattered by my machine sending a discontented ping in my general direction. don't miss the next episode entitled "how to reference the right python".
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: problem with setuptools on linux

Postby Wacky on Mon Jan 19, 2009 3:56 pm

Eek. o.O Let me know how it goes...
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU


Return to Python General

Who is online

Users browsing this forum: No registered users and 1 guest


Sponsored by Dreamlink Web hosting and Traduzioni Rumeno Italiano and ASSP Deluxe for cPanel.