Not installing the install_requires

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:: $ cd /tmp $ mkvirtualenv --no-site-packages test_premailer $ easy_install premailer Searching for premailer Reading http://pypi.python.org/simple/premailer/ Page at http://pypi.python.org/simple/premailer/ links to .py file(s) without version info; an index scan is required. Scanning index of all packages (this may take a while) Reading http://pypi.python.org/simple/ Reading http://www.peterbe.com/plog/premailer.py Best match: premailer 1.0 Downloading http://pypi.python.org/packages/source/p/premailer/premailer-1.0.tar.gz#md5=... Processing premailer-1.0.tar.gz Running premailer-1.0/setup.py -q bdist_egg --dist-dir /tmp/ easy_install-R730U5/premailer-1.0/egg-dist-tmp-epbGlW Traceback (most recent call last): File "/home/peterbe/virtualenvs/test_premailer/bin/easy_install", line 8, in <module> load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')() File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 1671, in main File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 1659, in with_ei_usage File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 1675, in <lambda> File "/usr/lib/python2.5/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.5/distutils/dist.py", line 974, in run_commands self.run_command(cmd) File "/usr/lib/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 211, in run File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 446, in easy_install File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 476, in install_item File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 655, in install_eggs File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 930, in build_and_install File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/command/ easy_install.py", line 919, in run_setup File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/sandbox.py", line 27, in run_setup File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/sandbox.py", line 63, in run File "/home/peterbe/virtualenvs/test_premailer/lib/python2.5/site- packages/setuptools-0.6c9-py2.5.egg/setuptools/sandbox.py", line 29, in <lambda> File "setup.py", line 4, in <module> File "/tmp/easy_install-R730U5/premailer-1.0/premailer/__init__.py", line 1, in <module> File "/tmp/easy_install-R730U5/premailer-1.0/premailer/ premailer.py", line 5, in <module> ImportError: No module named lxml.html The setup.py (see http://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?

On Wed, 15 Jul 2009 04:29:05 -0700 (PDT), Peter Bengtsson <peterbe@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 (see http://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: http://mail.python.org/pipermail/distutils-sig/2009-May/011913.html http://mail.python.org/pipermail/distutils-sig/2009-July/012441.html The gist is that there is no way to declare things which your setup.py depends on, so if you depend on anything novel in it, it will probably fail like this for someone. Jean-Paul

On Jul 15, 2:16 pm, Jean-Paul Calderone <exar...@divmod.com> wrote:
On Wed, 15 Jul 2009 04:29:05 -0700 (PDT), Peter Bengtsson <pete...@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:
import lxml
(djangopeoplenet)peterbe@trillian:~/djangopeoplenet $ easy_install
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@trillian:~/djangopeoplenet $ cat `which easy_install` | head -n 1 #!/home/peterbe/virtualenvs/djangopeoplenet/bin/python (djangopeoplenet)peterbe@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. 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).

Crap! That didn't work either! IOError: [Errno 20] Not a directory: '/home/peterbe/virtualenvs/ djangopeoplenet/lib/python2.5/site-packages/premailer-1.2-py2.5.egg/ premailer/version.txt' This must be because of some egg magic that I don't understand. What I did was this (in premailer.py): __version__ = open(os.path.join(os.path.dirname(__file__), 'version.txt') ).read().strip() That works if the thing is installed. But not when trying to use it as an egg. I tried to read P.J Eby's reply regarding using execfile() but it went over my head. On Jul 15, 2:16 pm, Jean-Paul Calderone <exar...@divmod.com> wrote:
On Wed, 15 Jul 2009 04:29:05 -0700 (PDT), Peter Bengtsson <pete...@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:
http://mail.python.org/pipermail/distutils-sig/2009-May/011913.htmlhttp://ma...
The gist is that there is no way to declare things which your setup.py depends on, so if you depend on anything novel in it, it will probably fail like this for someone.
Jean-Paul _______________________________________________ Distutils-SIG maillist - Distutils-...@python.orghttp://mail.python.org/mailman/listinfo/distutils-sig
participants (2)
-
Jean-Paul Calderone
-
Peter Bengtsson