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.

Installation fails with 'Key "metadata" does not exist.' error.

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: Docker version 20.10.12, build e91ed57 with python:3.8.10 image. Host system: ubuntu 20.04

  • Poetry version: 1.1.13

  • pyproject.toml:

[tool.poetry]
name = "localpg"
version = "0.1.0"
description = ""
authors = ["José Castagnino"]
packages = [{include = "localpg"}]

[tool.poetry.dependencies]
python = "3.8.10"
pandas = "^1.3.5"
alembic = "^1.7.5"
muttlib = "1.4.12"
python-decouple = "^3.5"
pangres = "^3.0"
psycopg2 = "^2.9.3"

[tool.poetry.dev-dependencies]
black = "^21.12b0"
pdbpp = "^0.10.3"
pylint = "^2.12.2"
isort = "^5.10.1"
flake8 = "^4.0.1"
pre-commit-hooks = "^4.1.0"
mypy = "^0.931"

[tool.black]
line_length = 88
skip-string-normalization = true

[tool.mypy]
ignore_missing_imports = true
follow_imports = 'skip'

[tool.isort]
multi_line_output = 3
line_length = 88
include_trailing_comma = true

[tool.pylint.master]
jobs = 0
 
[tool.pylint.'MESSAGES CONTROL']
disable = [
  'C',
  'R',
  'fixme',
  'logging-format-interpolation',
  'logging-fstring-interpolation',
  'unspecified-encoding'
]

[tool.pylint.'FORMAT']
max-line-length = 88  # as in black

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Issue

I’m trying to build a custom docker image with my python app using python:3.8.10 as a base image and the following Dockerfile:

FROM python:3.8.10

RUN apt-get update \
    && apt-get install -y neovim \
    && apt-get install -y --no-install-recommends gcc git \
    && apt-get install --no-install-recommends --no-install-suggests --assume-yes curl

ENV PATH="/root/.local/bin:$PATH"

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
RUN . $HOME/.poetry/env
ENV PATH="${PATH}:/root/.poetry/bin"

COPY pyproject.toml /silico-local-pg/pyproject.toml
WORKDIR /silico-local-pg
RUN poetry config virtualenvs.create false
RUN poetry install --no-root
COPY . /silico-local-pg
RUN poetry install --no-interaction

Everything seems to go ok until the very last command poetry install --no-interaction. I keep getting

NonExistentKey
'Key "metadata" does not exist.'
at ~/.poetry/lib/poetry/_vendor/py3.8/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
The command '/bin/sh -c poetry install --no-interaction' returned a non-zero code: 1

My project has the following structure

silico-local-pg
|_/localpg
    |_<my python source code>
|_/docker
    |_Dockerfile
    |_pyproject.toml
    |_poetry.lock

Please let me know of any additional information I might have missed and feel free to close if this is a duplicate or not related to poetry.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
castagninojosecommented, Feb 18, 2022

The lockfile was indeed messed up, most likely by me when copying it into the docker directory to make it available at build time. After deleting it and regenerating it without using docker, I ended up moving the dockerfile instead so they all live in the same directory (repo’s root).

I believe this was a combination of both myself messing up and the docker build context being a PITA to configure.

In any case I’ll be closing this, thanks for your help @clintonroy

1reaction
clintonroycommented, Feb 18, 2022

very random guess, due to permisisons it’s not being written and is being seen as empty or some such.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"The Object Metadata does not exist. Identification fields and ...
Fixes a problem that occurs when you run the RoleTailored client after you import a fob file in Microsoft Dynamics ... "The Object...
Read more >
Troubleshooting — Anaconda documentation
During installation on a Windows system, a dialog box appears that says “Failed to create Anaconda menus, Abort Retry Ignore” or “Failed to...
Read more >
Troubleshooting SAML 2.0 federation with AWS
This error can occur when federation metadata of the identity provider does not match the metadata of the IAM identity provider. For example,...
Read more >
python - I'm unable to install matplotlib due to the error
Whenever i try to run the command 'pip install matplotlib' i run into a metadata problem and matplotlib doesn't finish installation, here is...
Read more >
There was an error fetching the metadata - JumpCloud Support
The export metadata button results in error: There was an error fetching the metadata ... This is caused by either an invalid public...
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