Maybe you're packaging you dependencies wrong. for adding layer to the lambda function you should follow the below steps:
mkdir -p openapi/python && cd openapi/python
pip install openapi -t .
zip -r openapi.zip openapi/
then upload the zip. please confirm that this step is ok.