Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maturin build & upload fails due to "malformed summary" #1998

Closed
2 tasks done
leeian1011 opened this issue Mar 20, 2024 · 20 comments · Fixed by #2002
Closed
2 tasks done

maturin build & upload fails due to "malformed summary" #1998

leeian1011 opened this issue Mar 20, 2024 · 20 comments · Fixed by #2002
Labels
bug Something isn't working

Comments

@leeian1011
Copy link

Bug Description

I am currently facing an issue whereby after building the wheel distribution file, maturin upload fails with the following error,

💥 maturin failed
  Caused by: 💥 Failed to upload "mydistribution-1.3.7b1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" (19.6 MB)
  Caused by: Failed to upload the wheel with status 400: <html>
 <head>
  <title>400 'summary' has invalid data. See https://packaging.python.org/specifications/core-metadata for more information.</title>
 </head>
 <body>
  <h1>400 'summary' has invalid data. See https://packaging.python.org/specifications/core-metadata for more information.</h1>
  The server could not comply with the request since it is either malformed or otherwise incorrect.<br/><br/>
&#x27;summary&#x27; has invalid data. See https://packaging.python.org/specifications/core-metadata for more information.


 </body>
</html>

I am also building through docker run

After using unzip on the wheel file, I find that the outputted METADATA is using Metadata-Version 2.1, not too sure if this would be relevant.

Your maturin version (maturin --version)

1.4.0

Your Python version (python -V)

n/a

Your pip version (pip -V)

n/a

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. ./build.sh
ACTION=build
ARGS='--release --interpreter 3.12 --out ./dist --sdist'
RUST_LOG='maturin=debug'
docker run \
  -it \
  -v $HOME/.ssh/id_rsa:/root/.ssh/id_rsa \
  -v $HOME/.ssh/known_hosts:/root/.ssh/known_hosts \
  -v ./dist:/dist \
  -v $(pwd):/io \
  -e $RUST_LOG \
  -w /io/bindings/python \
  mydistribution/maturin:latest \
  $ACTION $ARGS

Output:

📦 Including license file "/io/bindings/python/LICENSE"
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
🐍 Found CPython 3.12
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
📦 Built source distribution to /dist/mydistribution-1.3.7b1.tar.gz
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
   Compiling pyo3-build-config v0.18.3
   Compiling pyo3-ffi v0.18.3
   Compiling pyo3 v0.18.3
   Compiling pyo3-asyncio v0.18.0
   Compiling pyo3-log v0.8.4
   Compiling py-mydistribution v1.3.7-beta.1 (/io/bindings/python)
    Finished release [optimized] target(s) in 42.56s
🖨  Copied external shared libraries to package mydistribution.libs directory:
    /usr/lib64/libk5crypto.so.3.1
    /usr/lib64/libkrb5support.so.0.1
    /usr/lib64/libssl.so.1.0.2k
    /usr/lib64/libselinux.so.1
    /usr/lib64/libpcre.so.1.2.0
    /usr/lib64/libkrb5.so.3.3
    /usr/lib64/libcrypto.so.1.0.2k
    /usr/lib64/libcom_err.so.2.1
    /usr/lib64/libgssapi_krb5.so.2.2
    /usr/lib64/libkeyutils.so.1.5
📦 Built wheel for CPython 3.12 to /dist/mydistribution-1.3.7b1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  1. maturin upload mydistribution-1.3.7b1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
    Output:
💥 maturin failed
  Caused by: 💥 Failed to upload "mydistribution-1.3.7b1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" (19.6 MB)
  Caused by: Failed to upload the wheel with status 400: <html>
 <head>
  <title>400 'summary' has invalid data. See https://packaging.python.org/specifications/core-metadata for more information.</title>
 </head>
 <body>
  <h1>400 'summary' has invalid data. See https://packaging.python.org/specifications/core-metadata for more information.</h1>
  The server could not comply with the request since it is either malformed or otherwise incorrect.<br/><br/>
&#x27;summary&#x27; has invalid data. See https://packaging.python.org/specifications/core-metadata for more information.


 </body>
</html>
@leeian1011 leeian1011 added the bug Something isn't working label Mar 20, 2024
@messense
Copy link
Member

Sorry but you also need to share your binding code, at least pyproject.toml, Cargo.toml and readme file.

@leeian1011
Copy link
Author

Hi sorry for the slow reply, after making some assumptions as to what summary exactly is, I managed to solve the issue by changing my pyproject.toml's description key to summary, everything else stayed the same. I am not very well-versed with the Python standard for metadata so I'd assume a revision was made recently? I've had this pyproject.toml set up since the beginning of the project. Thanks for the prompt reply @messense!

@aseyboldt
Copy link

aseyboldt commented Mar 20, 2024

I'm also running into this issue, but it seems to me that the correct key in pyproject.toml is in fact description, not summary: https://packaging.python.org/en/latest/specifications/pyproject-toml/#description
It mentions that this should be exported as summary in the metadata of the wheel however.

Here is a log from such an upload
https://github.com/pymc-devs/nutpie/actions/runs/8360753012/job/22888798313

And the corresponding pyproject file:
https://github.com/pymc-devs/nutpie/blob/8fdb3b69a672a08cb1cf71d9bd6f2fc79b6d3cdd/pyproject.toml

@tshauck
Copy link

tshauck commented Mar 21, 2024

I'm also facing this issue, and it's also my understanding that description should be the correct key.

E.x. from my project: https://github.com/wheretrue/biobear/actions/runs/8368683483/job/22915105523

@leeian1011
Copy link
Author

Decided to reopen as there are others facing the same issues

@leeian1011 leeian1011 reopened this Mar 21, 2024
@ion-elgreco
Copy link

Our releases at Delta-rs are also failing suddenly: https://github.com/delta-io/delta-rs/actions/runs/8365191045/job/22918909428#step:3:1

@messense
Copy link
Member

@ion-elgreco Can you unpack the wheel that fails the upload and paste it's metadata content here?

@ion-elgreco
Copy link

@messense not sure how to download the wheel from the failed action, if you have some pointers?

But from a locally built release with maturin, the description looks fine: image-1.png

@messense
Copy link
Member

That Summary looks fine to me?

https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata-summary

A one-line summary of what the distribution does.

@messense
Copy link
Member

@ion-elgreco Can you run twine check on that wheel file?

@ion-elgreco
Copy link

That Summary looks fine to me?

https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata-summary

A one-line summary of what the distribution does.

That's the confusing part, nothing changed on our side in the description between 0.16.1 and 0.16.2. Both were built with maturin 1.5.

@messense I did yesterday, twine check passed on that wheel

@ion-elgreco
Copy link

image-2.png

@messense
Copy link
Member

Maybe it's related to this pypi change: pypi/warehouse#15631

@ion-elgreco
Copy link

Looks to be re raised from there: https://github.com/pypi/warehouse/pull/15631/files#diff-631b24361675bcbc0f1aa65df703ce99f10d505f6d95a067c7e1f33fd961ee86R327

So for some reason summaries are not parsed anymore?

@aseyboldt
Copy link

Here is a metadata file from one of the wheels that showed this error. I could upload the file using twine without issues.

Metadata-Version: 2.3
Name: nutpie
Version: 0.10.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: pyarrow >=12.0.0
Requires-Dist: pandas >=2.0
Requires-Dist: xarray >=2023.6.0
Requires-Dist: arviz >=0.15.0
Requires-Dist: fastprogress >=1.0.3
Requires-Dist: bridgestan >=2.1.2 ; extra == 'stan'
Requires-Dist: pymc >=5.5.0 ; extra == 'pymc'
Requires-Dist: numba >=0.57.1 ; extra == 'pymc'
Requires-Dist: bridgestan >=2.1.2 ; extra == 'all'
Requires-Dist: pymc >=5.5.0 ; extra == 'all'
Requires-Dist: numba >=0.57.1 ; extra == 'all'
Provides-Extra: stan
Provides-Extra: pymc
Provides-Extra: all
License-File: LICENSE
Summary: Sample Stan or PyMC models
Keywords: statistics,bayes
Author: Adrian Seyboldt <adrian.seyboldt@gmail.com>, PyMC Developers <pymc.devs@gmail.com>
Author-email: PyMC Developers <pymc.devs@gmail.com>
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source Code, https://github.com/pymc-devs/nutpie

# nutpie: A fast sampler for Bayesian posteriors

## Installation

...

@messense
Copy link
Member

Can anyone try #2002? Clone this repo and switch to that branch and run cargo run upload ....

@ion-elgreco
Copy link

@messense I am at work atm, I can trigger a new CI though if you already push a release, since it will automatically pick up the new version; p

@messense
Copy link
Member

I'll push a new release after work.

For now, if anyone is blocked by this, switch to twine for upload.

@ion-elgreco
Copy link

@messense Thankss!

@ion-elgreco
Copy link

@messense our releases are working again, thanks for the quick fix <3

emilk pushed a commit to rerun-io/rerun that referenced this issue Mar 29, 2024
### What
 - Resolves: #5729

Pypi changed something in their parsing library that required an update
to maturin.
See: PyO3/maturin#1998

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5730/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5730/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5730/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5730)
- [Docs
preview](https://rerun.io/preview/7a22dce6927e560a74b212cee636ee75a250826a/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/7a22dce6927e560a74b212cee636ee75a250826a/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants