python-daemon 2.0.3 can't be required from other setup.py files

Brett Smith brett at curoverse.com
Wed Jan 14 18:04:40 UTC 2015


Hi,

The new release of python-daemon installs great—thanks for that. 
However, it seems like users run into trouble when installing a package
that depends on it.  Here's the minimal setup.py to reproduce the issue:

```
from setuptools import setup
setup(name='pdtest', version='1.0',
install_requires=['python-daemon==2.0.3'])
```

Run `python2 setup.py install` on this file, and it will eventually give
you this traceback:

```
/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py:2510:
PEP440Warning: 'python (daemon-2.0)' is being parsed as a legacy, non
PEP 440, version. You may find odd behavior and sort order. In
particular it will be sorted as less than 0.0. It is recommend to
migrate to PEP 440 compatible versions.
  PEP440Warning,
Best match: python-daemon 2.0.3
Downloading
https://pypi.python.org/packages/source/p/python-daemon/python-daemon-2.0.3.tar.gz#md5=eb159623521f68757c6d3c384fcedd86
Processing python-daemon-2.0.3.tar.gz
Writing /tmp/easy_install-N5azww/python-daemon-2.0.3/setup.cfg
Running python-daemon-2.0.3/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-N5azww/python-daemon-2.0.3/egg-dist-tmp-5xefe0
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    setup(name='pdtest', version='1.0',
install_requires=['python-daemon==2.0.3'])
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/install.py",
line 67, in run
    self.do_egg_install()
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/install.py",
line 117, in do_egg_install
    cmd.run()
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 376, in run
    self.easy_install(spec, not self.no_deps)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 600, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 651, in install_item
    self.process_distribution(spec, dist, deps)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 699, in process_distribution
    [requirement], self.local_index, self.easy_install
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 797, in resolve
    dist = best[req.key] = env.best_match(req, ws, installer)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 1047, in best_match
    return self.obtain(req, installer)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 1059, in obtain
    return installer(requirement)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 619, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 649, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 834, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 1055, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py",
line 1041, in run_setup
    run_setup(setup_script, args)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 204, in run_setup
    raise
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 157, in setup_context
    yield
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 128, in save_modules
    compat.reraise(new_cls, new_exc, tb)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 106, in save_modules
    yield saved
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 157, in setup_context
    yield
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 201, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 231, in run
    return func()
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 200, in runner
    _execfile(setup_script, ns)
  File
"/home/brett/temp/setupvenv/local/lib/python2.7/site-packages/setuptools/sandbox.py",
line 46, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-N5azww/python-daemon-2.0.3/setup.py", line 44,
in <module>
   
KeyError: u'version'
```

I think this is happening because python-daemon's setup.py relies on
unicode_literals.  It looks like when setuptools resolves requirements,
it  dynamically builds and executes setup.py files, preventing the
__future__ import from having the desired effect.

Hope this helps,

-- 
Brett Smith




More information about the python-daemon-devel mailing list