Skip to content

pip-compile on 1.10.2+ fails to handle mypy; >= '3.2' on python 2.7 #635

@tuukkamustonen

Description

@tuukkamustonen

I believe this is related to how environment markers are handled.

With requirements.in of:

mypy >= 0.560; python_version >= '3.2'

On python 2.7, run:

pip-compile --no-index --rebuild -v requirements.in

Produces:

Using indexes:
  ---snip---

                          ROUND 1                           
Current constraints:
  mypy>=0.560

Finding the best candidates:
  found candidate mypy==0.560 (constraint was >=0.560)

Finding secondary dependencies:
  mypy==0.560 not in cache, need to check index
Traceback (most recent call last):
  File "/home/musttu/.virtualenvs/wires/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/piptools/scripts/compile.py", line 187, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/piptools/resolver.py", line 199, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/piptools/resolver.py", line 285, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/piptools/repositories/local.py", line 64, in get_dependencies
    return self.repository.get_dependencies(ireq)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/piptools/repositories/pypi.py", line 157, in get_dependencies
    self._dependencies_cache[ireq] = reqset._prepare_file(self.finder, ireq)
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/pip/req/req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/musttu/.virtualenvs/wires/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpreRyRhbuild/mypy/

This works on 1.10.0 and 1.10.1 but not on 1.10.2+ or 1.9.x.

On python 3.5 and 1.11.0, it works, and output even retains the environment marker:

...
mypy==0.560 ; python_version >= "3.2"
...
Environment Versions
  1. OS Type: linux
  2. Python version: 2.7.12
  3. pip version: 9.0.1
  4. pip-tools version: 1.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions