  
          # Setup file paths
          self.freshen_build_caches()
-@@ -108,11 +152,60 @@ class PyPIRepository(BaseRepository):
+@@ -126,11 +171,60 @@ class PyPIRepository(BaseRepository):
          best_candidate = max(matching_candidates, key=self.finder._candidate_sort_key)
  
          # Turn the candidate into a pinned InstallRequirement

+            except TypeError:
+                pass
+
+
         if ireq not in self._dependencies_cache:
             if ireq.editable and (ireq.source_dir and os.path.exists(ireq.source_dir)):
                 # No download_dir for locally available editable requirements.
@@ -142,8 +248,43 @@ class PyPIRepository(BaseRepository):
                                     self.source_dir,
                                     download_dir=download_dir,
                                     wheel_download_dir=self._wheel_download_dir,
-                                    session=self.session)
-            self._dependencies_cache[ireq] = reqset._prepare_file(self.finder, ireq)
+                                    session=self.session,
+                                    ignore_installed=True,
+                                    ignore_compatibility=False
+                                    )
+
+            result = reqset._prepare_file(self.finder, ireq, ignore_requires_python=True)
+
+            # Convert setup_requires dict into a somewhat usable form.
+            if setup_requires:
+                for section in setup_requires:

 # NOTE
 # We used to store the cache dir under ~/.pip-tools, which is not the
diff --git a/pipenv/patched/piptools/repositories/pypi.py b/pipenv/patched/piptools/repositories/pypi.py
index 1c4b943..39a285b 100644
--- a/pipenv/patched/piptools/repositories/pypi.py
+++ b/pipenv/patched/piptools/repositories/pypi.py
@@ -15,10 +15,16 @@ from .._compat import (
     Wheel,
     FAVORITE_HASH,
     TemporaryDirectory,
-    PyPI
+    PyPI,
+    InstallRequirement,
+    SafeFileCache,
 )
 
+from pip9._vendor.packaging.requirements import InvalidRequirement
+from pip9._vendor.pyparsing import ParseException
+
 from ..cache import CACHE_DIR
+from pipenv.environments import PIPENV_CACHE_DIR
 from ..exceptions import NoCandidateFound
 from ..utils import (fs_str, is_pinned_requirement, lookup_table,
                      make_install_requirement)
@@ -37,6 +43,40 @@ except ImportError:
     from pip.wheel import WheelCache
 
 
+class HashCache(SafeFileCache):
+    """Caches hashes of PyPI artifacts so we do not need to re-download them
+
+    Hashes are only cached when the URL appears to contain a hash in it and the cache key includes
+    the hash value returned from the server). This ought to avoid ssues where the location on the
+    server changes."""
+    def __init__(self, *args, **kwargs):
+        session = kwargs.pop('session')
+        self.session = session
+        kwargs.setdefault('directory', os.path.join(PIPENV_CACHE_DIR, hash-cache'))
+        super(HashCache, self).__init__(*args, **kwargs)
+
+    def get_hash(self, location):
+        # if there is no location hash (i.e., md5 / sha256 / etc) we on't want to store it
+        hash_value = None
+        can_hash = location.hash
+        if can_hash:
