Issue Uploading Python Packages to Nexus: "Metadata is missing required fields" - Sonatype Nexus Repository / Best Practices - Sonatype Community

Issue Uploading Python Packages to Nexus: “Metadata is missing required fields”

post by pogacnik on Dec 18, 2024

Hello,

I often encounter the following issue when uploading Python packages to Nexus. I’m using the following command:

python3 -m twine upload -u "admin" -p "****" --repository-url "http://192.168.163.30:8081/repository/pypi-proxy/" "packages/pypi-proxy/attrs-24.3.0-py3-none-any.whl"

Error:

Uploading distributions to http://192.168.163.30:8081/repository/pypi-proxy/
ERROR    InvalidDistribution: Metadata is missing required fields: Name, Version.
         Make sure the distribution includes the files where those fields are specified, and is using a supported Metadata-Version: 1.0, 1.1, 1.2, 2.0, 2.1, 2.2, 2.3.

The package I’m trying to upload was downloaded through a pip proxy. I’m currently using Nexus version 3.51.0-01.

Has anyone faced a similar issue?

Is this problem resolved in a newer version of Nexus?

Are there specific configurations or steps to ensure that packages include the correct metadata for successful uploads?

Any advice or shared experiences would be greatly appreciated.

Thank you!

post by mpiggott on Dec 18, 2024

I believe the error you’re seeing is actually from twine not Nexus.

I found this which may contain troubleshooting information: Can't run a twine upload due to version problem · Issue #15611 · pypi/warehouse · GitHub

post by pogacnik on Dec 24, 2024

You are right, upgrading “pkginfo” package solves problem.