I created a layer and it did work.

0

Here is the context of my zip file.
I installed a python package with "python setup.py install --prefix=." command.
And this package doesn't exist on pypi so I have to install this way.

zip -sf test.zip  
Archive contains:  
  python/  
  python/openapi_client.egg-info/  
  python/openapi_client.egg-info/top_level.txt  
  python/openapi_client.egg-info/dependency_links.txt  
  python/openapi_client.egg-info/requires.txt  
  python/openapi_client.egg-info/PKG-INFO  
  python/openapi_client.egg-info/SOURCES.txt  
  python/dist/  
  python/dist/openapi_client-1.0.0-py3.8.egg  
  python/lib/  
  python/lib/python3.8/  
  python/lib/python3.8/site-packages/  
  python/lib/python3.8/site-packages/openapi_client-1.0.0-py3.8.egg  
  python/build/  
  python/build/bdist.linux-x86_64/  
已提问 2 年前284 查看次数
1 回答
0

Have you tried doing zip -r test.zip - that works for the layers I have here.

profile pictureAWS
专家
已回答 2 年前
  • Yeah, I used this command to build test.zip file. I used the same procedure to build another layer which contains some packages piped from pypi and it worked. So I'm pretty sure the procedure is correct. But I don't know why this layer doesn't work.

  • I'd suggest creating smaller, less complex layers. If they work then gradually work your way up to things that are more complex (such as your example) to see where things are breaking. Are you building the layer on an Amazon Linux EC2 instance?

  • Yes, I built it on a EC2 instance. This layer only contains one package. I wonder if it's because the file in this package is egg file not .py file so that it can't be recognized?

  • Here is the runtime error message: ''' { "errorMessage": "Unable to import module 'lambda_function': No module named 'openapi_client'", "errorType": "Runtime.ImportModuleError", "stackTrace": [] } '''

  • I've only ever tried building layers with .py files so that's definitely a place to check.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则