pipenv use wrong python version

Created on 3 May 2020  Â·  3Comments  Â·  Source: pypa/pipenv

Issue description

pipenv --python 2.7 create a virtualenv using python 3.6 instead of python 2.7

system info: wsl2 ubuntu 18.04

Actual result

zc@x1-zc:~/tt$ pipenv --python 2.7 --verbose
Using python: 2.7
Path to python: /usr/bin/python3
Creating a virtualenv for this project…
Pipfile: /home/zc/tt/Pipfile
Using /usr/bin/python3 (3.6.9) to create virtualenv…
â ¸ Creating virtual environment...created virtual environment CPython3.6.9.final.0-64 in 180ms
  creator CPython3Posix(dest=/home/zc/.local/share/virtualenvs/tt-p0lW0Lgd, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/zc/.local/share/virtualenv/seed-app-data/v1.0.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

âś” Successfully created virtual environment!
Virtualenv location: /home/zc/.local/share/virtualenvs/tt-p0lW0Lgd
Creating a Pipfile for this project…

$ pipenv --support

Pipenv version: '2020.4.1b1'

Pipenv location: '/home/zc/.local/lib/python3.6/site-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.6.9: /usr/bin/python3
  • 3.6.9: /usr/bin/python3.6
  • 3.6.9: /usr/bin/python3.6m

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.9',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.19.84-microsoft-standard',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Wed Nov 13 11:44:37 UTC 2019',
 'python_full_version': '3.6.9',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • NVM_DIR
  • LS_COLORS
  • HOSTTYPE
  • LESSCLOSE
  • WT_SESSION
  • LANG
  • OLDPWD
  • WSL_INTEROP
  • NVM_CD_FLAGS
  • WSL_DISTRO_NAME
  • USER
  • PWD
  • HOME
  • NAME
  • XDG_DATA_DIRS
  • SHELL
  • TERM
  • NVM_BIN
  • SHLVL
  • LOGNAME
  • PATH
  • NVM_INC
  • WSLENV
  • LESSOPEN
  • WT_PROFILE_ID
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/zc/.poetry/bin:/home/zc/.local/bin:/home/zc/.nvm/versions/node/v8.17.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/Yarn/bin/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/zc/AppData/Local/Programs/Python/Python37-32/Scripts/:/mnt/c/Users/zc/AppData/Local/Programs/Python/Python37-32/:/mnt/c/Users/zc/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/zc/AppData/Roaming/npm:/mnt/c/Users/zc/AppData/Local/Yarn/bin:/snap/bin
  • SHELL: /bin/bash
  • LANG: C.UTF-8
  • PWD: /home/zc/tt

Contents of Pipfile ('/home/zc/tt/Pipfile'):

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

[dev-packages]

[packages]

[requires]
python_version = "3.6"

awaiting-merge Type

All 3 comments

am I correct in that you need to run pipenv --two.

Per the docs

To initialize a Python 2 virtual environment, run $ pipenv --two.

am I correct in that you need to run pipenv --two.

Per the docs

To initialize a Python 2 virtual environment, run $ pipenv --two.

in Usage:

Usage Examples:
Create a new project using Python 3.7, specifically:
$ pipenv --python 3.7

I also tried pipenv --python 3.6, pipenv used /usr/bin/python3.8 (3.8.2) to create virtualenv, not 3.6
Or I must install specific version python by myself?

@ilyydy If pyenv is installed then pipenv will try to use pyenv to install a non-existing version.

I have sent a PR in the above link so that the logic can work correctly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erinxocon picture erinxocon  Â·  3Comments

jacebrowning picture jacebrowning  Â·  3Comments

ipmb picture ipmb  Â·  3Comments

jacek-jablonski picture jacek-jablonski  Â·  3Comments

jakul picture jakul  Â·  3Comments