[Distutils] Not installing the install_requires

Peter Bengtsson peterbe at gmail.com
Wed Jul 15 16:25:28 CEST 2009



On Jul 15, 2:16 pm, Jean-Paul Calderone <exar... at divmod.com> wrote:
> On Wed, 15 Jul 2009 04:29:05 -0700 (PDT), Peter Bengtsson <pete... at gmail.com> wrote:
> >I've just made a package
> >http://pypi.python.org/pypi/premailer
>
> >To figure out if I've got it right I've tried installing it like
> >this::
>
> > [snip - install failure log]
>
> >The setup.py
> >(seehttp://github.com/peterbe/premailer/tree/master)
> >contains the following:
>
> >      install_requires=[
> >        'lxml',
> >      ],
>
> >Why does easy_install not try to install lxml before it installs the
> >package?
>
> Because it has to evaluate your setup.py to learn that it requires lxml,
> but your setup.py *also* requires lxml, apparently because you're trying
> to avoid spelling our your package's version number more than once.  This
> has been discussed recently on this list a couple times:
>

Ok. Thanks for spotting that. I'll change the package so that I
manually type in the version number.
Or even better actually. I'll add a file into the package called
version.txt and read that on the fly.

I've got a more pressing problem now, when I try to easy_install my
package it tries to install lxml even though it's already installed!

(djangopeoplenet)peterbe at trillian:~/djangopeoplenet $ cat `which
easy_install` | head -n 1
#!/home/peterbe/virtualenvs/djangopeoplenet/bin/python
(djangopeoplenet)peterbe at trillian:~/djangopeoplenet $ /home/peterbe/
virtualenvs/djangopeoplenet/bin/python
Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
>>>
(djangopeoplenet)peterbe at trillian:~/djangopeoplenet $ easy_install
premailer
Searching for premailer
Best match: premailer 1.2
Processing premailer-1.2-py2.5.egg
premailer 1.2 is already the active version in easy-install.pth

Using /home/peterbe/virtualenvs/djangopeoplenet/lib/python2.5/site-
packages/premailer-1.2-py2.5.egg
Processing dependencies for premailer
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.2.2
Downloading http://codespeak.net/lxml/lxml-2.2.2.tgz
Processing lxml-2.2.2.tgz
Running lxml-2.2.2/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-7jsFdx/lxml-2.2.2/egg-dist-tmp-Ezd7Ad
Building lxml version 2.2.2.
NOTE: Trying to build without Cython, pre-generated 'src/lxml/
lxml.etree.c' needs to be available.
Using build configuration of libxslt 1.1.24
Building against libxml2/libxslt in the following directory: /usr/lib
src/lxml/lxml.etree.c:4:20: error: Python.h: No such file or directory
src/lxml/lxml.etree.c:5:26: error: structmember.h: No such file or
directory
src/lxml/lxml.etree.c:7:6: error: #error Python headers needed to
compile C extensions, please install development version of Python.
error: Setup script exited with error: command 'gcc' failed with exit
status 1


Why is this a problem? Getting lxml to build in a virtual environment
is far from trivial and that's why I (amongst others) prefer to use OS
packages (debian apt in my case).


More information about the Distutils-SIG mailing list