AWS lambda tensorflow

0

Hi, my Lambda is a container image. When I test, raise this error:

LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html [ERROR] Runtime.ImportModuleError: Unable to import module 'dowork': cannot import name 'parse' from 'urllib3' (/var/task/urllib3/__init__.py) Traceback (most recent call last):

This is my "import" section:

import json
from mediapipe import solutions
from mediapipe.framework.formats import landmark_pb2
import numpy as np
import mediapipe as mp
from mediapipe.tasks import python
from mediapipe.tasks.python import vision
#from rembg import remove
from PIL import Image
from io import BytesIO
import cv2
import boto3
from urllib3 import parse
Luca
asked a month ago867 views
1 Answer
0
Accepted Answer

This is peculiar because urllib3 does not have a top-level module or function named parse; it's more likely that you intended to import something specific from within urllib3. If your intention was to use URL parsing functionalities, those are typically found in the urllib.parse module (part of the standard library in Python 3), not urllib3. Ensure that you're importing what you actually need. If you're looking for functionality that resides within urllib.parse, you should correct the import statement accordingly:

from urllib.parse import urlparse, urlencode, parse_qs, parse_qsl

If this has answered your question or was helpful, accepting the answer would be greatly appreciated. Thank you!

profile picture
EXPERT
answered a month ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions