-
Notifications
You must be signed in to change notification settings - Fork 293
Lambda load error: importlib_metadata.PackageNotFoundError: importlib_metadata #441
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
Comments
This comment has been minimized.
This comment has been minimized.
The issue here (I think) is that Here's a workaround: modify the pythonRequirements:
slim: true
slimPatternsAppendDefaults: false
slimPatterns:
- '**/*.py[c|o]'
- '**/__pycache__*' Also note that if you were using previously cached pip files (which is on by default), you may also want to disable cache before deploying: pythonRequirements:
useDownloadCache: false
useStaticCache: false
slim: true
slimPatternsAppendDefaults: false
slimPatterns:
- '**/*.py[c|o]'
- '**/__pycache__*' Ultimately the |
I just bumped into the same error after adding a dependency and then having to figure out that one of the transitive dependencies is relying on dist-info files. I would also vote for removing the |
I just ran into this problem as well; however, in my case, I'm using the Poetry also adds the I'm currently working around with the following snippet in my package import logging
from importlib_metadata import version
logger = logging.getLogger(__name__)
try:
__version__ = version(__package__)
except:
# The serverless-python-requirements plugin installs package dependencies
# without installing this package, which leaves out the package metadata
# from the generated zip file
logger.warning("Unable to get package version - setting to 0.0.0")
__version__ = "0.0.0" Is my problem different enough from this to warrant a new issue? |
Thanks a lot for this, it fixed my issue! One thing though -- if I set the caches back to true after disabling them, I hit the issue again. Were you ever able to get it to work with the caches or did you have to keep them disabled? Thanks! |
Unable to get Lambda loading with the configuration below:
versions
requirements.txt
serverless.yml snippet
ERROR on Lambda Load
The text was updated successfully, but these errors were encountered: