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

zipapp standard library compressed project code #131449

Closed
confucuis opened this issue Mar 19, 2025 · 2 comments
Closed

zipapp standard library compressed project code #131449

confucuis opened this issue Mar 19, 2025 · 2 comments

Comments

@confucuis
Copy link

confucuis commented Mar 19, 2025

Bug report

Bug description:

One of my projects depends on fastapi framework, when I use the standard library zipapp to compress the project and run it independently it will report an error: ModuleNotFoundError: No module named 'pydantic_core._pydantic_core', it seems that the fastapi framework in the pydanctic_core will depend on the c extension, but after zipping and packaging it will have ModuleNotFoundError, can the official solve this problem with the standard library zipapp. There are many scenarios where being able to call a pyz file using python still smells good.

CPython versions tested on:

3.11

Operating systems tested on:

Linux

@confucuis confucuis added the type-bug An unexpected behavior, bug, or error label Mar 19, 2025
@brianschubert
Copy link
Contributor

zipapp doesn’t support applications with C extension modules. From the Caveats section of the zipapp docs:

If your application depends on a package that includes a C extension, that package cannot be run from a zip file (this is an OS limitation, as executable code must be present in the filesystem for the OS loader to load it). In this case, you can exclude that dependency from the zipfile, and either require your users to have it installed, or ship it alongside your zipfile and add code to your __main__.py to include the directory containing the unzipped module in sys.path.

@ericvsmith ericvsmith closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2025
@ericvsmith ericvsmith removed the type-bug An unexpected behavior, bug, or error label Mar 19, 2025
@confucuis
Copy link
Author

thanks

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

No branches or pull requests

3 participants