Pipenv: Pipenv 2018.10.9 can't handle inline tables

Created on 10 Oct 2018  路  3Comments  路  Source: pypa/pipenv

Issue description

Pipenv fails with a toml error when trying to do anything on a Pipfile that contains a [package.<>] table, something that previous versions of pipenv rewrote from inline to expanded form. Ironically, the error it raises is an attribute error trying to parse an _inline_ table, which doesn't have to exist in the example file.

For example, this Pipfile is broken (with or without the empty [package] section):

[packages]

[packages.apache-airflow]
editable = true
git = "https://github.com/apache/incubator-airflow.git"

[requires]
python_version = "3.7"

This Pipfile is not broken _for this issue_ (it is instead blocked by the show stopper in #2984):

[packages]
apache-airflow = {editable = true, git = "https://github.com/apache/incubator-airflow.git"}

[requires]
python_version = "3.7"

Expected result

pipenv to work (install, lock, shell, etc).

Actual result

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 308, in lock
    ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 561, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 484, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 394, in ensure_python
    python = project.required_python_version
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 229, in required_python_version
    required = self.parsed_pipfile.get("requires", {}).get(
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 448, in parsed_pipfile
    parsed = self._parse_pipfile(contents)
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 480, in _parse_pipfile
    data[section][package] = toml._get_empty_inline_table(dict)
AttributeError: module 'toml' has no attribute '_get_empty_inline_table'

$ pipenv --support

Pipenv version: '2018.10.9'

Pipenv location: '/usr/local/lib/python3.7/site-packages/pipenv'

Python location: '/usr/local/opt/python/bin/python3.7'

Python installations found:

  • 3.7.0: /Users/jacobhayes/.local/share/virtualenvs/yay-vfCSW5aP/bin/python3.7
  • 3.7.0: /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/bin/python3.7
  • 3.7.0: /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/bin/python3.7m
  • 2.7.15: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7
  • 2.7.10: /usr/bin/python
  • 2.7.10: /usr/bin/pythonw
  • 2.7.10: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '18.0.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT '
                     '2018; root:xnu-4903.201.2~1/RELEASE_X86_64',
 'python_full_version': '3.7.0',
 'python_version': '3.7',
 'sys_platform': 'darwin'}

System environment variables:

  • Apple_PubSub_Socket_Render
  • COLORFGBG
  • COLORTERM
  • COMMAND_MODE
  • COPYFILE_DISABLE
  • EDITOR
  • GO111MODULE
  • GOPATH
  • HOME
  • HOMEBREW_GITHUB_API_TOKEN
  • ITERM_PROFILE
  • ITERM_SESSION_ID
  • LANG
  • LC_ALL
  • LOGNAME
  • PAGER
  • PATH
  • PIPENV_ACTIVE
  • PIP_PYTHON_PATH
  • PIP_SHIMS_BASE_MODULE
  • PWD
  • PYTHONDONTWRITEBYTECODE
  • SECURITYSESSIONID
  • SHELL
  • SHLVL
  • SSH_AUTH_SOCK
  • TERM
  • TERM_PROGRAM
  • TERM_PROGRAM_VERSION
  • TERM_SESSION_ID
  • TMPDIR
  • TMUX
  • TMUX_PANE
  • TMUX_PLUGIN_MANAGER_PATH
  • USER
  • VIRTUAL_ENV
  • XPC_FLAGS
  • XPC_SERVICE_NAME
  • _OLD_FISH_PROMPT_OVERRIDE
  • _OLD_VIRTUAL_PATH
  • __CF_USER_TEXT_ENCODING
  • __pipenv_fish_initial_pwd

Pipenv鈥搒pecific environment variables:

  • PIPENV_ACTIVE: 1

Debug鈥搒pecific environment variables:

  • PATH: /Users/jacobhayes/.local/share/virtualenvs/yay-vfCSW5aP/bin:/Users/jacobhayes/bin:/Users/jacobhayes/bin:/Users/jacobhayes/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/jacobhayes/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  • SHELL: /usr/local/bin/fish
  • EDITOR: nvim
  • LANG: en_US.UTF-8
  • PWD: /Users/jacobhayes/src/github.com/JacobHayes/dockerfiles/yay
  • VIRTUAL_ENV: /Users/jacobhayes/.local/share/virtualenvs/yay-vfCSW5aP

Contents of Pipfile ('/Users/jacobhayes/src/github.com/JacobHayes/dockerfiles/yay/Pipfile'):

[packages]
apache-airflow = {editable = true, git = "https://github.com/apache/incubator-airflow.git"}

[requires]
python_version = "3.7"

Contents of Pipfile.lock ('/Users/jacobhayes/src/github.com/JacobHayes/dockerfiles/yay/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "4fe62ca4ea8f5d57635a26fba05110d9a5301d8aa69f2aebc8d1c7be6738e37b"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "apache-airflow": {
            "editable": true,
            "git": "https://github.com/apache/incubator-airflow.git",
            "ref": "cdbdcae7c0645ac2987360fced43407202716b99"
        }
    },
    "develop": {}
}

Most helpful comment

This has been resolved in #2971 and will be in today's release

All 3 comments

This has been resolved in #2971 and will be in today's release

@techalchemy any updated release ETA? Wondering if I should pin to the previous version for our next release on Monday or wait for the next pipenv version

Today, hopefully in the next 20 minutes as I'm on vacation and will be AFK for the rest of the day

Was this page helpful?
0 / 5 - 0 ratings