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.

Invalid package METADATA?

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).

Issue

If you install a package with a path dependency like: test_path_dep = {path = "test_path"}

When you install the package, In your dist-info METADATA, you end up with the path dependant package listed like: Requires-Dist: test_path_dep @ test_path

It looks to me according to https://www.python.org/dev/peps/pep-0508/ the @ symbol is used for URLS only, and that this isn’t valid.

This causes the pkg_resources module’s Distribution’s class requires method to fail with: pkg_resources.extern.packaging.requirements.InvalidRequirement: Invalid URL: test_path

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:11
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
johnpaulettcommented, Oct 30, 2020

It seems any kind of URL or even just the distribution name without the @ is enough for pkg_resources to be happy when trying to list the dependencies of a distribution. So I’d say Poetry should write either name @ file://relative/path, name @ file:///absolute/path or just name. I guess the only use case that this choice affects is installation. I’m not sure which would be better, but if file URL with relative path works when installing the wheel, that looks to me the best thing to do.

I’d lean towards just name.

name @ file:///absolute/path requires the directory structure for the host that the .whl is installed into to match the structure of the build system.

Both the absolute and relative paths, I believe, would incorrect if those dependencies are .whl’s themselves – the file would be at file://relative/path/dist/*.whl or file:///absolute/path/dist/*.whl.

2reactions
nathanrpage97commented, Oct 30, 2020

I have another workaround. Also not sure if this is defined behavior.

Pyproject.toml

[tool.poetry.dependencies]
...
mylib = "1.1.0"

[tool.poetry.dev-dependencies]
...
mylib = { path = "mylib-1.1.0-py3-none-any.whl", develop = false }

This has the added benefit of ensuring it is the correct version installed on a user machine. If you aren’t using a wheel or don’t care about a version then you can switch to mylib = "*".

Read more comments on GitHub >

github_iconTop Results From Across the Web

"pkg: The requested operation cannot be completed due to ...
My Oracle Support Banner. pkg update Fails With: "pkg: The requested operation cannot be completed due to invalid package metadata." (Doc ID ...
Read more >
The package version had build metadata. We do not support ...
The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the...
Read more >
salesforcedx cli - 2GP Managed Package : ERROR running ...
2GP Managed Package : ERROR running force:package:version:create: while Verifying Metadata Invalid type: namespace__CustomObject__c.
Read more >
[Solved] "Load metadata for package" errors / Newbie Corner ...
Re: [Solved] "Load metadata for package" errors. Simplest thing to do would be to create that file as an empty text file, then...
Read more >
Metadata Issues (MetadataInvalid) - Nintex help documentation
Metadata Issues (MetadataInvalid). These issues come from data that describes the DocGen Packages. Possible issues could include problems with fields that ...
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