 +import sys
  from contextlib import contextmanager
  from shutil import rmtree
-
+ 
 @@ -15,13 +16,22 @@ from .._compat import (
      Wheel,
      FAVORITE_HASH,

+
+        # stores *full* path + fragment => sha256
+        self._hash_cache = HashCache(session=session)

         # Setup file paths
         self.freshen_build_caches()
-        self._download_dir = fs_str(os.path.join(CACHE_DIR, 'pkgs'))
-        self._wheel_download_dir = fs_str(os.path.join(CACHE_DIR, 'wheels'))
+        self._download_dir = fs_str(os.path.join(PIPENV_CACHE_DIR, 'pkgs'))
+        self._wheel_download_dir = fs_str(os.path.join(PIPENV_CACHE_DIR, 'wheels'))

     def freshen_build_caches(self):
         """
@@ -114,10 +168,14 @@ class PyPIRepository(BaseRepository):
         if ireq.editable:
             return ireq  # return itself as the best match

-        all_candidates = self.find_all_candidates(ireq.name)
+        all_candidates = clean_requires_python(self.find_all_candidates(ireq.name))
+

                                                   prereleases=prereleases)
+        except TypeError:
+            matching_versions = [candidate.version for candidate in all_candidates]
 
         # Reuses pip's internal candidate sort key to sort
         matching_candidates = [candidates_by_version[ver] for ver in matching_versions]
@@ -126,11 +184,71 @@ class PyPIRepository(BaseRepository):
         best_candidate = max(matching_candidates, key=self.finder._candidate_sort_key)
 
         # Turn the candidate into a pinned InstallRequirement
-        return make_install_requirement(
-            best_candidate.project, best_candidate.version, ireq.extras, constraint=ireq.constraint
