Repository: jazzband/pip-tools (python)

Issue:
3.9.0 pip-compile gets confused by GitHub installs without -e
We install a package from GitHub, and pip-tools 3.9.0 gets confused because it can't find it unless it is installed with -e.  pip-tools 3.8.0 installed it fine.

##### Environment Versions

1. Mac
1. Python version: same results with 2.7 or 3.7
1. pip version:  19.1.1
1. pip-tools version: 3.8.0 and 3.9.0

##### Steps to replicate

```
$ cat good.in
-e git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
edx-enterprise==1.7.2

$ cat bad.in
git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
edx-enterprise==1.7.2

$ cat doit.sh
rm -f *.txt
pip install pip-tools==3.8.0
pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o good38.txt good.in
pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o bad38.txt bad.in
pip install pip-tools==3.9.0
pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o good39.txt good.in
pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o bad39.txt bad.in
diff good*.txt

$ sh -x doit.sh
+ rm -f '*.txt'
+ pip install pip-tools==3.8.0
Collecting pip-tools==3.8.0
  Using cached https://files.pythonhosted.org/packages/1c/a1/fc5d034448ca3ab0a8d8b97a064db05fcce6ac8d197bc1fd55e8daa84299/pip_tools-3.8.0-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages (from pip-tools==3.8.0) (1.12.0)
Requirement already satisfied: click>=6 in /usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages (from pip-tools==3.8.0) (7.0)
Installing collected packages: pip-tools
Successfully installed pip-tools-3.8.0
+ pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o good38.txt good.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --no-emit-trusted-host --no-index --output-file=good38.txt good.in
#
-e git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
amqp==1.4.9               # via edx-enterprise, kombu
aniso8601==7.0.0          # via edx-enterprise, tincan
anyjson==0.3.3            # via edx-enterprise, kombu
asn1crypto==0.24.0        # via cryptography, edx-enterprise
billiard==3.3.0.23        # via celery, edx-enterprise
bleach==2.1.4             # via edx-enterprise
celery==3.1.25            # via edx-enterprise
certifi==2019.6.16        # via edx-enterprise, requests
cffi==1.12.3              # via cryptography, edx-enterprise
chardet==3.0.4            # via edx-enterprise, requests
click==7.0                # via code-annotations, edx-enterprise
code-annotations==0.3.1   # via edx-enterprise
cryptography==2.7         # via django-fernet-fields, edx-enterprise
defusedxml==0.5.0         # via djangorestframework-xml, edx-enterprise
django-config-models==1.0.1  # via edx-enterprise
django-countries==4.6.1   # via edx-enterprise
django-crum==0.7.3        # via edx-enterprise, edx-rbac
django-fernet-fields==0.6  # via edx-enterprise
django-filter==1.0.4      # via edx-enterprise
django-ipware==2.1.0      # via edx-enterprise
django-model-utils==3.0.0  # via edx-enterprise, edx-rbac
django-multi-email-field==0.5.1  # via edx-enterprise
django-object-actions==0.10.0  # via edx-enterprise
django-simple-history==2.7.0  # via edx-enterprise
django-waffle==0.12.0     # via edx-django-utils, edx-drf-extensions, edx-enterprise
django==1.11.22           # via code-annotations, django-config-models, django-crum, django-fernet-fields, django-model-utils, django-multi-email-field, edx-django-oauth2-provider, edx-django-utils, edx-drf-extensions, edx-enterprise, edx-opaque-keys, edx-rbac, jsonfield, rest-condition
djangorestframework-jwt==1.11.0  # via edx-drf-extensions, edx-enterprise
djangorestframework-xml==1.3.0  # via edx-enterprise
djangorestframework==3.7.7  # via django-config-models, edx-drf-extensions, edx-enterprise, rest-condition
edx-django-oauth2-provider==1.3.5  # via edx-enterprise
edx-django-utils==2.0.0   # via edx-drf-extensions, edx-enterprise
edx-drf-extensions==2.3.1  # via edx-enterprise, edx-rbac
edx-enterprise==1.7.2
edx-opaque-keys[django]==1.0.1  # via edx-drf-extensions, edx-enterprise
edx-rbac==0.2.1           # via edx-enterprise
edx-rest-api-client==1.9.2  # via edx-enterprise
enum34==1.1.6             # via edx-enterprise
future==0.17.1            # via edx-enterprise, pyjwkest
html5lib==1.0.1           # via bleach, edx-enterprise
idna==2.8                 # via edx-enterprise, requests
ipaddress==1.0.22         # via edx-enterprise
jinja2==2.10.1            # via code-annotations, edx-enterprise
jsondiff==1.1.1           # via edx-enterprise
jsonfield==2.0.2          # via edx-enterprise
kombu==3.0.37             # via celery, edx-enterprise
markupsafe==1.1.1         # via edx-enterprise, jinja2
newrelic==4.20.1.121      # via edx-django-utils, edx-enterprise
path.py==8.2.1            # via edx-enterprise
pbr==5.4.0                # via edx-enterprise, stevedore
pillow==6.1.0             # via edx-enterprise
psutil==1.2.1             # via edx-django-utils, edx-drf-extensions, edx-enterprise
pycparser==2.19           # via cffi, edx-enterprise
pycryptodomex==3.4.7      # via edx-enterprise, pyjwkest
pyjwkest==1.3.2           # via edx-drf-extensions, edx-enterprise
pyjwt==1.5.2              # via djangorestframework-jwt, edx-enterprise, edx-rest-api-client
pymongo==2.9.1            # via edx-enterprise, edx-opaque-keys
python-dateutil==2.4.0    # via edx-drf-extensions, edx-enterprise
python-slugify==1.2.6     # via code-annotations, edx-enterprise
pytz==2019.1              # via celery, django, edx-enterprise, tincan
pyyaml==5.1.1             # via code-annotations, edx-enterprise
requests==2.22.0          # via edx-drf-extensions, edx-enterprise, edx-rest-api-client, pyjwkest, slumber
rest-condition==1.0.3     # via edx-drf-extensions, edx-enterprise
rules==2.0.1              # via edx-enterprise
semantic-version==2.6.0   # via edx-drf-extensions, edx-enterprise
shortuuid==0.5.0          # via edx-django-oauth2-provider, edx-enterprise
six==1.11.0               # via bleach, cryptography, edx-drf-extensions, edx-enterprise, edx-opaque-keys, edx-rbac, html5lib, pyjwkest, python-dateutil, stevedore
slumber==0.7.1            # via edx-enterprise, edx-rest-api-client
stevedore==1.30.1         # via code-annotations, edx-enterprise, edx-opaque-keys
testfixtures==6.10.0      # via edx-enterprise
tincan==0.0.5             # via edx-enterprise
unicodecsv==0.14.1        # via edx-enterprise
unidecode==1.1.1          # via edx-enterprise, python-slugify
urllib3==1.23             # via edx-enterprise, requests
webencodings==0.5.1       # via edx-enterprise, html5lib
+ pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o bad38.txt bad.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --no-emit-trusted-host --no-index --output-file=bad38.txt bad.in
#
amqp==1.4.9               # via edx-enterprise, kombu
aniso8601==7.0.0          # via edx-enterprise, tincan
anyjson==0.3.3            # via edx-enterprise, kombu
asn1crypto==0.24.0        # via cryptography, edx-enterprise
billiard==3.3.0.23        # via celery, edx-enterprise
bleach==2.1.4             # via edx-enterprise
celery==3.1.25            # via edx-enterprise
certifi==2019.6.16        # via edx-enterprise, requests
cffi==1.12.3              # via cryptography, edx-enterprise
chardet==3.0.4            # via edx-enterprise, requests
click==7.0                # via code-annotations, edx-enterprise
code-annotations==0.3.1   # via edx-enterprise
cryptography==2.7         # via django-fernet-fields, edx-enterprise
defusedxml==0.5.0         # via djangorestframework-xml, edx-enterprise
django-config-models==1.0.1  # via edx-enterprise
django-countries==4.6.1   # via edx-enterprise
django-crum==0.7.3        # via edx-enterprise, edx-rbac
django-fernet-fields==0.6  # via edx-enterprise
django-filter==1.0.4      # via edx-enterprise
django-ipware==2.1.0      # via edx-enterprise
django-model-utils==3.0.0  # via edx-enterprise, edx-rbac
django-multi-email-field==0.5.1  # via edx-enterprise
django-object-actions==0.10.0  # via edx-enterprise
django-simple-history==2.7.0  # via edx-enterprise
django-waffle==0.12.0     # via edx-django-utils, edx-drf-extensions, edx-enterprise
django==1.11.22           # via code-annotations, django-config-models, django-crum, django-fernet-fields, django-model-utils, django-multi-email-field, edx-django-oauth2-provider, edx-django-utils, edx-drf-extensions, edx-enterprise, edx-opaque-keys, edx-rbac, jsonfield, rest-condition
djangorestframework-jwt==1.11.0  # via edx-drf-extensions, edx-enterprise
git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
djangorestframework-xml==1.3.0  # via edx-enterprise
djangorestframework==3.7.7  # via django-config-models, edx-drf-extensions, edx-enterprise, rest-condition
edx-django-oauth2-provider==1.3.5  # via edx-enterprise
edx-django-utils==2.0.0   # via edx-drf-extensions, edx-enterprise
edx-drf-extensions==2.3.1  # via edx-enterprise, edx-rbac
edx-enterprise==1.7.2
edx-opaque-keys[django]==1.0.1  # via edx-drf-extensions, edx-enterprise
edx-rbac==0.2.1           # via edx-enterprise
edx-rest-api-client==1.9.2  # via edx-enterprise
enum34==1.1.6             # via edx-enterprise
future==0.17.1            # via edx-enterprise, pyjwkest
html5lib==1.0.1           # via bleach, edx-enterprise
idna==2.8                 # via edx-enterprise, requests
ipaddress==1.0.22         # via edx-enterprise
jinja2==2.10.1            # via code-annotations, edx-enterprise
jsondiff==1.1.1           # via edx-enterprise
jsonfield==2.0.2          # via edx-enterprise
kombu==3.0.37             # via celery, edx-enterprise
markupsafe==1.1.1         # via edx-enterprise, jinja2
newrelic==4.20.1.121      # via edx-django-utils, edx-enterprise
path.py==8.2.1            # via edx-enterprise
pbr==5.4.0                # via edx-enterprise, stevedore
pillow==6.1.0             # via edx-enterprise
psutil==1.2.1             # via edx-django-utils, edx-drf-extensions, edx-enterprise
pycparser==2.19           # via cffi, edx-enterprise
pycryptodomex==3.4.7      # via edx-enterprise, pyjwkest
pyjwkest==1.3.2           # via edx-drf-extensions, edx-enterprise
pyjwt==1.5.2              # via djangorestframework-jwt, edx-enterprise, edx-rest-api-client
pymongo==2.9.1            # via edx-enterprise, edx-opaque-keys
python-dateutil==2.4.0    # via edx-drf-extensions, edx-enterprise
python-slugify==1.2.6     # via code-annotations, edx-enterprise
pytz==2019.1              # via celery, django, edx-enterprise, tincan
pyyaml==5.1.1             # via code-annotations, edx-enterprise
requests==2.22.0          # via edx-drf-extensions, edx-enterprise, edx-rest-api-client, pyjwkest, slumber
rest-condition==1.0.3     # via edx-drf-extensions, edx-enterprise
rules==2.0.1              # via edx-enterprise
semantic-version==2.6.0   # via edx-drf-extensions, edx-enterprise
shortuuid==0.5.0          # via edx-django-oauth2-provider, edx-enterprise
six==1.11.0               # via bleach, cryptography, edx-drf-extensions, edx-enterprise, edx-opaque-keys, edx-rbac, html5lib, pyjwkest, python-dateutil, stevedore
slumber==0.7.1            # via edx-enterprise, edx-rest-api-client
stevedore==1.30.1         # via code-annotations, edx-enterprise, edx-opaque-keys
testfixtures==6.10.0      # via edx-enterprise
tincan==0.0.5             # via edx-enterprise
unicodecsv==0.14.1        # via edx-enterprise
unidecode==1.1.1          # via edx-enterprise, python-slugify
urllib3==1.23             # via edx-enterprise, requests
webencodings==0.5.1       # via edx-enterprise, html5lib
+ pip install pip-tools==3.9.0
Collecting pip-tools==3.9.0
  Using cached https://files.pythonhosted.org/packages/9e/57/f793afe4057a90f072fbe9ecf20599a6b141e4ba06d0dacb0b8ab3722aa6/pip_tools-3.9.0-py2.py3-none-any.whl
Requirement already satisfied: click>=6 in /usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages (from pip-tools==3.9.0) (7.0)
Requirement already satisfied: six in /usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages (from pip-tools==3.9.0) (1.12.0)
Installing collected packages: pip-tools
  Found existing installation: pip-tools 3.8.0
    Uninstalling pip-tools-3.8.0:
      Successfully uninstalled pip-tools-3.8.0
Successfully installed pip-tools-3.9.0
+ pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o good39.txt good.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --no-emit-trusted-host --no-index --output-file=good39.txt good.in
#
-e git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
amqp==1.4.9               # via edx-enterprise, kombu
aniso8601==7.0.0          # via edx-enterprise, tincan
anyjson==0.3.3            # via edx-enterprise, kombu
asn1crypto==0.24.0        # via cryptography, edx-enterprise
billiard==3.3.0.23        # via celery, edx-enterprise
bleach==2.1.4             # via edx-enterprise
celery==3.1.25            # via edx-enterprise
certifi==2019.6.16        # via edx-enterprise, requests
cffi==1.12.3              # via cryptography, edx-enterprise
chardet==3.0.4            # via edx-enterprise, requests
click==7.0                # via code-annotations, edx-enterprise
code-annotations==0.3.1   # via edx-enterprise
cryptography==2.7         # via django-fernet-fields, edx-enterprise
defusedxml==0.5.0         # via djangorestframework-xml, edx-enterprise
django-config-models==1.0.1  # via edx-enterprise
django-countries==4.6.1   # via edx-enterprise
django-crum==0.7.3        # via edx-enterprise, edx-rbac
django-fernet-fields==0.6  # via edx-enterprise
django-filter==1.0.4      # via edx-enterprise
django-ipware==2.1.0      # via edx-enterprise
django-model-utils==3.0.0  # via edx-enterprise, edx-rbac
django-multi-email-field==0.5.1  # via edx-enterprise
django-object-actions==0.10.0  # via edx-enterprise
django-simple-history==2.7.0  # via edx-enterprise
django-waffle==0.12.0     # via edx-django-utils, edx-drf-extensions, edx-enterprise
django==1.11.22           # via code-annotations, django-config-models, django-crum, django-fernet-fields, django-model-utils, django-multi-email-field, edx-django-oauth2-provider, edx-django-utils, edx-drf-extensions, edx-enterprise, edx-opaque-keys, edx-rbac, jsonfield, rest-condition
djangorestframework-jwt==1.11.0  # via edx-drf-extensions, edx-enterprise
djangorestframework-xml==1.3.0  # via edx-enterprise
djangorestframework==3.7.7  # via django-config-models, edx-drf-extensions, edx-enterprise, rest-condition
edx-django-oauth2-provider==1.3.5  # via edx-enterprise
edx-django-utils==2.0.0   # via edx-drf-extensions, edx-enterprise
edx-drf-extensions==2.3.1  # via edx-enterprise, edx-rbac
edx-enterprise==1.7.2
edx-opaque-keys==1.0.1    # via edx-drf-extensions, edx-enterprise
edx-rbac==0.2.1           # via edx-enterprise
edx-rest-api-client==1.9.2  # via edx-enterprise
enum34==1.1.6             # via edx-enterprise
future==0.17.1            # via edx-enterprise, pyjwkest
html5lib==1.0.1           # via bleach, edx-enterprise
idna==2.8                 # via edx-enterprise, requests
ipaddress==1.0.22         # via edx-enterprise
jinja2==2.10.1            # via code-annotations, edx-enterprise
jsondiff==1.1.1           # via edx-enterprise
jsonfield==2.0.2          # via edx-enterprise
kombu==3.0.37             # via celery, edx-enterprise
markupsafe==1.1.1         # via edx-enterprise, jinja2
newrelic==4.20.1.121      # via edx-django-utils, edx-enterprise
path.py==8.2.1            # via edx-enterprise
pbr==5.4.0                # via edx-enterprise, stevedore
pillow==6.1.0             # via edx-enterprise
psutil==1.2.1             # via edx-django-utils, edx-drf-extensions, edx-enterprise
pycparser==2.19           # via cffi, edx-enterprise
pycryptodomex==3.4.7      # via edx-enterprise, pyjwkest
pyjwkest==1.3.2           # via edx-drf-extensions, edx-enterprise
pyjwt==1.5.2              # via djangorestframework-jwt, edx-enterprise, edx-rest-api-client
pymongo==2.9.1            # via edx-enterprise, edx-opaque-keys
python-dateutil==2.4.0    # via edx-drf-extensions, edx-enterprise
python-slugify==1.2.6     # via code-annotations, edx-enterprise
pytz==2019.1              # via celery, django, edx-enterprise, tincan
pyyaml==5.1.1             # via code-annotations, edx-enterprise
requests==2.22.0          # via edx-drf-extensions, edx-enterprise, edx-rest-api-client, pyjwkest, slumber
rest-condition==1.0.3     # via edx-drf-extensions, edx-enterprise
rules==2.0.1              # via edx-enterprise
semantic-version==2.6.0   # via edx-drf-extensions, edx-enterprise
shortuuid==0.5.0          # via edx-django-oauth2-provider, edx-enterprise
six==1.11.0               # via bleach, cryptography, edx-drf-extensions, edx-enterprise, edx-opaque-keys, edx-rbac, html5lib, pyjwkest, python-dateutil, stevedore
slumber==0.7.1            # via edx-enterprise, edx-rest-api-client
stevedore==1.30.1         # via code-annotations, edx-enterprise, edx-opaque-keys
testfixtures==6.10.0      # via edx-enterprise
tincan==0.0.5             # via edx-enterprise
unicodecsv==0.14.1        # via edx-enterprise
unidecode==1.1.1          # via edx-enterprise, python-slugify
urllib3==1.23             # via edx-enterprise, requests
webencodings==0.5.1       # via edx-enterprise, html5lib
+ pip-compile --no-emit-trusted-host --no-index --rebuild --upgrade -o bad39.txt bad.in
Could not find a version that satisfies the requirement djangorestframework-oauth==1.1.1 (from -r bad.in (line 1)) (from versions: 0.1.0, 0.2.0, 1.0.0, 1.0.1, 1.1.0)
Traceback (most recent call last):
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/bin/pip-compile", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/piptools/scripts/compile.py", line 350, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/piptools/resolver.py", line 164, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/piptools/resolver.py", line 259, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/piptools/resolver.py", line 354, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 270, in get_dependencies
    download_dir, ireq, wheel_cache
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 229, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 282, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 198, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/pip/_internal/index.py", line 792, in find_requirement
    'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for djangorestframework-oauth==1.1.1 (from -r bad.in (line 1))
+ diff good38.txt good39.txt
5c5
< #    pip-compile --no-emit-trusted-host --no-index --output-file=good38.txt good.in
---
> #    pip-compile --no-emit-trusted-host --no-index --output-file=good39.txt good.in
41c41
< edx-opaque-keys[django]==1.0.1  # via edx-drf-extensions, edx-enterprise
---
> edx-opaque-keys==1.0.1    # via edx-drf-extensions, edx-enterprise

$ pip --version
pip 19.1.1 from /usr/local/virtualenvs/tmp-54acc534662972d2/lib/python3.7/site-packages/pip (python 3.7)
```
BTW, in our real much larger configuration, pip-tools produces a reasonable message, not sure why it crashes here.  The better message is:
```
Could not find a version that matches djangorestframework-oauth==1.1.1,>=1.1.0 (from -r requirements/edx/github.in (line 72))
Tried: 0.1.0, 0.1.0, 0.1.0, 0.1.0, 0.2.0, 0.2.0, 0.2.0, 0.2.0, 1.0.0, 1.0.0, 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.0.1, 1.0.1, 1.1.0, 1.1.0, 1.1.0, 1.1.0
There are incompatible versions in the resolved dependencies:
  djangorestframework-oauth (from edx-enterprise==1.7.2->-r requirements/edx/base.in (line 80))
  djangorestframework-oauth==1.1.1 from git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1 (from -r requirements/edx/github.in (line 72))
  djangorestframework-oauth>=1.1.0 (from edx-organizations==2.1.0->-r requirements/edx/base.in (line 83))
```
Also, the difference in results about "[django]" I've written up as a separate issue: #852.

Pull request:
Resolver.constraints: Keep our_constraints before their_constraints
Not sure if this is the right solution, but this seems to fix #851, which was introduced when the `source_ireqs.sort(key=str)` operation was added in #837.

Cc: @jakevdp

**Changelog-friendly one-liner**: Try to fix resolution of requirements from Git URLs without -e.

##### Contributor checklist

- [x] Provided the tests for the changes.
- [x] Requested a review from another contributor.
- [x] Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
- [x] Assign the PR to an existing or new milestone for the target version (following [Semantic Versioning](https://blog.versioneye.com/2014/01/16/semantic-versioning/)).


Patch:
diff --git a/piptools/resolver.py b/piptools/resolver.py
index 42d299a..fc53f18 100644
--- a/piptools/resolver.py
+++ b/piptools/resolver.py
@@ -56,7 +56,6 @@ def combine_install_requirements(ireqs):
     source_ireqs = []
     for ireq in ireqs:
         source_ireqs.extend(getattr(ireq, "_source_ireqs", [ireq]))
-    source_ireqs.sort(key=str)
 
     # deepcopy the accumulator so as to not modify the inputs
     combined_ireq = copy.deepcopy(source_ireqs[0])
@@ -120,7 +119,12 @@ class Resolver(object):
     @property
     def constraints(self):
         return set(
-            self._group_constraints(chain(self.our_constraints, self.their_constraints))
+            self._group_constraints(
+                chain(
+                    sorted(self.our_constraints, key=str),
+                    sorted(self.their_constraints, key=str),
+                )
+            )
         )
 
     def resolve_hashes(self, ireqs):
@@ -258,7 +262,7 @@ class Resolver(object):
         for best_match in best_matches:
             their_constraints.extend(self._iter_dependencies(best_match))
         # Grouping constraints to make clean diff between rounds
-        theirs = set(self._group_constraints(their_constraints))
+        theirs = set(self._group_constraints(sorted(their_constraints, key=str)))
 
         # NOTE: We need to compare RequirementSummary objects, since
         # InstallRequirement does not define equality


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index bebbec8..a83ba1d 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -17,7 +17,12 @@ from piptools.exceptions import NoCandidateFound
 from piptools.repositories import PyPIRepository
 from piptools.repositories.base import BaseRepository
 from piptools.resolver import Resolver
-from piptools.utils import as_tuple, key_from_req, make_install_requirement
+from piptools.utils import (
+    as_tuple,
+    is_url_requirement,
+    key_from_req,
+    make_install_requirement,
+)
 
 
 class FakeRepository(BaseRepository):
@@ -59,7 +64,7 @@ class FakeRepository(BaseRepository):
         )
 
     def get_dependencies(self, ireq):
-        if ireq.editable:
+        if ireq.editable or is_url_requirement(ireq):
             return self.editables[str(ireq.link)]
 
         name, version, extras = as_tuple(ireq)
diff --git a/tests/test_data/fake-editables.json b/tests/test_data/fake-editables.json
index b36568c..5075f1e 100644
--- a/tests/test_data/fake-editables.json
+++ b/tests/test_data/fake-editables.json
@@ -1,3 +1,4 @@
 {
-  "git+git://example.org/django.git#egg=django": []
+  "git+git://example.org/django.git#egg=django": [],
+  "git+https://github.com/celery/billiard#egg=billiard==3.5.9999": []
 }
diff --git a/tests/test_resolver.py b/tests/test_resolver.py
index 5fb6cc7..97792ac 100644
--- a/tests/test_resolver.py
+++ b/tests/test_resolver.py
@@ -155,6 +155,23 @@ from piptools.resolver import combine_install_requirements
                     ),
                 },
             ),
+            # Git URL requirement
+            # See: GH-851
+            (
+                [
+                    "git+https://github.com/celery/billiard#egg=billiard==3.5.9999",
+                    "celery==4.0.2",
+                ],
+                [
+                    "amqp==2.1.4 (from kombu==4.0.2->celery==4.0.2)",
+                    "kombu==4.0.2 (from celery==4.0.2)",
+                    "billiard<3.6.0,==3.5.9999,>=3.5.0.2 from "
+                    "git+https://github.com/celery/billiard#egg=billiard==3.5.9999",
+                    "vine==1.1.3 (from amqp==2.1.4->kombu==4.0.2->celery==4.0.2)",
+                    "celery==4.0.2",
+                    "pytz==2016.4 (from celery==4.0.2)",
+                ],
+            ),
         ]
     ),
 )
@@ -264,8 +281,8 @@ def test_compile_failure_shows_provenance(resolver, from_line):
     with pytest.raises(NoCandidateFound) as err:
         resolver(requirements).resolve()
     lines = str(err.value).splitlines()
+    assert lines[-2].strip() == "celery>3.2"
     assert (
-        lines[-2].strip()
+        lines[-1].strip()
         == "celery==3.1.18 (from fake-piptools-test-with-pinned-deps==0.1)"
     )
-    assert lines[-1].strip() == "celery>3.2"