Repository: pypa/pipenv

Issue:
2022.10.10 install fails with "inconsistent version: filename has '20.0.5', but metadata has '0.0.0'"
### Issue description

pipenv install fails with below error in 2022.10.10, works ok in previous builds running 2022.10.4

### Expected result

I'm expecting it to install all of our libraries

### Actual result

Seems to be failing on our (private) library called `pygain-lib` because of some confusion around the version being `0.0.0`.  However I can't find anything in the tarball of that library referencing `0.0.0`.

```
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 576.6/576.6 kB 2.9 MB/s eta 0:00:00

Collecting pygain-lib[gcs,graph,pubsub,server]==20.0.5

  Downloading <PRIVATEURLREDACTED>/pygain-lib-20.0.5.tar.gz (576 kB)

  Preparing metadata (pyproject.toml): started

  Preparing metadata (pyproject.toml): finished with status 'done'

Discarding <PRIVATEURLREDACTED>/pygain-lib-20.0.5.tar.gz#md5=6e0535b3a29882d3ce9ae912a3d6a580 (from <URLREDACTED>/pygain-lib/): Requested pygain-lib==20.0.5 from <PRIVATEURLREDACTED>pygain-lib-20.0.5.tar.gz#md5=6e0535b3a29882d3ce9ae912a3d6a580 (from -r /var/folders/g3/kz23041j1q78y0p7kwbtmxb00000gn/T/pipenv-i76yxeuz-requirements/pipenv-6g925189-hashed-reqs.txt (line 64)) has inconsistent version: filename has '20.0.5', but metadata has '0.0.0'

WARNING: Requested pygain-lib[gcs,graph,pubsub,server]==20.0.5 from <PRIVATEURLREDACTED>/pygain-lib-20.0.5.tar.gz#md5=6e0535b3a29882d3ce9ae912a3d6a580 (from -r /var/folders/g3/kz23041j1q78y0p7kwbtmxb00000gn/T/pipenv-i76yxeuz-requirements/pipenv-6g925189-hashed-reqs.txt (line 64)), but installing version 0.0.0
ERROR: Ignored the following versions that require a different python version: 2.7 Requires-Python >=3.8; 2.7.1 Requires-Python >=3.8; 2.7rc1 Requires-Python >=3.8; 2.8 Requires-Python >=3.8; 2.8.1 Requires-Python >=3.8; 2.8.1rc1 Requires-Python >=3.8; 2.8.2 Requires-Python >=3.8; 2.8.3 Requires-Python >=3.8; 2.8.4 Requires-Python >=3.8; 2.8.5 Requires-Python >=3.8; 2.8.6 Requires-Python >=3.8; 2.8.7 Requires-Python >=3.8; 2.8rc1 Requires-Python >=3.8
ERROR: Could not find a version that satisfies the requirement pygain-lib[gcs,graph,pubsub,server]==20.0.5 (from versions: 0.0.0, 16.0.2, 16.0.3, 16.1.0, 16.1.1, 16.1.2, 16.1.3, 16.1.4, 16.1.5, 16.2.0, 16.2.1, 16.2.2, 16.2.3, 16.2.4, 16.2.5, 16.2.6, 16.2.7, 16.2.8, 16.3.0, 16.3.1, 16.4.0, 16.4.1, 16.4.2, 16.5.0, 16.5.1, 16.5.2, 16.5.3, 16.5.4, 16.5.5, 16.5.6, 16.5.7, 16.5.8, 16.5.9, 16.5.10, 16.5.11, 16.5.12, 16.5.13, 16.5.14, 16.5.15, 16.5.16, 16.5.17, 16.5.18, 16.5.19, 16.6.0, 16.6.1, 16.6.2, 16.6.3, 16.6.4, 16.6.5, 16.6.6, 16.6.7, 16.6.8, 16.6.9, 16.6.10, 16.6.11, 16.7.0, 16.7.1, 16.7.2, 16.7.3, 16.7.4, 16.7.5, 16.7.6, 16.7.7, 16.7.8, 16.7.9, 16.7.10, 17.0.0, 17.0.1, 17.0.2, 17.0.3, 17.1.0, 17.1.1, 17.2.0, 17.2.1, 17.2.2, 17.2.3, 17.2.4, 17.2.5, 17.2.6, 17.2.7, 17.2.8, 17.2.9, 17.2.10, 17.2.11, 17.2.12, 17.2.13, 18.0.5, 18.0.6, 18.0.7, 18.0.8, 18.0.9, 18.0.10, 18.1.0, 18.1.1, 18.2.0, 18.3.0, 18.3.1, 18.3.2, 18.3.3, 18.3.4, 18.4.0, 18.4.1, 18.4.2, 18.4.3, 18.4.4, 18.4.5, 18.4.6, 18.4.7, 18.4.8, 18.4.9, 19.0.0, 19.0.1, 19.0.2, 19.0.3, 19.0.4, 19.0.5, 19.0.6, 19.1.0, 19.1.1, 19.1.2, 19.1.3, 19.2.0, 19.2.1, 19.2.2, 19.2.3, 19.2.4, 20.0.0, 20.0.1, 20.0.2, 20.0.3, 20.0.4, 20.0.5)
ERROR: No matching distribution found for pygain-lib[gcs,graph,pubsub,server]==20.0.5
```
### Steps to replicate

(this works fine if I pin to 2022.10.4)

1. Upgrade from 2022.10.4 to 2022.10.10
2. `pipenv install --dev -v`
3. get error listed above


---------------------------

I'd be happy to provide `pipenv --support` output in a non-public place to avoid disclosing any info here




Discussion:
I believe this is due to the change to [no_build_isolation](https://github.com/pypa/pipenv/commit/9e064bc6c31088f6726c8be6c03294b4f4af8a17) from #5366. I hit this with setuptools SCM, are you using that as well?
This is unfortunate; the no build isolation change has a lot of devils in the details with reasons to want it both ways, I wish their was a hybrid approach--what is the story with setuptools SCM?  
not setuptools-scm, but [setuptools-git-versioning ](https://github.com/dolfinus/setuptools-git-versioning)which is similar
This is the simplest reproduction I could come up with that matches how we ran into internally. For better or worse, in my case an updated pip/setuptools combo let's me get past it, because it picks up the info from pyproject.toml: https://github.com/steved/pipenv-isolation-repro.


If it continues to be an issue, you could also try installing those packages as a prerequisite -- there are some similar examples on this issue report here:  https://github.com/pypa/pipenv/issues/5391


Hmmm, so I wonder if it would be better to default back to build isolation -- there is only one failing test and I can fix it by requiring for that case that `--extra-pip-args="--no-build-isolation"` be passed when dealing with those type of setup.py that require explicit pre-requisites to be able to build the setup.py.   Thoughts?

Resolving patch:
diff --git a/pipenv/cli/options.py b/pipenv/cli/options.py
--- a/pipenv/cli/options.py
+++ b/pipenv/cli/options.py
@@ -561,6 +561,7 @@ def install_base_options(f):
     f = common_options(f)
     f = pre_option(f)
     f = keep_outdated_option(f)
+    f = extra_pip_args(f)
     return f
 
 
@@ -597,7 +598,6 @@ def install_options(f):
     f = ignore_pipfile_option(f)
     f = editable_option(f)
     f = package_arg(f)
-    f = extra_pip_args(f)
     return f
 
 
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1340,7 +1340,7 @@ def get_pip_args(
     verbose: bool = False,
     upgrade: bool = False,
     require_hashes: bool = False,
-    no_build_isolation: bool = True,
+    no_build_isolation: bool = False,
     no_use_pep517: bool = False,
     no_deps: bool = False,
     selective_upgrade: bool = False,


Test patch:
diff --git a/tests/integration/test_install_categories.py b/tests/integration/test_install_categories.py
--- a/tests/integration/test_install_categories.py
+++ b/tests/integration/test_install_categories.py
@@ -69,5 +69,5 @@ def test_multiple_category_install_proceeds_in_order_specified(pipenv_instance_p
         assert "testpipenv" in p.lockfile["default"]
         assert "testpipenv" not in p.lockfile["prereq"]
         assert "six" in p.lockfile["prereq"]
-        c = p.pipenv('sync --categories="prereq packages" -v')
+        c = p.pipenv('sync --categories="prereq packages" --extra-pip-args="--no-build-isolation" -v')
         assert c.returncode == 0