Python pyz executable is not using local dependencies

31 Views Asked by At

I have an application which has a lot of dependencies.

I have tried to package it as a .pyz executable with all of its dependencies using this tutorial ZipAppTutorialByRealPython

In one of the systems that I am deploying, has a zipp package version as 0.6.0 installed My pyz is packaging zipp 3.6.0 but this shouldn't create a problem as I am packaging all my dependencies in the executable.

But when I run the gunicorn app, I'm seeing a version conflict error

    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (zipp 0.6.0 (/usr/lib/python3.6/site-packages), Requirement.parse('zipp>=3.1.0; python_version < "3.10"'), {'importlib-resources'})

I'm unable to figure out the reason for this.

Some contextual info - This application is run using gunicorn

Command to create the executable

python3 -m zipapp src -p "/usr/bin/env python3" -m 'gunicorn.app.wsgiapp:run' -o service.pyz

Tree Structure of Project

src|
   |
   |service|
           | __init__.py
           | __main__.py
           | serviceImplPackages

   |all the pip packages
0

There are 0 best solutions below