#127 Can't use pyserial as dep in setup.py using Python 3.2

v1.0 (example)
closed-duplicate
Chris Liechti
None
5
2013-10-11
2012-10-03
No

I'm trying to use pyserial in a package that supports both Python 2.7 and 3.2.

Adding simply 'pyserial' to the "install_requires" list for the package works in 2.7, but in 3.2 I get:

running test
Checking .pth file support in .
/home/peplin/dev/openxc-python/.tox/py32/bin/python -E -c pass
Searching for pyserial
Reading http://pypi.python.org/simple/pyserial/
Reading http://pyserial.sourceforge.net/
Best match: pyserial 2.6
Downloading http://pypi.python.org/packages/source/p/pyserial/pyserial-2.6.tar.gz#md5=cde799970b7c1ce1f7d6e9ceebe64c98
Processing pyserial-2.6.tar.gz
Writing /tmp/easy_install-2_6sez/pyserial-2.6/setup.cfg
Running pyserial-2.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-2_6sez/pyserial-2.6/egg-dist-tmp-n30bo8
warning: no files found matching 'examples/miniterm.py'
warning: no files found matching 'test/test_io_lib.py'
zip_safe flag not set; analyzing archive contents...

Installed /home/peplin/dev/openxc-python/pyserial_py3k-2.6-py3.2.egg
Traceback (most recent call last):
File "setup.py", line 41, in <module>
'openxc-control = openxc.tools.control:main',
File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/home/peplin/dev/openxc-python/.tox/py32/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/setuptools/command/test.py", line 127, in run
self.distribution.fetch_build_eggs(self.distribution.install_requires)
File "/home/peplin/dev/openxc-python/.tox/py32/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/home/peplin/dev/openxc-python/.tox/py32/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pyserial

Dynamically changing the dependency name to "pyserial-py3k" nets me this:

Downloading/unpacking pyserial-py3k (from openxc==0.9.0)
Could not find any downloads that satisfy the requirement pyserial-py3k (from openxc==0.9.0)
No distributions at all found for pyserial-py3k (from openxc==0.9.0)
Storing complete log in /tmp/pip-log.txt

but interestingly, after it fails once with just 'pyserial' as the dependency, the next time I try and run with 'pyserial-py3k', it works fine. The issue is that the name on PyPi is always 'pyserial', but the name of the package once it's built into an egg changes depending on the Python version. Is there a good way to handle this in my setup.py, or can the pyserial alternatively not mess with its name?

Discussion

  • I seem to be able to work around this issue for now by adding this to my setup.py:

    dependency_links = [
    "http://pypi.python.org/packages/source/p/pyserial/pyserial-2.6.tar.gz#egg=pyserial-py3k"
    ]

    that way the dependency named 'pyserial-py3k' is found even though there's no direct match on PyPi.

    Anyone alive on this bug tracker, though? It'd be nice to get this fixed upstream.

     
  • Chris Liechti
    Chris Liechti
    2013-10-11

    • status: open --> closed-duplicate
    • assigned_to: Chris Liechti
    • Group: --> v1.0 (example)
     
  • Chris Liechti
    Chris Liechti
    2013-10-11

    same as [#130], solution will be dropping that suffix in setup.py

     

    Related

    Bugs: #130