'lambda_function': cannot import name 'etree' from 'lxml' python3.9 after update from python 3.6

Viewed 15

I'm re-asking this question at a later time in hopes of catching the attention of some North American colleges. Original post 'lambda_function': cannot import name 'etree' from 'lxml' python3.9

So I recently switched my Lambda function to python 3.9 as Python 3.6 is no longer available. This caused the library 'lxml' to break with the following error

code:

from lxml import html

Error:

 "Unable to import module 'lambda_function': cannot import name 'etree' from 'lxml' (/opt/python/lib/python3.9/site-packages/lxml/__init__.py)"

I've tried to re-download all packages, recreate the layer, and completely build the solution from scratch to no effect.

The solution works perfectly fine on my local machine running python 3.9, however on Lambda it fails.

Just a side note, back when I created this lambda function the same error occurred, and the go-to solution was to use Python 3.6 but obviously, this is not available now.

AWS region EU-Central-1

0 Answers
Related