serverless-python-requirements
serverless-python-requirements copied to clipboard
Error Deploying with dockerizePip true
Getting this error on sls deploy
Error: docker run --rm -v /Library/Caches/serverless-python-requirements/479953baaa6395d6d18bb6db8935af2fa13b0c841bbeb72ae8ddca94f69e38bf_x86_64_slspyc:/var/task:z -v /Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.8 /bin/sh -c python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && find /var/task -name \*.so -exec strip \{\} \;
Exited with code 2
serverless.yml
service: image-service
frameworkVersion: '3'
provider:
name: aws
runtime: python3.8
package:
# individually: true
exclude:
- api/__tests__/**
- api-schemas/**
- node_modules/cache/**
- venv/**
- .pytest_cache/**
plugins:
# - serverless-layers
- serverless-python-requirements
custom:
# serverless-layers:
# layersDeploymentBucket: image-service-layers
# dependencies: './requirements.txt'
pythonRequirements:
dockerizePip: non-linux
noDeploy:
- pytest
zip: true
slim: true
functions:
imageSimilarity:
# TODO: this doesn't work offline: https://github.com/dherault/serverless-offline/issues/993
handler: api/image_similarity.handler
events:
- http:
private: true
path: /v1/image-similarity
method: post
cors: true
request:
schemas:
application/json: ${file(api-schemas/image-similarity.json)}
requirements.txt
numpy==1.22.1
opencv-python==4.5.5.64
attrs==21.4.0
boto3==1.21.36
botocore==1.24.36
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
cryptography==36.0.2
idna==3.3
iniconfig==1.1.1
Jinja2==3.1.1
jmespath==1.0.0
MarkupSafe==2.1.1
moto==3.1.4
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycparser==2.21
pyparsing==3.0.7
pytest==7.1.1
+1
Same here!
This behavior can - amongst other things - be caused by a bad encoding of your requirements.txt
file. Check if it's UTF-8 or ASCII. If it's not, convert it, clear your cache, and try again. See https://github.com/serverless/serverless-python-requirements/issues/695#issuecomment-1203745734 for avoiding the bad encoding (in PowerShell)
Can confirm I'm seeing the same issue, but my file encoding is fine
$ poetry export -o requirements.txt --format=requirements.txt
$ file -bi requirements.txt
text/plain; charset=us-ascii
Ignore the above, my problem was totally unrelated! 😵💫
I've been hitting the same issue myself when trying to run a serverless deploy
from an AWS codebuild project. Anyone figure out a solution?