Repository: pypa/pipenv

Issue:
Failed to create virtual environment with ver 2022.11.11
### Issue description

failed to create virtual environment with pipenv-2022.11.11, but success with pipenv-2020.11.15

### Expected result

pipenv-2020.11.15 rsult:

```
❯ pipenv --python ~/.pyenv/versions/2.7.18/bin/python
Creating a virtualenv for this project...
Pipfile: /var/www/html/ai_algorithm/Pipfile
Using /home/admin/.pyenv/versions/2.7.18/bin/python (2.7.18) to create virtualenv...
⠋ Creating virtual environment...created virtual environment CPython2.7.18.final.0-64 in 766ms
  creator CPython2Posix(dest=/var/www/html/ai_algorithm/.venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/home/admin/.local/share/virtualenv)
    added seed packages: pip==20.3.3, setuptools==44.1.1, wheel==0.36.2
  activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator

✔ Successfully created virtual environment! 
Virtualenv location: /var/www/html/ai_algorithm/.venv
Creating a Pipfile for this project...
```

### Actual result

pipenv-2022.11.11 rsult:

```
pipenv --python /home/admin/.pyenv/versions/2.7.18/bin/python
Creating a virtualenv for this project...
Pipfile: /var/www/html/ai_algorithm/Pipfile
Using /home/admin/.pyenv/versions/2.7.18/bin/python (2.7.18) to create virtualenv...
⠹ Creating virtual environment...SystemExit: 2

✘ Failed creating virtual environment 
[pipenv.exceptions.VirtualenvCreationException]: usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython2-posix}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list]
virtualenv: error: argument --creator: invalid choice: 'venv' (choose from 'builtin', 'cpython2-posix')

Failed to create virtual environment.
```

### pipenv --support  result

❯ pipenv --support       
<details><summary>$ pipenv --support</summary>

Pipenv version: `'2022.11.11'`

Pipenv location: `'/home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv'`

Python location: `'/home/admin/.pyenv/versions/3.7.7/bin/python'`

OS Name: `'posix'`

User pip version: `'22.3'`

user Python installations found:

  - `3.8.10`: `/usr/bin/python`
  - `3.8.10`: `/usr/bin/python3`
  - `3.8.10`: `/usr/bin/python3.8`
  - `3.8.3`: `/home/admin/.pyenv/versions/3.8.3/bin/python`
  - `3.7.7`: `/home/admin/.pyenv/versions/3.7.7/bin/python`
  - `3.7.7`: `/home/admin/.pyenv/versions/3.7.7/bin/python3`
  - `3.7.7`: `/home/admin/.pyenv/versions/3.7.7/bin/python3.7`
  - `3.7.7`: `/home/admin/.pyenv/versions/3.7.7/bin/python3.7m`
  - `3.7.7`: `/home/admin/.pyenv/versions/3.7.7/bin/python`
  - `3.7.4`: `/home/admin/.pyenv/versions/3.7.4/bin/python`
  - `3.6.9`: `/home/admin/.pyenv/versions/3.6.9/bin/python`
  - `3.6.9`: `/usr/bin/python3.6m`
  - `3.6.9`: `/usr/bin/python3.6`
  - `2.7.18`: `/home/admin/.pyenv/versions/2.7.18/bin/python2`
  - `2.7.16`: `/home/admin/.pyenv/versions/2.7.16/bin/python2`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.7.7',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.15.57-051557-generic',
 'platform_system': 'Linux',
 'platform_version': '#202207231132 SMP Sat Jul 23 11:50:34 UTC 2022',
 'python_full_version': '3.7.7',
 'python_version': '3.7',
 'sys_platform': 'linux'}
```

System environment variables:

  - `SHELL`
  - `LSCOLORS`
  - `PYENV_HOOK_PATH`
  - `PIPENV_VENV_IN_PROJECT`
  - `PYENV_SHELL`
  - `LESS`
  - `NVM_INC`
  - `_P9K_TTY`
  - `LC_ADDRESS`
  - `LC_NAME`
  - `P9K_TTY`
  - `LC_MONETARY`
  - `PYENV_VERSION`
  - `PWD`
  - `PYENV_VIRTUALENV_INIT`
  - `LOGNAME`
  - `XDG_SESSION_TYPE`
  - `MOTD_SHOWN`
  - `HOME`
  - `AUTOJUMP_ERROR_PATH`
  - `LC_PAPER`
  - `LANG`
  - `LS_COLORS`
  - `SSH_CONNECTION`
  - `PYENV_DIR`
  - `NVM_DIR`
  - `XDG_SESSION_CLASS`
  - `LC_IDENTIFICATION`
  - `TERM`
  - `ZSH`
  - `USER`
  - `AUTOJUMP_SOURCED`
  - `SHLVL`
  - `NVM_CD_FLAGS`
  - `PAGER`
  - `LC_TELEPHONE`
  - `LC_MEASUREMENT`
  - `XDG_SESSION_ID`
  - `XDG_RUNTIME_DIR`
  - `SSH_CLIENT`
  - `PYENV_ROOT`
  - `LC_TIME`
  - `P9K_SSH`
  - `PATH`
  - `DBUS_SESSION_BUS_ADDRESS`
  - `NVM_BIN`
  - `SSH_TTY`
  - `LC_NUMERIC`
  - `OLDPWD`
  - `PIP_DISABLE_PIP_VERSION_CHECK`
  - `PIP_PYTHON_PATH`
  - `PYTHONDONTWRITEBYTECODE`
  - `PYTHONFINDER_IGNORE_UNSUPPORTED`

Pipenv–specific environment variables:

 - `PIPENV_VENV_IN_PROJECT`: `1`

Debug–specific environment variables:

  - `PATH`: `/home/admin/.pyenv/versions/3.7.7/bin:/home/admin/.pyenv/libexec:/home/admin/.pyenv/plugins/python-build/bin:/home/admin/.pyenv/plugins/pyenv-virtualenv/bin:/home/admin/.pyenv/plugins/pyenv-update/bin:/home/admin/.pyenv/plugins/pyenv-installer/bin:/home/admin/.pyenv/plugins/pyenv-doctor/bin:/home/admin/.autojump/bin:/home/admin/.nvm/versions/node/v12.18.3/bin:/home/admin/.config/yarn/global/node_modules/.bin:/home/admin/Android/Sdk/platform-tools:/home/admin/.pyenv/plugins/pyenv-virtualenv/shims:/home/admin/.pyenv/shims:/home/admin/.pyenv/bin:/home/admin/.autojump/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin`
  - `SHELL`: `/bin/zsh`
  - `LANG`: `en_US.UTF-8`
  - `PWD`: `/var/www/html/ai_algorithm`


---------------------------

</details>


Discussion:
@wyslmt Can you try to to uninstall your virtualenv version (if it was apt, use apt to uninstall it) and then install virtualenv from pypi with `pip install virtualenv`, and try again?
apt virtualenv is not installed 
```
❯ sudo apt purge python-virtualenv          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'python-virtualenv' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.
```

and i've reinstall the virtualenv
```
❯ ~/.pyenv/versions/3.7.7/bin/python -m pip uninstall virtualenv
Uninstalling virtualenv-20.16.7:
  Would remove:
    /home/admin/.pyenv/versions/3.7.7/bin/virtualenv
    /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages/virtualenv-20.16.7.dist-info/*
    /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages/virtualenv/*
Proceed (y/n)? y
  Successfully uninstalled virtualenv-20.16.7
```
```
❯ ~/.pyenv/versions/3.7.7/bin/python -m pip install virtualenv 
Collecting virtualenv
  Using cached https://files.pythonhosted.org/packages/fd/76/c99d37939e17e3c53f1c1b7e4f5365a9160b1cd0b37700657eed9a2a6775/virtualenv-20.16.7-py3-none-any.whl
Requirement already satisfied: distlib<1,>=0.3.6 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv) (0.3.6)
Requirement already satisfied: importlib-metadata>=4.8.3; python_version < "3.8" in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv) (5.0.0)
Requirement already satisfied: platformdirs<3,>=2.4 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv) (2.5.4)
Requirement already satisfied: filelock<4,>=3.4.1 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv) (3.8.0)
Requirement already satisfied: zipp>=0.5 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from importlib-metadata>=4.8.3; python_version < "3.8"->virtualenv) (3.10.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from importlib-metadata>=4.8.3; python_version < "3.8"->virtualenv) (4.4.0)
Installing collected packages: virtualenv
Successfully installed virtualenv-20.16.7
```

and the result is the same as above 
Ok interesting, thanks for checking.
Does it help if you `sudo apt install python3-virtualenv` ?
```
❯ sudo apt install python3-virtualenv                      
[sudo] password for admin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  python3-appdirs python3-distlib python3-filelock python3-importlib-metadata python3-more-itertools python3-zipp
The following NEW packages will be installed:
  python3-appdirs python3-distlib python3-filelock python3-importlib-metadata python3-more-itertools python3-virtualenv python3-zipp
0 upgraded, 7 newly installed, 0 to remove and 98 not upgraded.
Need to get 252 kB of archives.
After this operation, 1,304 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 python3-appdirs all 1.4.3-2.1 [10.8 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 python3-distlib all 0.3.0-1 [116 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 python3-filelock all 3.0.12-2 [7,948 B]
Get:4 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 python3-more-itertools all 4.2.0-1build1 [39.4 kB]
Get:5 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 python3-zipp all 1.0.0-1 [5,312 B]
Get:6 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 python3-importlib-metadata all 1.5.0-1 [9,992 B]
Get:7 http://cn.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-virtualenv all 20.0.17-1ubuntu0.4 [62.7 kB]
Fetched 252 kB in 2s (150 kB/s)              
Selecting previously unselected package python3-appdirs.
(Reading database ... 287376 files and directories currently installed.)
Preparing to unpack .../0-python3-appdirs_1.4.3-2.1_all.deb ...
Unpacking python3-appdirs (1.4.3-2.1) ...
Selecting previously unselected package python3-distlib.
Preparing to unpack .../1-python3-distlib_0.3.0-1_all.deb ...
Unpacking python3-distlib (0.3.0-1) ...
Selecting previously unselected package python3-filelock.
Preparing to unpack .../2-python3-filelock_3.0.12-2_all.deb ...
Unpacking python3-filelock (3.0.12-2) ...
Selecting previously unselected package python3-more-itertools.
Preparing to unpack .../3-python3-more-itertools_4.2.0-1build1_all.deb ...
Unpacking python3-more-itertools (4.2.0-1build1) ...
Selecting previously unselected package python3-zipp.
Preparing to unpack .../4-python3-zipp_1.0.0-1_all.deb ...
Unpacking python3-zipp (1.0.0-1) ...
Selecting previously unselected package python3-importlib-metadata.
Preparing to unpack .../5-python3-importlib-metadata_1.5.0-1_all.deb ...
Unpacking python3-importlib-metadata (1.5.0-1) ...
Selecting previously unselected package python3-virtualenv.
Preparing to unpack .../6-python3-virtualenv_20.0.17-1ubuntu0.4_all.deb ...
Unpacking python3-virtualenv (20.0.17-1ubuntu0.4) ...
Setting up python3-more-itertools (4.2.0-1build1) ...
Setting up python3-filelock (3.0.12-2) ...
Setting up python3-distlib (0.3.0-1) ...
Setting up python3-zipp (1.0.0-1) ...
Setting up python3-appdirs (1.4.3-2.1) ...
Setting up python3-importlib-metadata (1.5.0-1) ...
Setting up python3-virtualenv (20.0.17-1ubuntu0.4) ...
Processing triggers for man-db (2.9.1-1) ...
```
```
❯ python -m pip install pipenv            
Collecting pipenv
  Downloading https://files.pythonhosted.org/packages/ee/4d/444a9b46c6a4d141238fc9c9cf2a57842b0f6c2cf1e5c2a705ef03e2edb9/pipenv-2022.11.25-py3-none-any.whl (2.9MB)
     |████████████████████████████████| 2.9MB 6.9MB/s 
Requirement already satisfied: certifi in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from pipenv) (2022.9.24)
Requirement already satisfied: virtualenv in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from pipenv) (20.16.7)
Requirement already satisfied: setuptools>=36.2.1 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from pipenv) (41.2.0)
Requirement already satisfied: virtualenv-clone>=0.2.5 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from pipenv) (0.5.7)
Requirement already satisfied: importlib-metadata>=4.8.3; python_version < "3.8" in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv->pipenv) (5.0.0)
Requirement already satisfied: distlib<1,>=0.3.6 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv->pipenv) (0.3.6)
Requirement already satisfied: filelock<4,>=3.4.1 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv->pipenv) (3.8.0)
Requirement already satisfied: platformdirs<3,>=2.4 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from virtualenv->pipenv) (2.5.4)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from importlib-metadata>=4.8.3; python_version < "3.8"->virtualenv->pipenv) (4.4.0)
Requirement already satisfied: zipp>=0.5 in /home/admin/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from importlib-metadata>=4.8.3; python_version < "3.8"->virtualenv->pipenv) (3.10.0)
Installing collected packages: pipenv
Successfully installed pipenv-2022.11.25
WARNING: You are using pip version 19.2.3, however version 22.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
```
```
❯ pipenv --python /home/admin/.pyenv/versions/2.7.18/bin/python
Creating a virtualenv for this project...
Pipfile: /home/admin/Downloads/test/Pipfile
Using /home/admin/.pyenv/versions/2.7.18/bin/python (2.7.18) to create virtualenv...
⠙ Creating virtual environment...SystemExit: 2

✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython2-posix}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list]
virtualenv: error: argument --creator: invalid choice: 'venv' (choose from 'builtin', 'cpython2-posix')

Failed to create virtual environment.
```
It seems to have no effec

Ok, I think I know a way to improve this case for pipenv.   What flavor of linux is this by the way @wyslmt ?

Resolving patch:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -989,15 +989,27 @@ def do_create_virtualenv(project, python=None, site_packages=None, pypi_mirror=N
         err=True,
     )
 
-    cmd = [
-        Path(sys.executable).absolute().as_posix(),
-        "-m",
-        "virtualenv",
-        "--creator=venv",
-        f"--prompt={project.name}",
-        f"--python={python}",
-        project.get_location_for_virtualenv(),
-    ]
+    try:
+        import venv  # noqa
+
+        cmd = [
+            Path(sys.executable).absolute().as_posix(),
+            "-m",
+            "virtualenv",
+            "--creator=venv",
+            f"--prompt={project.name}",
+            f"--python={python}",
+            project.get_location_for_virtualenv(),
+        ]
+    except ImportError:
+        cmd = [
+            Path(sys.executable).absolute().as_posix(),
+            "-m",
+            "virtualenv",
+            f"--prompt={project.name}",
+            f"--python={python}",
+            project.get_location_for_virtualenv(),
+        ]
 
     # Pass site-packages flag to virtualenv, if desired...
     if site_packages:


Test patch: