#🔒 NumPy dependency

10 messages · Page 1 of 1 (latest)

cedar gorge
#

Hi! Does anyone have experience with AWS Lambda? I wanna deploy a flask application on AWS lambda, but this is my first time, and I keep getting a bunch of dependency error like:

[ERROR] Runtime.ImportModuleError: Unable to import module 'app': 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "/var/lang/bin/python3.11"
  * The NumPy version is: "1.24.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

I have already tried everything. How I set it up was I have a requirements.txt list. Then I created a python 3.11 venv environment, installed all dependencies, then I copied all the /venv/lib/python3.11/site-packages into the root repository (along with my app.py), turned everything into a zip, then uploaded it to AWS Lambda.

granite nebulaBOT
#

@cedar gorge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

onyx helm
#

basically: aws lambda doesn't actually let you install stuff to the virtual environment, so you have to import pypi packages as if they're local imports.

#

take special note of the Working with built distributions (wheels) section, since numpy is typically installed a wheel

cedar gorge
#

but it still didn't work specifically for numpy. seems like the other libraries worked fine though, so i thought it was something wrong with how i installed numpy specifically.

cedar gorge
granite nebulaBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.