question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Key "extras" does not exist.'

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Mac Catalina 10.15.7

  • Poetry version: 1.1.11

  • Link of a Gist with the contents of your pyproject.toml file:

Issue

after multiple times building & upgrading my python package, poetry gives me a following error when i run poetry install: Installing dependencies from lock file

Package operations: 0 installs, 6 updates, 0 removals

• Updating importlib-metadata (1.7.0 -> 4.8.1) • Updating pyrsistent (0.17.3 -> 0.18.0) • Updating jsonschema (3.2.0 -> 4.1.2) • Updating charset-normalizer (2.0.0 -> 2.0.7) • Updating idna (3.1 -> 3.3) • Updating cffi (1.14.6 -> 1.15.0)

Installing the current project: FCDproc (0.9.0) NonExistentKey

‘Key “extras” does not exist.’

at ~/opt/anaconda3/envs/fcdproc/lib/python3.7/site-packages/tomlkit/container.py:553 in getitem 549│ key = Key(key) 550│ 551│ idx = self._map.get(key, None) 552│ if idx is None: → 553│ raise NonExistentKey(key) 554│ 555│ if isinstance(idx, tuple): 556│ # The item we are getting is an out of order table 557│ # so we need a proxy to retrieve the proper objects

i am not sure why this is coming up now. any suggestion how i can fix this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
TBBlecommented, Jun 24, 2022

This issue is not fixed, https://github.com/python-poetry/poetry-core/pull/404 should take care of it.

The issue is that before https://github.com/python-poetry/poetry-core/pull/40, the only use of the dictionary format for scripts was to add extras, as documented at https://python-poetry.org/docs/master/pyproject#scripts (still), so it is not surprising (but was still kind-of a bug) that extras was a required key, even though it was only being enforced by accident. That was the original bug, that this ticket was opened for in Poetry 1.1:

[tool.poetry.scripts]
devtest = { callable = "mypackage:test.run_tests" }

has no reason not to be equivalent to

[tool.poetry.scripts]
my_package_cli = 'my_package.console:run'

as none of the other uses of toml inline tables in Poetry would distinguish these cases.


The Poetry docs weren’t updated for https://github.com/python-poetry/poetry-core/pull/40 yet, but from that change, Poetry 1.2 introduced a new use of the dictionary format for scripts, the type key, which is @shubb30’s issue above. This has produced a new way to trigger the same underlying issue.

The code in poetry-core was already mostly-correct (The actual stack-trace hit in the original bug report was fixed in https://github.com/python-poetry/poetry-core/pull/177), so the only missed spot appears to be Factory.validate which https://github.com/python-poetry/poetry-core/pull/404 is fixing.

1reaction
richardxiacommented, Nov 18, 2021

@ShervinAbd92, it doesn’t look like you attached your pyproject.toml to this issue. I don’t think attachments to email replies to GitHub get added to the GitHub issue.

I was running into the same issue, and I eventually figured out it was because I had a TOML key that had a period (.) in the name, which actually gets parsed as a nested property. E.g. I had something like:

[tool.poetry.scripts]
foo.bar = "myproject.main"

which ended up being parsed as something equivalent to

[tool.poetry.scripts]
foo = { bar = "myproject.main" }

Putting quotes around the key allowed me to work past the issue I was facing, so if you have something similar in your pyproject.toml, you might try adding quotes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to run Intel HAXM installer: Cannot start process, the ...
Unable to run Intel HAXM installer: Cannot start process, the working directory 'C:\Users\surabhi\AppData\Local\Android\Sdk\extras\intel\ ...
Read more >
Customizing dataset and resource metadata fields using ...
Default extras can only take strings for their keys and values, no validation is applied to the inputs and you cannot make them...
Read more >
Commands | master | Documentation | Poetry - Python ...
Commands You've already learned how to use the command-line interface to do some things. This chapter documents all the available commands.
Read more >
Poetry dependency update - Jackie - Medium
'Key “hashes” does not exist.' install [-no-dev] [-dry-run] [-E|-extras EXTRAS] [-develop DEVELOP]. The reason being the hashes in the lock file doesn't ...
Read more >
Poetry dependency update - WordPress.com
'Key “hashes” does not exist.' install [–no-dev] [–dry-run] [-E|–extras EXTRAS] [–develop DEVELOP]. The reason being the hashes in the lock ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found