[SNOW-1331499] Fixed ZIP packaging of snowpark project dependencies containing implicit namespace packages #1160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pre-review checklist
Changes description
Context
The following set of instructions did not work (and it still doesn't work but because of other issue):
For Python < 3.12,
snowpark deploy
was failing with the following error:The problem with visibility of
snowflake
package is caused by the following circumstances:snowflake
package being a part of two libraries (snowflake_connector_python
andsnowflake_snowpark_python
) which are dependencies of our template project, is an implicit namespace package. It a regular case, so nothing wrong here.__init__.py
file, so the zip built bysnowpark build
containssnowflake
directory without__init__.py
but withconnector
andsnowpark
subdirectories. It looks and it is ok, nothing wrong here.zipimport
to load code from ZIPs uploaded to stages and because of that it inherits all the limitations ofzipimport
(Snowpark Python code limitations)zipimport
wasn't able to loadsnowflake
namespace package correctly (tested also locally). This is what is changing in this PR - we're starting to add paths to directories as separate entries to ZIP archive.--
Additional comment 1:
The set of instructions presented at the beginning of this description probably still won't work because
snowflake_snowpark_python
depends oncryptography
which contains shared libraries and this is a known case to receive the following error if differences (OS, python version) between local and target environment appear (see similar issue for AWS lambda):Despite the fact that this PR doesn't fix everything, it is still needed to fix handling of namespace packages other than
snowflake
.Additional comment 2:
For Python 3.12,
snowpark build
fails because there is nosnowflake-snowpark-python
for Python 3.12 while it is required to be downloaded because of--ignore-anaconda
flag.