-
Notifications
You must be signed in to change notification settings - Fork 1k
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
{"errorMessage": "Unable to import module 'app'"} #106
Comments
I think this is the same root cause as #105. We don't have support for C extensions. Another way you can see this error is if you turn on
I'm going to update our docs to state the limitations we have right now for python packages to help others that might run into this issue. |
@jamesls Ok so basically we cannot use |
I'm seeing this same error when I try to use andymccurdy/redis-py. |
I have found this article about the limitations of C libraries for Python modules. |
@wittfabian |
Basically the idea to make this work is to compile the required non-python extensions in the same environment as the environment that Lambda runs, which is an Amazon Linux instance, and include them in the zipped package. I don't know how this can be integrated into chalice but here are 2 related links: |
@onurmatik so it should work as in the python lambda implementation. The best way would be to use |
@fidiego redis-py doesn't have any required C deps (as far as I know) so adding it to your requirements.txt should work. Here's what I tried:
Let me know if that's not working for you. |
As for numpy/binary file support I have a few ideas for how to making working with both C extensions as well as custom binaries easier. I see two ways to go (maybe it's worth doing both): First one: Provide a hook into adding arbitrary data into the deployment zip file we send to lambda. That way as we're adding files to the zip file we can give you a chance to inject any prebuilt binaries. I think that supporting a "on-build" hook would make this possible, something generic like:
This is probably more useful to address #42. The second option is to try to leverage the manylinux1 wheels. I'm not exactly sure how to plumb this in, but many libraries are starting to provide manylinux wheel files (numpy, sklearn) The latest version of pip let's you override the platform/arch to use, so the idea would be to ask it to use manlinux wheels's when building out the virtualenv to send to lambda. I'd have to experiment with this approach more to see if I could get it working, but the benefit of this approach would be that it would "just work", you wouldn't have to do anything (provided your 3rd party librarys have manylinux1 wheels). |
This error could be related to this issue #105
My
app.py
is importing a 3rdparty module likethat I have successfully installed via
pip install --upgrade -r requirements.txt
as explained in the related issue, but it seems it has not been deployed correctly by chalice on the lambda machine.My virtualenv looks like this
The text was updated successfully, but these errors were encountered: