Skip to content

creating venv with specific --python version (not in PATH variable) fails after 2023.4.29 #5893

@mjhalwa

Description

@mjhalwa

Issue description

what fails:

If I try to setup a venv using pipenv install --python 3.11 or pipenv install on a directory that contains a Pipfile with [requires] Python = "3.11" e.g.

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.11"
python_full_version = "3.11.4"

pipenv fails with the following error:

Warning: Python 3.11 was not found on your system...
Neither 'pyenv' nor 'asdf' could be found to install Python.
You can specify specific versions of Python with:
$ pipenv --python path\to\python

(same happens for other Python Versions like 3.10)

what works

If instead running pipenv install on a plain directory or pipenv install on a directory with following Pipfile (without [requires])

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

it creates a venv with my latest installed Python version 3.11.4

Expected result

create a venv with python from my installation of Python 3.11 at C:\Software\Python\Python3_11_4

Actual result

pipenv install --python 3.11 --verbose returns

Using python: 3.11
Path to python: None
Warning: Python 3.11 was not found on your system...
Neither 'pyenv' nor 'asdf' could be found to install Python.
You can specify specific versions of Python with:
$ pipenv --python path\to\python

Steps to replicate

I am running on Windows 10 64bit.

  1. install Python 3.11.4 in C:\Software\Python\Python3_11_4

  2. add C:\Software\Python\Python3_11_4\Scripts to System PATH

  3. open powershell (v7) and run py -3.11 -m pip install pipenv (which installs latest pipenv 2023.8.28)

  4. go to empty directory and run pipenv install --python 3.11 -> ERROR

  5. but go to empty directory and run pipenv install works and creates following Pipfile (without [requires]):

    [[source]]
    url = "https://pypi.org/simple"
    verify_ssl = true
    name = "pypi"
    
    [packages]
    
    [dev-packages]
  6. also go to empty directory and run pipenv install --python C:\Software\Python\Python3_11_4 works

  7. uninstall pipenv py -3.11 -m pip uninstall pipenv

  8. install older pipenv<=2023.4.29 py -3.11 -m pip install pipenv==2023.4.29

  9. go to empty directory and run pipenv install --python 3.11 -> works and creates following Pipfile (with [requires])

    [[source]]
    url = "https://pypi.org/simple"
    verify_ssl = true
    name = "pypi"
    
    [packages]
    
    [dev-packages]
    
    [requires]
    python_version = "3.11"
    python_full_version = "3.11.4"

all newer versions than 2023.4.29 fail installing a venv with specific python version and, all up to 2023.4.29 seem to work (I tested 2022.6.7, 2022.11.11, 2023.2.4 and 2023.4.29). Testing with 2023.5.19, 2023.6.2, 2023.7.1 and latest 2023.8.28 all failed.


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

$ pipenv --support

Pipenv version: '2023.8.28'

Pipenv location: 'C:\\Software\\Python\\Python3_11_4\\Lib\\site-packages\\pipenv'

Python location: 'C:\\Software\\Python\\Python3_11_4\\python.exe'

OS Name: 'nt'

User pip version: '23.2.1'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.11.4',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.19045',
 'python_full_version': '3.11.4',
 'python_version': '3.11',
 'sys_platform': 'win32'}

...

I omitted PATH and environment variables and hope they are currently not relevant.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions