Search code examples
pythonpypi

Could not find a version that satisfies the requirement html-form-to-dict (from versions: none)


I just down-ported my library to Python 2.7

Installing via pip install -e git+ssh://[email protected]/guettli/html_form_to_dict#egg=html_form_to_dict works on Python 2.7.

But it fails if I install it via pip:

pip install -v html-form-to-dict


DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Using pip 20.3.4 from /root/tmp/foo/lib/python2.7/site-packages/pip (python 2.7)
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-gVgiT6
Created temporary directory: /tmp/pip-req-tracker-D6Ft0q
Initialized build tracking at /tmp/pip-req-tracker-D6Ft0q
Created build tracker: /tmp/pip-req-tracker-D6Ft0q
Entered build tracker: /tmp/pip-req-tracker-D6Ft0q
Created temporary directory: /tmp/pip-install-Busv66
1 location(s) to search for versions of html-form-to-dict:
* https://pypi.org/simple/html-form-to-dict/
Fetching project page and analyzing links: https://pypi.org/simple/html-form-to-dict/
Getting page https://pypi.org/simple/html-form-to-dict/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/html-form-to-dict/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/html-form-to-dict/ HTTP/1.1" 304 0
  Skipping link: none of the wheel's tags match: py3-none-any: https://files.pythonhosted.org/packages/6e/bb/20b17baae8d33a65ef80f93a8bf80057c593629810ff4e0d0329ce0baf57/html_form_to_dict-2021.11.2-py3-none-any.whl#sha256=2868c4f54ee2f23c8a41a0f2fe21774e8f93618f7984174617b85f3c738e56e2 (from https://pypi.org/simple/html-form-to-dict/) (requires-python:>=3.6)
  Skipping link: none of the wheel's tags match: py3-none-any: https://files.pythonhosted.org/packages/0f/5f/89c1d7e853c9d340ad13a3695ddd5a8d47416432e89ec875010906c618cc/html_form_to_dict-2021.11.3-py3-none-any.whl#sha256=cda22bedd4416cb7116ed89c04f0c81d5dff9cbae0f7cc1c688024ea1267a64b (from https://pypi.org/simple/html-form-to-dict/) (requires-python:>=3.6)
  Skipping link: none of the wheel's tags match: py3-none-any: https://files.pythonhosted.org/packages/4f/29/0b2e1f221a6bb0f52476726942c6e951b5c8723ebaead381d5c0bb537a3e/html_form_to_dict-2021.11.4-py3-none-any.whl#sha256=5c3986c86cb0ed17a1656b2195e93b59634151d3b7c0be82a899874e1e7585d6 (from https://pypi.org/simple/html-form-to-dict/) (requires-python:>=3.6)
  Skipping link: none of the wheel's tags match: py3-none-any: https://files.pythonhosted.org/packages/23/cd/5d587384c7b3f41face8e9da0f25a0b8c27f9bfdc302a597873cbfa61ce9/html_form_to_dict-2021.11.5-py3-none-any.whl#sha256=aea97af4934e9b924e41bbd5e9c422e920a146a4e2e371f72a11d221ae67e9ca (from https://pypi.org/simple/html-form-to-dict/) (requires-python:>=3.6)
  Skipping link: none of the wheel's tags match: py3-none-any: https://files.pythonhosted.org/packages/73/a8/d2a97db900529cb964802ed987ad190ebae8793ca38ae42f8b22ca37b974/html_form_to_dict-2022.3.1-py3-none-any.whl#sha256=f5cbfa31856b30df10c096b13b46731ea353fdba85d33f49903fb251ee407e48 (from https://pypi.org/simple/html-form-to-dict/) (requires-python:>=2.7)
  Skipping link: none of the wheel's tags match: py3-none-any: https://files.pythonhosted.org/packages/9a/77/4c13df9f5342c19e89f9d0cf92cdb8826b7155dbbaf153b050e28d2a91ea/html_form_to_dict-2022.3.2-py3-none-any.whl#sha256=36be5262e592820616a9672b53114cb3e6dda56bbf5647d5b04715e83904eaf2 (from https://pypi.org/simple/html-form-to-dict/) (requires-python:>=2.7)
Given no hashes to check 0 links for project 'html-form-to-dict': discarding no candidates
ERROR: Could not find a version that satisfies the requirement html-form-to-dict (from versions: none)
ERROR: No matching distribution found for html-form-to-dict
Exception information:
Traceback (most recent call last):
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 321, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 180, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 385, in _resolve_one
    dist = self._get_dist_for(req_to_install)
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 336, in _get_dist_for
    self._populate_link(req)
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 302, in _populate_link
    req.link = self._find_requirement_link(req)
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 267, in _find_requirement_link
    best_candidate = self.finder.find_requirement(req, upgrade)
  File "/root/tmp/foo/lib/python2.7/site-packages/pip/_internal/index/package_finder.py", line 929, in find_requirement
    req)
DistributionNotFound: No matching distribution found for html-form-to-dict
Removed build tracker: '/tmp/pip-req-tracker-D6Ft0q'

What can I do, to make it installable for Python 2.7?

BTW I use this in setup.cfg (so this is not the problem):

[options]
python_requires = >=2.7

Solution

  • The better solution is to build a universal wheel, so that py2 users can also install from .whl and not fallback to .tar.gz release.

    To do that, add into your setup call:

    # in setup.py
    from setuptools import setup
    
    setup(
        ...
        options={"bdist_wheel": {"universal": True}},
    )
    

    Now your wheel file will be named like html_form_to_dict-2022.3.1-py2.py3-none-any.whl, and it will be available to Python 2.7 users also. You can still upload the sdist (.tar.gz) alongside, if you want.