-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Issue description
When creating a new virtual environment ( pipenv install
) in an empty directory (ie no Pipfile or Pipfile.lock files) the Python version shown in the Terminal output does not match the python_version
in the Pipfile.
The terminal output shows the venv being created with whatever the newest version of python is on my system (3.11.3 for me). The python_version
in the Pipfile is not this version, though. Rather it is whatever my pyenv
global setting is. I've tinkered with switching the global version to see if the Pipfile would always refer to it in python_version
and it indeed does.
My hypothesis is that pyenv
and pipenv
are not aligned on how to create the virtual environment and how the Pipfile should be created.
Expected result
python_version
in Pipfile to match the version that the venv was created to use (which is the newest version of python on my system)
Actual result
python_version
is set to the global Python version as set in pyenv
while venv is created to use newest version of python on my machine
Steps to replicate
Go to empty directory, confirm it does not have Pipfiles:
> cd path/to/project
~/path/to/project
> ls
Confirm global python version used by pyenv
:
> pyenv global
3.9.16
Install the venv:
> pipenv install
Pipfile: /Users/blakegilliland/path/to/project
Using /opt/homebrew/bin/python3 (3.11.3) to create virtualenv...
⠴ Creating virtual environment...created virtual environment CPython3.11.3.final.0-64 in 357ms
creator CPython3Posix(dest=/Users/blakegilliland/.local/share/virtualenvs/dummyproj-X3m8E-g_, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/blakegilliland/Library/Application Support/virtualenv)
added seed packages: pip==23.1, setuptools==67.6.1, wheel==0.40.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
✔ Successfully created virtual environment!
Virtualenv location: /Users/blakegilliland/.local/share/virtualenvs/dummyproj-X3m8E-g_
Creating a Pipfile for this project...
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Locking [dev-packages] dependencies...
Updated Pipfile.lock (fedbd2ab7afd84cf16f128af0619749267b62277b4cb6989ef16d4bef6e4eef2)!
Installing dependencies from Pipfile.lock (e4eef2)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Confirm venv is using 3.11.3
to run python:
> pipenv run python -V
Python 3.11.3
Pipfile:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.9"
Pipenv version: '2023.3.20'
Pipenv location: '/Users/blakegilliland/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pipenv'
Python location: '/Users/blakegilliland/.pyenv/versions/3.9.16/bin/python3.9'
OS Name: 'posix'
User pip version: '23.0.1'
user Python installations found:
3.11.3
:/opt/homebrew/bin/python3
3.10.11
:/Users/blakegilliland/.pyenv/versions/3.10.11/bin/python3
3.9.16
:/Users/blakegilliland/.pyenv/versions/3.9.16/bin/python3
3.9.16
:/Users/blakegilliland/.pyenv/versions/3.9.16/bin/python3
3.9.16
:/Users/blakegilliland/.pyenv/versions/3.9.16/bin/python
3.9.16
:/Users/blakegilliland/.pyenv/versions/3.9.16/bin/python3.9
3.9.6
:/usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.9.16',
'os_name': 'posix',
'platform_machine': 'arm64',
'platform_python_implementation': 'CPython',
'platform_release': '22.4.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST '
'2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103',
'python_full_version': '3.9.16',
'python_version': '3.9',
'sys_platform': 'darwin'}
System environment variables:
LDFLAGS
MANPATH
TERM_PROGRAM
PYENV_ROOT
TERM
SHELL
CPPFLAGS
HOMEBREW_REPOSITORY
TMPDIR
RPT_PASSWORD
TERM_PROGRAM_VERSION
AWS_SESSION_TOKEN
ZOHO_TOKEN
ZOHO_LOGIN
TERM_SESSION_ID
PYENV_VERSION
ZSH
USER
COMMAND_MODE
SSH_AUTH_SOCK
PYENV_DIR
__CF_USER_TEXT_ENCODING
ZOHO_URL
PAGER
RPT_HOST
LSCOLORS
PATH
__CFBundleIdentifier
PWD
AWS_SECRET_ACCESS_KEY
LANG
RPT_USERNAME
ITERM_PROFILE
PYENV_HOOK_PATH
XPC_FLAGS
XPC_SERVICE_NAME
AWS_ACCESS_KEY_ID
SHLVL
HOME
COLORFGBG
LC_TERMINAL_VERSION
HOMEBREW_PREFIX
ITERM_SESSION_ID
LESS
LOGNAME
PKG_CONFIG_PATH
INFOPATH
HOMEBREW_CELLAR
LC_TERMINAL
EGNYTE_ACCESS_TOKEN
COLORTERM
PIP_DISABLE_PIP_VERSION_CHECK
PIP_PYTHON_PATH
PYTHONDONTWRITEBYTECODE
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/Users/blakegilliland/.pyenv/versions/3.9.16/bin:/opt/homebrew/Cellar/pyenv/2.3.17/libexec:/opt/homebrew/Cellar/pyenv/2.3.17/plugins/python-build/bin:/Users/blakegilliland/.pyenv/shims:/Users/blakegilliland/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/blakegilliland/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/opt/openssl@1.1/bin:/Users/blakegilliland/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
SHELL
:/bin/zsh
LANG
:en_US.UTF-8
PWD
:/Users/blakegilliland/path/to/project
Contents of Pipfile
('/Users/blakegilliland/path/to/project/Pipfile'):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.9"
Contents of Pipfile.lock
('/Users/blakegilliland/path/to/project/Pipfile.lock'):
{
"_meta": {
"hash": {
"sha256": "a36a5392bb1e8bbc06bfaa0761e52593cf2d83b486696bf54667ba8da616c839"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.9"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {},
"develop": {}
}