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

Package issue: pydantic 1.10.[11,12,13] for Python 3.11 #396

Open
3 of 6 tasks
foosel opened this issue Oct 12, 2023 · 11 comments
Open
3 of 6 tasks

Package issue: pydantic 1.10.[11,12,13] for Python 3.11 #396

foosel opened this issue Oct 12, 2023 · 11 comments

Comments

@foosel
Copy link

foosel commented Oct 12, 2023

Package name

pydantic

Package version

1.10.[11,12,13]

PyPI URL

https://pypi.org/project/pydantic/

piwheels URL

https://www.piwheels.org/project/pydantic/

Python version

  • Python 3.7
  • Python 3.9
  • Python 3.11

I am aware this is the issue tracker for a Python package index specifically for Raspberry Pi

  • Yes

I have checked for duplicate issues

  • Yes

I am the maintainer

  • Yes

More information

pydantic in versions 1.10.[11,12,13] on piwheels.org against python 3.11 currently provides broken wheels that will cause an error when attempting to use pydantic, as tracked in pydantic/pydantic#7689. Some test results to support this claim can be found in this comment of mine. The error manifests like this:

Traceback (most recent call last):
  File "/test/test.py", line 9, in <module>
    class TestModel(BaseModel):
  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)

pydantic/pydantic#7689 suggests this might be a problem with the current build setup pulling in the wrong cython version, however the wheels on PyPI itself for Python 3.11 are fine for armv7 for 1.10.[10,11,12], here only 1.10.13 is affected. On piwheels however, only version 1.10.10 is not affected, suggesting the same issue that caused 1.10.13 to be broken on PyPI possibly also broke 1.10.11 through .13 on piwheels. As this affects anyone currently attempting to utilize pydantic on a Raspberry Pi running Bookworm (or, with regards to pydantic 1.10.13 also Buster), this is becoming a big problem in maintaining software targeting the RPi and depending on pydantic.

I've suggested to the pydantic maintainers to request a removal of the affected packages.

@bennuttall
Copy link
Member

Does the problem lie with the pydantic package wheels specifically, rather than pydantic-core? I can remove those wheels for now, but we can rebuild them with a newer version of cython or whatever if that'll fix it.

@foosel
Copy link
Author

foosel commented Oct 12, 2023

As far as I understand, with the wheels specifically, potentially due to having been built against a newer version of Cython than supported by the code branch, due to an insufficient version pin in the setup process. However someone from the pydantic project should definitely chime in on this and also make the decision whether to remove wheels.

(Personally though, I'd really prefer them to be removed, as it would save me several hours of release and support overhead as I then wouldn't have to do yet another release with pydantic pinned to 1.10.10, just to make things work for users on RPi Bookworm.)

@arthur-proglove
Copy link

I can confirm the issue as well. I upgraded to bookworm and get the same error.

@bennuttall
Copy link
Member

I've removed the builds for those versions for now (it'll take a good few mins for the index to update).

If I can fix this by building with a specific version if cython, please let me know and I'll see if I can rebuild them.

Is the version of cython specified in build_requires? If so, is it wrong?

@foosel
Copy link
Author

foosel commented Oct 16, 2023

I can confirm that I now can run my test linked in pydantic/pydantic#7689 (comment) against a Bookworm image with Python 3.11 and enabled piwheels successfully. Which means I don't have to push out a new release with a lower version pin 🥳

If I can fix this by building with a specific version if cython, please let me know and I'll see if I can rebuild them.

If I understood the discussion between @bdraco and @samuelcolvin in pydantic/pydantic#7689 correctly, pydantic v1 needs to be built against cython 0.29.32. That is currently specified in requirements.txt, but that's evaluated too late in the build process to be picked up, so whatever is already there gets used, and that can lead to broken packages.

There's a pending PR by @hramezani adding a pyproject.toml to fix that, but it hasn't been merged yet: pydantic/pydantic#7696

@bennuttall
Copy link
Member

Ok so I should just be able to mark those versions as "skipped" and future versions should be ok (pending PR merge). Shout up if you see another 1.x release before that gets merged. I assume 2.x is unaffected?

@arthur-proglove
Copy link

Seems like I'm getting the same issue on 1.10.14 now ;-)

  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)

@bennuttall
Copy link
Member

I've deleted those builds and skipped that version too.

@arthur-proglove
Copy link

Hi again (hihi), seems like 1.10.15 has exactly the same issue

@bennuttall
Copy link
Member

Done

@foosel
Copy link
Author

foosel commented Jun 12, 2024

Hey there, 1.10.16 as released yesterday is broken too:

Step 16/16 : RUN /test/bin/python /test/test.py
 ---> Running in 26e3d3abef59
Traceback (most recent call last):
  File "/test/test.py", line 4, in <module>
    class TestModel(BaseModel):
  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)
The command '/bin/sh -c /test/bin/python /test/test.py' returned a non-zero code: 1

(tested as mentioned here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants