Python error in serverless framework stating - Serverless Error: spawn docker ENOENT

103
April 11, 2022, at 02:40 AM

Error:

Running "serverless" from node_modules
Deploying serverless-flask to stage dev (us-east-1)
✖ Stack serverless-flask-dev failed to deploy (0s)
Environment: darwin, node 16.0.0, framework 3.1.1 (local) 3.1.1v (global), plugin 6.0.0, SDK 4.3.1
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues
Error:
Error: spawn docker ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

I'm following these instructions (https://www.serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/) and can't seem to figure this out since the base app is in python and not javascript... most people who have solved this solved it using javascript.

Answer 1

To solve this issue you need to update your serverless.yml file with these changes in the custom block

custom:
  pythonRequirements:
  pythonBin: python3
  dockerizePip: "false"

I also face the same issue my issue was with dockerizePip it was set to

dockerizePip: non-linux

either remove this entry from serverless.yml file or just set it to false

Answer 2

To be able to deploy your project with serverless-python-requirements you need to have docker on your machine (if you are on windows consider using docker desktop or a linux vm)

Why do I need Docker ?

When you do a sls deploy, serverless-python-requirements launch a docker container to install all the dependencies you've put in your requirements.txt file that will be used during the deployement process

You are getting this error because your container is not launch correctly

Rent Charter Buses Company
READ ALSO
Python/increase code efficiency about multiple columns filter

Python/increase code efficiency about multiple columns filter

I was wondering if someone could help me find a more efficiency way to run my code

128
How to groupby a column and count the number of unique values in another column

How to groupby a column and count the number of unique values in another column

I have the following dataframeI need to groupby the ngram, and for each group, count how many unique documents are present in the DocID column

111
How to replace pixel data in same DICOM file using pyDicom to read it again with any DICOM viewer?

How to replace pixel data in same DICOM file using pyDicom to read it again with any DICOM viewer?

I want to read some DICOM files, so I'm testing pydicom for my work, which I think is considerably useful

122