zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.31k stars 363 forks source link

[Migrated] Precompiled wheels are not extracted according to PEP491 which leads to import errors. #856

Closed jneves closed 6 months ago

jneves commented 3 years ago

Originally from: https://github.com/Miserlou/Zappa/issues/2104 by kairichard

When installing manylinux wheels with use_precompiled_packages set to true zappa only unzips the wheels ignoring purelib and platlib folders as specified in PEP491

Expected Behavior

A correctly extracted wheel in the resulting lambda zip:

./tensorflow
./tensorflow/tools
./tensorflow/core
./tensorflow/python
./tensorflow/lite
./tensorflow/libtensorflow_framework.so.1
./tensorflow/include
./tensorflow/_api
./tensorflow/__init__.py
./tensorflow/contrib
./tensorflow/examples
./tensorflow/compiler
./tensorflow-1.14.0.dist-info
./tensorflow-1.14.0.dist-info/RECORD
./tensorflow-1.14.0.dist-info/metadata.json
./tensorflow-1.14.0.dist-info/WHEEL
./tensorflow-1.14.0.dist-info/entry_points.txt
./tensorflow-1.14.0.dist-info/DESCRIPTION.rst
./tensorflow-1.14.0.dist-info/top_level.txt
./tensorflow-1.14.0.dist-info/METADATA

Actual Behavior

When inspecting the resulting lambda zip you can see the following folders:

./tensorflow-1.14.0.data
./tensorflow-1.14.0.data/purelib
./tensorflow-1.14.0.dist-info
./tensorflow-1.14.0.dist-info/RECORD
./tensorflow-1.14.0.dist-info/metadata.json
./tensorflow-1.14.0.dist-info/WHEEL
./tensorflow-1.14.0.dist-info/entry_points.txt
./tensorflow-1.14.0.dist-info/DESCRIPTION.rst
./tensorflow-1.14.0.dist-info/top_level.txt
./tensorflow-1.14.0.dist-info/METADATA

As a result, we get the following error when running the lambda function

No module named 'tensorflow'

Steps to Reproduce

I only tested it with tensorflow=1.14.0 but it seems like a general problem with all wheels that are purelibs as zappa only extracts them and does no further processing see -> https://github.com/Miserlou/Zappa/blob/master/zappa/core.py#L659

Here is the whl -> tensorflow=1.14.9 from https://pypi.org/project/tensorflow/1.14.0/#files

github-actions[bot] commented 7 months ago

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

github-actions[bot] commented 6 months ago

Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.