Pipenv: Pipenv master branch does not support both python_version and python_full_version in Pipfile

Created on 5 Nov 2018  Â·  4Comments  Â·  Source: pypa/pipenv

Issue description

pipenv install --dev of following Pipfile will raise pipenv.vendor.plette.models.base.ValidationError: {u'python_full_version': u'3.6.3', u'python_version': u'3.6'}

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

[requires]
python_version = "3.6"
python_full_version = "3.6.3"

[dev-packages]
requests = "*"

Here is the full output of the error.

➜  test pipenv install --dev
Pipfile.lock (470172) out of date, updating to (8bdc9e)...
Locking [dev-packages] dependencies...
✔ Success! 
Locking [packages] dependencies...
Updated Pipfile.lock (470172)!
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv', 'console_scripts', 'pipenv')()
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/cli/command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "/home/user/Documents/dev/pipenv/pipenv/core.py", line 2023, in do_install
    skip_lock=skip_lock,
  File "/home/user/Documents/dev/pipenv/pipenv/core.py", line 1280, in do_init
    pypi_mirror=pypi_mirror,
  File "/home/user/Documents/dev/pipenv/pipenv/core.py", line 735, in do_install_dependencies
    lockfile = project.get_or_create_lockfile()
  File "/home/user/Documents/dev/pipenv/pipenv/project.py", line 813, in get_or_create_lockfile
    _created_lockfile = Lockfile(lockfile_dict)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/plette/models/base.py", line 37, in __init__
    self.validate(data)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/plette/lockfiles.py", line 80, in validate
    klass.validate(data[key])
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/plette/models/sections.py", line 70, in validate
    klass.validate(data[key])
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/plette/models/base.py", line 67, in validate
    return validate(cls, data)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/plette/models/base.py", line 27, in validate
    raise ValidationError(data, v)
pipenv.vendor.plette.models.base.ValidationError: {u'python_full_version': u'3.6.3', u'python_version': u'3.6'}

$ pipenv --support

Pipenv version: '2018.10.14.dev0'

Pipenv location: '/home/user/Documents/dev/pipenv/pipenv'

Python location: '/usr/bin/python'

Python installations found:

  • 3.6.5: /home/user/.pyenv/versions/3.6.5/bin/python3.6m
  • 3.6.6: /home/user/.pyenv/versions/3.6.6/bin/python3
  • 2.7.15: /home/user/.pyenv/versions/2.7.15/bin/python2.7
  • 3.6.4: /home/user/.pyenv/versions/3.6.4/bin/python3.6m
  • 3.6.5: /home/user/.pyenv/versions/3.6.5/bin/python3.6
  • 3.6.6: /home/user/.pyenv/versions/3.6.6/bin/python3.6m
  • 3.5.2: /usr/bin/python3.5m
  • 3.5.5: /home/user/.pyenv/versions/3.5.5/bin/python3.5m
  • 3.6.4: /home/user/.pyenv/versions/3.6.4/bin/python3.6
  • 2.7.14: /home/user/.pyenv/versions/2.7.14/bin/python2.7
  • 3.6.3: /home/user/.pyenv/versions/3.6.3/bin/python3
  • 3.5.5: /home/user/.pyenv/versions/3.5.5/bin/python
  • 2.7.12: /usr/bin/python
  • 3.6.3: /home/user/.pyenv/versions/3.6.3/bin/python3.6m
  • 3.5.2: /usr/bin/python3.5

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.0-38-generic',
 'platform_system': 'Linux',
 'platform_version': '#41~16.04.1-Ubuntu SMP Wed Oct 10 20:16:04 UTC 2018',
 'python_full_version': '2.7.12',
 'python_version': '2.7',
 'sys_platform': 'linux2'}

System environment variables:

  • LESS
  • UPSTART_EVENTS
  • PYTHONDONTWRITEBYTECODE
  • XDG_SESSION_TYPE
  • LC_PAPER
  • SHELL
  • PYENV_SHELL
  • XDG_DATA_DIRS
  • MANDATORY_PATH
  • TERMINATOR_UUID
  • QT_ACCESSIBILITY
  • NVM_BIN
  • UPSTART_INSTANCE
  • JOB
  • XMODIFIERS
  • JAVA_HOME
  • GTK2_MODULES
  • XDG_RUNTIME_DIR
  • LC_ADDRESS
  • LC_CTYPE
  • PYTHONFINDER_IGNORE_UNSUPPORTED
  • XDG_SESSION_ID
  • DBUS_SESSION_BUS_ADDRESS
  • ORBIT_SOCKETDIR
  • DEFAULTS_PATH
  • DESKTOP_SESSION
  • GTK_MODULES
  • PIP_DISABLE_PIP_VERSION_CHECK
  • INSTANCE
  • LC_NAME
  • LS_COLORS
  • LC_NUMERIC
  • GNOME_DESKTOP_SESSION_ID
  • XDG_CURRENT_DESKTOP
  • USER
  • XDG_VTNR
  • PYENV_VIRTUALENV_INIT
  • XAUTHORITY
  • LANGUAGE
  • LC_MEASUREMENT
  • QT_QPA_PLATFORMTHEME
  • CLUTTER_IM_MODULE
  • WINDOWID
  • GPG_AGENT_INFO
  • LANG
  • GDMSESSION
  • UPSTART_JOB
  • XDG_SEAT_PATH
  • PIP_PYTHON_PATH
  • _
  • GTK_IM_MODULE
  • XDG_CONFIG_DIRS
  • QT_VERSION
  • COLORTERM
  • LC_TIME
  • PAGER
  • XDG_GREETER_DATA_DIR
  • QT4_IM_MODULE
  • NVM_DIR
  • HOME
  • DISPLAY
  • XDG_SESSION_DESKTOP
  • QT_DIR
  • CONDA_SHLVL
  • LC_MONETARY
  • QT_LINUX_ACCESSIBILITY_ALWAYS_ON
  • GOPATH
  • LC_IDENTIFICATION
  • UPSTART_SESSION
  • IBUS_DISABLE_SNOOPER
  • GNOME_KEYRING_PID
  • NVM_CD_FLAGS
  • QT_IM_MODULE
  • LOGNAME
  • XDG_SEAT
  • PATH
  • GNOME_KEYRING_CONTROL
  • ZSH
  • TERM
  • XDG_SESSION_PATH
  • COMPIZ_CONFIG_PROFILE
  • SESSIONTYPE
  • IM_CONFIG_PHASE
  • PIP_SHIMS_BASE_MODULE
  • SSH_AUTH_SOCK
  • LSCOLORS
  • OLDPWD
  • GDM_LANG
  • LC_TELEPHONE
  • SHLVL
  • PWD

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/user/.nvm/versions/node/v10.11.0/bin:/home/user/.pyenv/plugins/pyenv-virtualenv/shims:/home/user/.pyenv/shims:/home/user/.pyenv/bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/user/go/bin:/home/user/jdk1.8.0_171/bin:/home/user/apache-maven-3.5.3/bin:/home/user/flutter/bin
  • SHELL: /usr/bin/zsh
  • LANG: en_US.UTF-8
  • PWD: /home/user/Documents/dev/test

Contents of Pipfile ('/home/user/Documents/dev/test/Pipfile'):

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

[requires]
python_version = "3.6"
python_full_version = "3.6.3"

[dev-packages]
requests = "*"

Contents of Pipfile.lock ('/home/user/Documents/dev/test/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "ff359a6f462a364a9274c6cbc1c35332d85a5215b20a840b432ec1e2f5470172"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_full_version": "3.6.3",
            "python_version": "3.6"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {
        "certifi": {
            "hashes": [
                "sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c",
                "sha256:6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a"
            ],
            "version": "==2018.10.15"
        },
        "chardet": {
            "hashes": [
                "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
                "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
            ],
            "version": "==3.0.4"
        },
        "idna": {
            "hashes": [
                "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e",
                "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
            ],
            "version": "==2.7"
        },
        "requests": {
            "hashes": [
                "sha256:99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c",
                "sha256:a84b8c9ab6239b578f22d1c21d51b696dcfe004032bb80ea832398d6909d7279"
            ],
            "index": "pypi",
            "version": "==2.20.0"
        },
        "urllib3": {
            "hashes": [
                "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39",
                "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"
            ],
            "version": "==1.24.1"
        }
    }
}

Most helpful comment

Oh, I didn't check the spec doc recently. But I'm sure the older version of pipenv (any released ones) does not have this issue since I used this format in my project for a while. The released pipenv will take the more specific one as the requires. Using git bisect, I found this breaking change is introduced in https://github.com/pypa/pipenv/commit/4c8617237ccdf53bcf87607479afbd9e8cee99bb.

This change may break the compatibility with legacy Pipfiles. How about supporting both of them and only use the more specific one when they both existed?

Or I'm also fine with only supporting existence of only one of them, only if there is updated document reflecting this. So users like me won't get confused. :D

But in personal I prefer the former approach, since supporting both of them have better compatibilities and that does not change the Pipfile spec actually.

All 4 comments

You can only pick one of python_version or python_full_version so the validation error is correct, your pipfile violates the spec we made up for pipfiles :)

On a more serious note I am ok with overriding the validation, I guess we should pick the more specific one

Oh, I didn't check the spec doc recently. But I'm sure the older version of pipenv (any released ones) does not have this issue since I used this format in my project for a while. The released pipenv will take the more specific one as the requires. Using git bisect, I found this breaking change is introduced in https://github.com/pypa/pipenv/commit/4c8617237ccdf53bcf87607479afbd9e8cee99bb.

This change may break the compatibility with legacy Pipfiles. How about supporting both of them and only use the more specific one when they both existed?

Or I'm also fine with only supporting existence of only one of them, only if there is updated document reflecting this. So users like me won't get confused. :D

But in personal I prefer the former approach, since supporting both of them have better compatibilities and that does not change the Pipfile spec actually.

Seems like the change have been issued recently as mentioned by @jxltom as it breaks my CI builds as of the moment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marc-fez picture marc-fez  Â·  3Comments

jeyraof picture jeyraof  Â·  3Comments

FooBarQuaxx picture FooBarQuaxx  Â·  3Comments

fbender picture fbender  Â·  3Comments

bgjelstrup picture bgjelstrup  Â·  3Comments