Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverless deploy -> Exited with code 1 #663

Open
4 tasks done
StayFoolisj opened this issue Jan 18, 2022 · 74 comments
Open
4 tasks done

serverless deploy -> Exited with code 1 #663

StayFoolisj opened this issue Jan 18, 2022 · 74 comments

Comments

@StayFoolisj
Copy link

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I'm using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

Error: docker run --rm -v /Users/bad_ape/Library/Caches/serverless-python-requirements/36d8e2271e2d9e8afb4b103da1d57dc91ab0ccc62422d1337b5a3a91dcc7c2d9_x86_64_slspyc:/var/task:z -v /Users/bad_ape/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache Exited with code 1

Service configuration (serverless.yml) content

service: liqs

frameworkVersion: '2'

provider:
  name: aws
  runtime: python3.8
  lambdaHashingVersion: 20201221

functions:
  hello:
    handler: lambda_function.hello

plugins:
  - serverless-python-requirements
 
custom:
  pythonRequirements:
    dockerizePip: non-linux

Command name and used flags

serverless deploy

Command output

Serverless: Running "serverless" installed locally (in service node_modules)
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command requirements
Serverless: Load command requirements:clean
Serverless: Load command requirements:install
Serverless: Load command requirements:cleanCache
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Skipping variables resolution with old resolver (new resolver reported no more variables to resolve)
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Generated requirements from /Users/bad_ape/Downloads/liquidations_v2-8d3d697e-5a0a-4f55-9920-31ee9b80ac90/liqs_pipeline_1/requirements.txt in /Users/bad_ape/Downloads/liquidations_v2-8d3d697e-5a0a-4f55-9920-31ee9b80ac90/liqs_pipeline_1/.serverless/requirements.txt...
Serverless: Installing requirements from /Users/bad_ape/Library/Caches/serverless-python-requirements/36d8e2271e2d9e8afb4b103da1d57dc91ab0ccc62422d1337b5a3a91dcc7c2d9_x86_64_slspyc/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.8
Serverless: Using download cache directory /Users/bad_ape/Library/Caches/serverless-python-requirements/downloadCacheslspyc
Serverless: Running docker run --rm -v /Users/bad_ape/Library/Caches/serverless-python-requirements/36d8e2271e2d9e8afb4b103da1d57dc91ab0ccc62422d1337b5a3a91dcc7c2d9_x86_64_slspyc\:/var/task\:z -v /Users/bad_ape/Library/Caches/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z -u 0 lambci/lambda\:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache...
Serverless: [AWS sts 200 1.37s 0 retries] getCallerIdentity({})

 Error ---------------------------------------------------

  Error: `docker run --rm -v /Users/bad_ape/Library/Caches/serverless-python-requirements/36d8e2271e2d9e8afb4b103da1d57dc91ab0ccc62422d1337b5a3a91dcc7c2d9_x86_64_slspyc:/var/task:z -v /Users/bad_ape/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache` Exited with code 1
      at ChildProcess.<anonymous> (/Users/bad_ape/Downloads/liquidations_v2-8d3d697e-5a0a-4f55-9920-31ee9b80ac90/liqs_pipeline_1/node_modules/child-process-ext/spawn.js:38:8)
      at ChildProcess.emit (node:events:390:28)
      at ChildProcess.emit (node:domain:475:12)
      at maybeClose (node:internal/child_process:1062:16)
      at Socket.<anonymous> (node:internal/child_process:448:11)
      at Socket.emit (node:events:390:28)
      at Socket.emit (node:domain:475:12)
      at Pipe.<anonymous> (node:net:687:12)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              17.2.0
     Framework Version:         2.72.0 (local)
     Plugin Version:            5.5.3
     SDK Version:               4.3.0
     Components Version:        3.18.1

Environment information

Serverless: Running "serverless" installed locally (in service node_modules)
Framework Core: 2.72.0 (local)
Plugin: 5.5.3
SDK: 4.3.0
Components: 3.18.1

MacOS Monterey 12.0.1
MB Pro 2021
Chip: Apple M1 Pro
@medikoo
Copy link
Contributor

medikoo commented Jan 18, 2022

Issue looks as specific to serverless-python-requirements plugin, moving it there

@medikoo medikoo transferred this issue from serverless/serverless Jan 18, 2022
@ftruzzi
Copy link

ftruzzi commented Jan 19, 2022

Seeing this issue on Gitlab CI. Possible solution: downgrade node to v16. not sure, see below

@vivianedias-tw
Copy link

hey @medikoo I'm facing the same issue here. Where did you move the issue?

@medikoo
Copy link
Contributor

medikoo commented Jan 19, 2022

Where did you move the issue?

Here

@patalwell
Copy link

I tried Node V16, still get a the same error on my mac.

 Error ---------------------------------------------------
 
  Error: `docker run --rm -v /Users/patalwell/Library/Caches/serverless-python-requirements/f4b4cffcac01d03e573bc9fb87d6d9e96378ee0b2e232c53d182e16ca5364748_x86_64_slspyc:/var/task:z -v /Users/patalwell/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -e AWS_CA_BUNDLE=/Users/patalwell/Certificates/ca_bundle.pem -u 0 lambci/lambda:build-python3.7 /bin/sh -c python3.7 -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 1
      at ChildProcess.<anonymous> (/Users/patalwell/Development/cloudshield-reports-aggregator/cloudshield-reports-aggregator/node_modules/child-process-ext/spawn.js:38:8)
      at ChildProcess.emit (node:events:390:28)
      at ChildProcess.emit (node:domain:475:12)
      at maybeClose (node:internal/child_process:1064:16)
      at Socket.<anonymous> (node:internal/child_process:450:11)
      at Socket.emit (node:events:390:28)
      at Socket.emit (node:domain:475:12)
      at Pipe.<anonymous> (node:net:687:12)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              16.13.2
     Framework Version:         2.71.0
     Plugin Version:            5.5.3
     SDK Version:               4.3.0
     Components Version:        3.18.1

@ftruzzi
Copy link

ftruzzi commented Jan 19, 2022

@patalwell uh sorry, the issue must be somewhere else then. Now that I looked again I'm seeing failures with node 16 as well.

All I know is that on my CI it fails using nikolaik/python-nodejs:latest (which is node 16 anyway) as docker base image and it works with nikolaik/python-nodejs:python3.8-nodejs16. So maybe the Python version, or something else?

@vivianedias-tw
Copy link

In order to use those two versions you mentioned should I set this docker image in the serverless config? @ftruzzi

@ftruzzi
Copy link

ftruzzi commented Jan 19, 2022

@vivianedias-tw no, I was just saying that, given the same serverless config and packages, it fails with serverless running under the first docker image and it works under the second one

@patalwell
Copy link

Tried with python 3.7 and python3.8, still same issue.

provider:
  name: aws
  runtime: python3.8 | python3.7
  
  #  lambci/lambda:build-python3.8

Defaults to container for lambda builds and runtime selected.

@biximilien
Copy link

I'm experiencing the same issue, I think it is due to this docker run command:

docker run --rm -v /home/biximilien/Projects/ACN/be-lambdas/services/tag/.serverless/requirements:/var/task:z -v /home/biximilien/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z sls-py-reqs-custom /bin/sh -c chown -R 0\:0 /var/useDownloadCache && python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 1000\:1000 /var/task && cp /usr/lib64/mysql57/libmysqlclient.so.1020 /var/task/ && chown -R 1000\:1000 /var/useDownloadCache && find /var/task -name \*.so -exec strip \{\} \;` Exited with code 1

When running the first part:

docker run --rm -v /home/biximilien/Projects/ACN/be-lambdas/services/tag/.serverless/requirements:/var/task:z -v /home/biximilien/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z sls-py-reqs-custom /bin/sh -c chown -R 0\:0 /var/useDownloadCache 
chown: missing operand

Adding quotes around the bin/sh'd command string fixes it.

docker run --rm -v /home/biximilien/Projects/ACN/be-lambdas/services/tag/.serverless/requirements:/var/task:z -v /home/biximilien/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z sls-py-reqs-custom /bin/sh -c "chown -R 0\:0 /var/useDownloadCache && python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 1000\:1000 /var/task && cp /usr/lib64/mysql57/libmysqlclient.so.1020 /var/task/ && chown -R 1000\:1000 /var/useDownloadCache && find /var/task -name \*.so -exec strip \{\} \;"

I'll try to submit a pull request

@biximilien
Copy link

biximilien commented Jan 19, 2022

I'll try to submit a pull request
See #664

@agneeshdg
Copy link

I'm facing almost the same error in a Python 3.9 runtime, but with a different error code of 125 on my Mac:
Error: docker run --rm -v /Users/adasgup/apps/myproject/.serverless/requirements:/var/task:z -v /Users/adasgup/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.9 python3.9 -m pip install --no-cache-dir --find-links reqs/wheels -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache Exited with code 125

@StayFoolisj
Copy link
Author

I'm facing almost the same error in a Python 3.9 runtime, but with a different error code of 125 on my Mac: Error: docker run --rm -v /Users/adasgup/apps/myproject/.serverless/requirements:/var/task:z -v /Users/adasgup/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.9 python3.9 -m pip install --no-cache-dir --find-links reqs/wheels -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache Exited with code 125

I believe this is the error you get when Docker is not running?

@pgrzesik
Copy link
Contributor

Hello everyone, thanks a lot for the reports. I've tried to reproduce the issue but with no luck - it works fine for me with the following config + requirements.

service: python-docker-bug

provider:
  name: aws
  runtime: python3.8
  lambdaHashingVersion: 20201221

functions:
  hello:
    handler: lambda_function.hello

plugins:
  - serverless-python-requirements
 
custom:
  pythonRequirements:
    dockerizePip: non-linux
requests

I'm using Node v16.13.0 and I'm on a Mac (Big Sur, M1 chip). Could anyone provide a complete reproducible example, ideally with requirements/pipfile/pyproject.toml ?

@biximilien
Copy link

I did some more testing this morning and confirmed the fix I suggested was in fact not working.

The issue was that I confused the serverless error description with the command being ran, the description had the command not properly quoted, but the command being ran was properly quoted.

In my case, the cause of the error was a file not found in this setting:

dockerExtraFiles:
      - /usr/lib64/mysql/libmysqlclient.so.21

Resolving this path fixed my problem.

@agneeshdg
Copy link

I followed the instructions on the tutorial to start and deploy a new project, and am now getting the exit code 1 error. https://www.serverless.com/blog/serverless-python-packaging/
My requirements are just:
numpy==1.22.1

For the tutorial, I am running it in a Python 3.6 runtime on a Mac with Intel Core i7 processor.

@pgrzesik
Copy link
Contributor

Can you share a bit more @agneeshdg ? Do you have docker installed locally? I've tried to reproduce with numpy but it also works correctly

@agneeshdg
Copy link

Hi @pgrzesik I do have Docker installed and running locally. Is there any additional Docker configuration I need to do?

@patalwell
Copy link

@pgrzesik let me try to use your config params. I'm not sure non-linux would work with serverless since lambda inherently uses a linux OS. Glad to see Docker community has support for M1 chip though! That was a pain point for me in the past. Did you also happen to run the lambda?

@patalwell
Copy link

@pgrzesik tested your params, same issues. What does your package.json look like?

@pgrzesik
Copy link
Contributor

pgrzesik commented Jan 21, 2022

I'm not sure non-linux would work with serverless since lambda inherently uses a linux OS.

non-linux means that it will use Docker for packages installation/building instead of your native OS for that exact reason. I didn't deploy the Lambda afterward but the building process went just fine. As for my package.json - it only has servelress-python-requirements as a dev dependency.

@patalwell - could you upload a small repro example that I could run as-is on my side? Maybe there's something niche in our setups that makes the difference?

@pgrzesik
Copy link
Contributor

Hi @pgrzesik I do have Docker installed and running locally. Is there any additional Docker configuration I need to do?

Nope, that should be enough - could you run it with --verbose flag and/or SLS_DEBUG=1 env var for getting more context for the error you're getting?

@mgermy
Copy link

mgermy commented Jan 25, 2022

I'm having exactly the same problem, but instead of Exited with code 1 it says code 2. Not sure what to do 😕

@pgrzesik
Copy link
Contributor

Hello @mgermy 👋 Would you be able to provide more context around your specific case? Maybe you could provide a small reproducible example that I can run on my side?

@mgermy
Copy link

mgermy commented Jan 25, 2022

@pgrzesik I created an example so you could run the same on your side. I only omitted my AWS role and profile. My node version is v16.13.2.

Below you'll find a screenshot of the error and the files used to run it.

Screen Shot 2022-01-25 at 19 57 05

aws-python-project.zip

@mgermy
Copy link

mgermy commented Jan 25, 2022

I tried running the docker run command and it gives me the following error:
Screen Shot 2022-01-25 at 21 07 14

Maybe it's something related to some permission problems?

@patalwell
Copy link

Looks like you have a symlink or dependecy issue

I tried running the docker run command and it gives me the following error: Screen Shot 2022-01-25 at 21 07 14

Maybe it's something related to some permission problems?

You'e trying to run Python 3.9 with Docker, but I'm seeing stack traces for Python 3.8. I'd make sure the version is what you expect and the permissions for the Docker mounts are tangible ; e.g docker is able to mount to your local disk.

@pgrzesik
Copy link
Contributor

Thanks a lot @mgermy - I've tried to reproduce your specific issue and it seems like the problem is the python3.9 runtime. When packaging with docker, it tries to do it with lambci/lambda:build-python3.9 image that is not available - the latest available is for python3.8. I think the options here would be to

  1. Check before trying to run packaging if the runtime is supported with docker, if not error out
  2. Bring support for python3.9 runtime with docker

@patalwell Did you manage to resolve the problem on your side?

@mgermy
Copy link

mgermy commented Jan 30, 2022

@pgrzesik thanks for taking for taking a look at it for me.

After a few hours trying to figure it out, I found out that the problem was with the installation of serverless on my computer. I suggest for anyone who is having the same problem to check with a simple ls -la if the folder where you're running serverless has enough permission to run. For example, in my folder I had the .serverless folder with the ownership for root, not my user. Once I changed the ownership to my user, serverless was able to run without problems

@takeda
Copy link

takeda commented Mar 18, 2022

I see similar issue, but when invoking python3.9 -m pip help install

00:00:09 Environment: linux, node 14.19.0, framework 3.7.8 (local), plugin 6.1.5, SDK 4.3.2
00:00:09 Credentials: Local, environment variables
00:00:09 Docs:        docs.serverless.com
00:00:09 Support:     forum.serverless.com
00:00:09 Bugs:        github.com/serverless/serverless/issues
00:00:09 
00:00:09 Error:
00:00:09 Error: `python3.9 -m pip help install` Exited with code 1
00:00:09     at ChildProcess.<anonymous> (/nix/store/gna6q42v03acmxnxqkrbvvj0krba24ry-amiman-0.1.0/node_modules/child-process-ext/spawn.js:38:8)
00:00:09     at ChildProcess.emit (events.js:400:28)
00:00:09     at ChildProcess.emit (domain.js:475:12)
00:00:09     at maybeClose (internal/child_process.js:1058:16)
00:00:09     at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)

Interestingly everything works perfectly fine when using python3.8 (yes, I cleaned cache between runs)

@HansonVPHAM
Copy link

I got the same issue but when I check the requirements.txt file and I see one version of my library was not correct at all.
Please make sure requirements.txt is correct.

@jaren82
Copy link

jaren82 commented Mar 22, 2022

I'm facing almost the same error in a Python 3.9 runtime, but with a different error code of 125 on my Mac: Error: docker run --rm -v /Users/adasgup/apps/myproject/.serverless/requirements:/var/task:z -v /Users/adasgup/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.9 python3.9 -m pip install --no-cache-dir --find-links reqs/wheels -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache Exited with code 125

Hi I had the same problem
So I found a solution and tried it And I succeeded
You try delete unused docker images.

docker volume rm $(docker volume ls -qf dangling=true)

docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
docker images -a | sed '1 d' | awk '{print $3}' | xargs -L1 docker rmi -f

@lorisleitner
Copy link

I got the error when pip freeze > requirements.txt was written in UTF-16 encoding. Changed the encoding to UTF-8 and it's working now.

@takeda
Copy link

takeda commented Apr 15, 2022

I think it's obvious that while #679 added extra logging, there's still more places where logs need to be added as different people have different reasons why pip "Exited with code 1".

@tho-actrecipe
Copy link

I got the same issue, would anyone guide me how to fix it?

Environment: linux, node 16.13.2, framework 3.15.2, plugin 6.2.2, SDK 4.3.2

Error: `python3.8 -m pip install -t /home/circleci/.cache/serverless-python-requirements/40acc2eb357179bb6100e638b660c2ac27ccd91e1a3af89a05c2b7ba5d4f9d76_arm64_slspyc -r /home/circleci/.cache/serverless-python-requirements/40acc2eb357179bb6100e638b660c2ac27ccd91e1a3af89a05c2b7ba5d4f9d76_arm64_slspyc/requirements.txt --cache-dir /home/circleci/.cache/serverless-python-requirements/downloadCacheslspyc` Exited with code 1
    at ChildProcess.<anonymous> (/home/circleci/repo/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12)

Exited with code exit status 1

@milkon-fishbrain
Copy link

I tried Node V16, still get a the same error on my mac.

 Error ---------------------------------------------------
 
  Error: `docker run --rm -v /Users/patalwell/Library/Caches/serverless-python-requirements/f4b4cffcac01d03e573bc9fb87d6d9e96378ee0b2e232c53d182e16ca5364748_x86_64_slspyc:/var/task:z -v /Users/patalwell/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -e AWS_CA_BUNDLE=/Users/patalwell/Certificates/ca_bundle.pem -u 0 lambci/lambda:build-python3.7 /bin/sh -c python3.7 -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 1
      at ChildProcess.<anonymous> (/Users/patalwell/Development/cloudshield-reports-aggregator/cloudshield-reports-aggregator/node_modules/child-process-ext/spawn.js:38:8)
      at ChildProcess.emit (node:events:390:28)
      at ChildProcess.emit (node:domain:475:12)
      at maybeClose (node:internal/child_process:1064:16)
      at Socket.<anonymous> (node:internal/child_process:450:11)
      at Socket.emit (node:events:390:28)
      at Socket.emit (node:domain:475:12)
      at Pipe.<anonymous> (node:net:687:12)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              16.13.2
     Framework Version:         2.71.0
     Plugin Version:            5.5.3
     SDK Version:               4.3.0
     Components Version:        3.18.1

Hi,
I had the same problem and everything worked fine after I started the docker app on my MacBook, so docker need to be running before "serverless deploy"

@jorenvh1
Copy link

jorenvh1 commented May 18, 2022

I had the same issue and after running sls deploy --verbose I got this output:

ERROR: No matching distribution found for boto3==1.23.2
WARNING: You are using pip version 21.3.1; however, version 22.1 is available.
You should consider upgrading via the '/var/lang/bin/python3.9 -m pip install --upgrade pip' command.

I'm using dockerImage: mlupin/docker-lambda:python3.9-build and probably has an outdated version of pip.
Using a different image with an updated pip version will probably work.
Downgrading to boto3 1.23.1 is already a quickfix in this case.

@morgan-young
Copy link

morgan-young commented May 19, 2022

Hey, I am still struggling with this... can installing an older version of serverless-python-requirements help? This is really frustrating

Update

It turned out I was missing this, specifically for python 3.8:

ModuleNotFoundError: No module named 'distutils.cmd'

This wasn't letting pip run so was stopping pip from doing the thing with the requirements.

So, I installed it specifically for python 3.8 - sudo apt install python3.8-distutils and then ran sls deploy with dockerizePip set to True and it still failed (don't know why, docker 🤷), but then I set it to False so it used pip and now it works.

I'd still really appreciate a proper reason why the dockerizePip = Trrue seems to be causing issues. Thanks

@steventhanna
Copy link

Perhaps unrelated, but I was getting the same error message as everyone else and realized that I had a package in my requirements.txt that didn't exist in PyPi. Removing that package allowed the deployment to continue.

@vteran93
Copy link

vteran93 commented May 27, 2022

Same error as @StayFoolisj.

I am running it in an circleCI environment with Debian Buster. I constructed and pushed the image to ECR using awscli and docker.

Serverless: [AWS ssm 200 0.097s 0 retries] getParameter({ Name: '/some/develop/stripe/api_key', WithDecryption: true })
Serverless: [AWS ssm 200 0.093s 0 retries] getParameter({ Name: '/some/gj_etl_dev/password', WithDecryption: true })
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Using Python specified in "runtime": python3.8
Serverless: Packaging Python WSGI handler...
Serverless: Generated requirements from /root/project/requirements.txt in /root/project/.serverless/requirements.txt...
Serverless: Installing requirements from /root/.cache/serverless-python-requirements/a2ea73dc49988805a15c032f014bf5554e49fa57a518148e4d4f91a35befaeb7_x86_64_slspyc/requirements.txt ...
Serverless: Docker Image: ********.dkr.ecr.*********.amazonaws.com/some-dependencies:${ENVIRONMENT}
Serverless: Using download cache directory /root/.cache/serverless-python-requirements/downloadCacheslspyc
Serverless: Running docker run --rm -v /root/.cache/serverless-python-requirements/a2ea73dc49988805a15c032f014bf5554e49fa57a518148e4d4f91a35befaeb7_x86_64_slspyc\:/var/task\:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z *******.dkr.ecr.*********.amazonaws.com/some-dependencies:\$\{ENVIRONMENT\} /bin/sh -c 'chown -R 0\\:0 /var/useDownloadCache && python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\\:0 /var/task && chown -R 0\\:0 /var/useDownloadCache'...
Serverless: [AWS sts 200 0.056s 0 retries] getCallerIdentity({})
 
 Error ---------------------------------------------------
 
  Error: `docker run --rm -v /root/.cache/serverless-python-requirements/a2ea73dc49988805a15c032f014bf5554e49fa57a518148e4d4f91a35befaeb7_x86_64_slspyc:/var/task:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z 500345361576.dkr.ecr.*********.amazonaws.com/some-dependencies:${ENVIRONMENT} /bin/sh -c chown -R 0\:0 /var/useDownloadCache && python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\:0 /var/task && chown -R 0\:0 /var/useDownloadCache` Exited with code 125
      at ChildProcess.<anonymous> (/root/project/node_modules/child-process-ext/spawn.js:38:8)
      at ChildProcess.emit (node:events:394:28)
      at ChildProcess.emit (node:domain:475:12)
      at maybeClose (node:internal/child_process:1064:16)
      at Socket.<anonymous> (node:internal/child_process:450:11)
      at Socket.emit (node:events:394:28)
      at Socket.emit (node:domain:475:12)
      at Pipe.<anonymous> (node:net:672:12)

This is my configuration:

custom:
  wsgi:
    app: some.wsgi.application
  pythonRequirements:
    dockerImage: *****.dkr.ecr.us-east-2.amazonaws.com/some-dependencies:${ENVIRONMENT}
    dockerizePip: true
    usePoetry: false

The image was successfully built this way

FROM lambci/lambda:python3.8
USER root
COPY pyproject.toml .
COPY poetry.lock .
RUN pip install poetry
RUN poetry check && poetry export -f requirements.txt -o requirements.txt --without-hashes && poetry run pip install -r requirements.txt

Our requirements.txt is

aiobotocore==2.3.2; python_version >= "3.6"
aiofiles==0.7.0; python_version >= "3.6" and python_version < "4.0"
aiohttp==3.8.1; python_version >= "3.6"
aioitertools==0.8.0; python_version >= "3.6"
aiosignal==1.2.0; python_version >= "3.6"
aniso8601==7.0.0
asgiref==3.4.1; python_version >= "3.6" and python_version < "4.0"
async-timeout==4.0.1; python_version >= "3.6"
attrs==21.2.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
authlib==0.15.5
boto3==1.21.21; python_version >= "3.6"
botocore==1.24.21; python_version >= "3.6"
cached-property==1.5.2; python_version >= "3.6"
cachetools==4.2.4; python_version >= "3.5" and python_version < "4.0"
certifi==2021.10.8; python_full_version >= "3.6.0" and python_version >= "3.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
cffi==1.15.0; python_version >= "3.6"
charset-normalizer==2.0.9; python_full_version >= "3.6.0" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
cloudinary==1.28.1
cryptography==36.0.0; python_version >= "3.6"
deepmerge==1.0.1
defusedxml==0.7.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_version >= "3.7" and python_full_version >= "3.5.0"
deprecated==1.2.13; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
diff-match-patch==20200713; python_version >= "3.6"
django-admin-autocomplete-filter==0.7.1
django-admin-easy==0.6.1
django-admin-rangefilter==0.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
django-computedfields==0.1.5
django-cors-headers==3.10.1; python_version >= "3.6"
django-debug-toolbar==3.2.3; python_version >= "3.6"
django-dirtyfields==1.7.0; python_version >= "3.6"
django-extensions==3.1.5; python_version >= "3.6"
django-fernet-fields==0.6
django-fsm==2.8.0
django-graphiql-debug-toolbar==0.2.0; python_version >= "3.6" and python_version < "4.0"
django-impersonate==1.7.3
django-import-export==2.7.0; python_version >= "3.6"
django-localflavor==3.1
django-memoize==2.3.1
django-model-utils==4.2.0
django-nested-inline==0.4.4
django-polymorphic==3.1.0
django-storages==1.12.3; python_version >= "3.5"
django==3.2.13; python_version >= "3.6"
djangorestframework==3.13.0; python_version >= "3.6"
et-xmlfile==1.1.0; python_version >= "3.7"
expiringdict==1.1.4
fpdf2==2.4.6
frozenlist==1.2.0; python_version >= "3.6"
graphene-django==2.15.0
graphene==2.1.9; python_version >= "3.6" and python_version < "4.0"
graphql-core==2.3.2
graphql-relay==2.0.1
idna==3.3; python_full_version >= "3.6.0" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
isodate==0.6.1; python_version >= "3.6"
jmespath==0.10.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
json-log-formatter==0.4.0
launchdarkly-server-sdk==7.2.1
lxml==4.8.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
markuppy==1.14; python_version >= "3.7"
marshmallow-dataclass==8.5.3; python_version >= "3.6"
marshmallow==3.14.1; python_version >= "3.6"
multidict==5.2.0; python_version >= "3.6"
mypy-extensions==0.4.3; python_version >= "3.6"
odfpy==1.4.1; python_version >= "3.7"
openpyxl==3.0.9; python_version >= "3.7"
pdfrw==0.4
phonenumberslite==8.12.48
pillow==8.4.0; python_version >= "3.6"
platformdirs==2.5.1; python_version >= "3.7"
promise==2.3; python_version >= "3.6" and python_version < "4.0"
psycopg2-binary==2.9.3; python_version >= "3.6"
pycparser==2.21; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
pyjwt==2.3.0; python_version >= "3.6" and python_full_version >= "3.6.0"
pypdf2==1.27.5; python_version >= "2.7"
pyrfc3339==1.1
python-dateutil==2.8.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
python-http-client==3.3.4; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
python-slugify==6.1.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0")
python-stdnum==1.17
pytz==2021.3; python_version >= "3.6" and python_full_version >= "3.6.0" and python_version < "4.0"
pyyaml==5.4.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0")
requests-file==1.5.1; python_version >= "3.6"
requests-toolbelt==0.9.1; python_version >= "3.6"
requests==2.26.0; python_full_version >= "3.6.0" and python_version >= "3.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
rx==1.6.1
s3transfer==0.5.2; python_version >= "3.6"
semver==2.13.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
sendgrid==6.9.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
sentry-sdk==1.5.1
simple-salesforce==1.11.6
singledispatch==3.7.0; python_version >= "3.6" and python_version < "4.0"
six==1.16.0; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_full_version >= "3.3.0" and python_version >= "3.6" and python_version < "4.0"
sqlparse==0.4.2; python_version >= "3.6" and python_version < "4.0"
ssm-parameter-store==19.11.0
starkbank-ecdsa==2.0.3; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
stripe==2.63.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
tablib==3.2.1; python_version >= "3.7"
tblib==1.7.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
text-unidecode==1.3; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.0"
twilio==7.3.2; python_full_version >= "3.6.0"
typing-extensions==4.0.1; python_version >= "3.6"
typing-inspect==0.7.1; python_version >= "3.6"
urllib3==1.25.11; python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
watchtower==1.0.6; python_version >= "3.5"
werkzeug==1.0.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
wrapt==1.13.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
xlrd==2.0.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_version >= "3.7" and python_full_version >= "3.6.0"
xlwt==1.3.0; python_version >= "3.7"
yarl==1.7.2; python_version >= "3.6"
zeep==4.1.0; python_version >= "3.6"
zenpy==2.0.24

@takeda
Copy link

takeda commented Jul 6, 2022

@medikoo @pgrzesik could some more debugging be added, so more information is displayed than just error code 1 (maybe contents of stderr and stdout)? It's possible that each of us here has a different kind of issue and we are just piling up on this error. Having more information would also allow regular users to possibly find solution themselves as it is possible that it might be someting going on a local machine. For example many of us know that error code 125 is likely docker deamon not running, but if an output would be shown that person would likely resolve it himself.

@isimaka
Copy link

isimaka commented Jul 23, 2022

I'm facing almost the same error in a Python 3.9 runtime, but with a different error code of 125 on my Mac: Error: docker run --rm -v /Users/adasgup/apps/myproject/.serverless/requirements:/var/task:z -v /Users/adasgup/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.9 python3.9 -m pip install --no-cache-dir --find-links reqs/wheels -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache Exited with code 125

I believe this is the error you get when Docker is not running?

Serverless Framework, Python, Docker, AWS Lambda, Exited with code 125

@agneeshdg @StayFoolisj

I fixed the same problem.

No, in my case, Docker is running well.

Problem locates in the docker image: lambci/lambda:build-python3.9

On this image's docker hub, no such a tag. So Docker failed to pull the tag to local.

As @tb102122 mentioned under this issue, mlupin/docker-lambda:python3.9-build is suggested.

This worked for me.

@f00f
Copy link

f00f commented Aug 3, 2022

@reznok (maybe a bit late): your issue looks like the encoding issue, see #442 (comment) (as @stevetran-96 also mentioned, but with a broken link)

@AwolDes
Copy link

AwolDes commented Aug 12, 2022

Just adding my experience - this was fixed after using sls package --verbose finding that there's no 'lambci/lambda:build-python3.9' image, similar to what @isimaka has posted.

lambci/lambci#138

I have added dockerImage: public.ecr.aws/sam/build-python3.9:latest to my config

pythonRequirements:
    dockerizePip: non-linux
    dockerImage: public.ecr.aws/sam/build-python3.9:latest
    slim: true
    layer: true

Now it is packaging without a problem

@max-addison
Copy link

Much like @AwolDes said, the issue is with 'lambci/lambda:build-python3.9'. My 'fix' was just downgrading the python version by changing my serverless.yml file to:

provider:
  name: aws
  runtime: python3.8
  ...

@pgrzesik
Copy link
Contributor

Hey everyone in thread, I believe most of the issues reported here are caused by two things:

  1. Not great reporting of certain errors
  2. Lack of support for python3.9 when using Docker

Please look into PRs: #723 and #724 as they should improve the situation greatly.

@ghost
Copy link

ghost commented Oct 14, 2022

Yes, @pgrzesik, I changed the runtime from python 3.9 to python 3.8 and it deployed without problems. Do you know where can I find more templates and examples of build aws infrastructure using aws serverless or a course, thanks.

@pgrzesik
Copy link
Contributor

Hey @HeyVictorDanilo 👋 Glad to hear you've been able to resolve that issue. You can look for some examples here: https://github.com/serverless/examples

@RoniFinTech2
Copy link

Facing the same issue when using Python3.9 on Github Actions during CI.

Run serverless/github-action@v3.1
  with:
    args: -c "cd ./serverless && serverless package --stage dev --verbose"
    entrypoint: /bin/sh
  env:
    NODE_VERSION: 16.x
    pythonLocation: /opt/hostedtoolcache/Python/3.9.14/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.14/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.14/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.14/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.14/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.14/x64/lib
    AWS_DEFAULT_REGION: ***
    AWS_REGION: ***
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    AWS_SESSION_TOKEN: ***
    ```
    
    ```
    Packaging app-sls for stage dev (***)

Generated requirements from /github/workspace/serverless/requirements.txt in /github/workspace/serverless/.serverless/requirements.txt
Installing requirements from "/github/workspace/serverless/.serverless/requirements/requirements.txt"
Environment: linux, node 16.17.1, framework 3.23.0 (local) 3.23.0v (global), plugin 6.2.2, SDK 4.3.2
Error:
Error: `python3.9 -m pip help install` Exited with code 1
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

    at ChildProcess.<anonymous> (/github/workspace/serverless/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1093:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

1 deprecation found: run 'serverless doctor' for more details

@ilyatovbin-pp
Copy link

The python-requirements module throws this error without actually showing any pip errors. in my case I tried running the actual pip install command manually and saw that PIP returns an error for an incorrect package version. as soon as I fixed it, the error went away.

if anything, it should capture any error messages and throw them instead of "exited with code 1"

for docker, I guess you need to run "docker logs -f xxx" and see the actual pip output as well, look for errors and display them instead of just a 1 exit code.

@pgrzesik
Copy link
Contributor

Thanks for reporting more @ilyatovbin-pp 🙇 Were you using the latest version of the plugin? Could you provide a simple way to reproduce that problem so I can diagnose it better? Thanks in advance 🙇

@ilyatovbin-pp
Copy link

I was on v5.4.0.
just for kicks installed npm 18.12.1 (LTS), updated serverless to latest version and tried again with same results.

you can just put any non existing package name or version in requirements.txt to get this error.
for example requests==2.999 or somebadpackage==1.0.0

Error: `python3.8 -m pip install -t /home/ilya/.cache/serverless-python-requirements/4b42096495056b1a0bf6b773b4a651e3d2a33be6adbfcf82957d3e2b10db8563_x86_64_slspyc -r /home/ilya/.cache/serverless-python-requirements/4b42096495056b1a0bf6b773b4a651e3d2a33be6adbfcf82957d3e2b10db8563_x86_64_slspyc/requirements.txt --cache-dir /home/ilya/.cache/serverless-python-requirements/downloadCacheslspyc` Exited with code 1
    at ChildProcess.<anonymous> (/home/ilya/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at Pipe.<anonymous> (node:net:313:12)

then if you manually run the pip command from above you'll get the actual error:

ERROR: Could not find a version that satisfies the requirement somebadpackage==1.0.0 (from versions: none)  
ERROR: No matching distribution found for somebadpackage==1.0.0  

I'm sure that if you display the pip error you'd solve a lot of headache for people

@beatasophos
Copy link

beatasophos commented Mar 31, 2023

Facing the same issue when using Python3.9 on Github Actions during CI.

Run serverless/github-action@v3.1
  with:
    args: -c "cd ./serverless && serverless package --stage dev --verbose"
    entrypoint: /bin/sh
  env:
    NODE_VERSION: 16.x
    pythonLocation: /opt/hostedtoolcache/Python/3.9.14/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.14/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.14/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.14/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.14/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.14/x64/lib
    AWS_DEFAULT_REGION: ***
    AWS_REGION: ***
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    AWS_SESSION_TOKEN: ***
    ```
    
    ```
    Packaging app-sls for stage dev (***)

Generated requirements from /github/workspace/serverless/requirements.txt in /github/workspace/serverless/.serverless/requirements.txt
Installing requirements from "/github/workspace/serverless/.serverless/requirements/requirements.txt"
Environment: linux, node 16.17.1, framework 3.23.0 (local) 3.23.0v (global), plugin 6.2.2, SDK 4.3.2
Error:
Error: `python3.9 -m pip help install` Exited with code 1
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

    at ChildProcess.<anonymous> (/github/workspace/serverless/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1093:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

1 deprecation found: run 'serverless doctor' for more details

`Generated requirements from /github/workspace/requirements.txt in /github/workspace/.serverless/requirements.txt
Installing requirements from "/github/home/.cache/serverless-python-requirements/58bef6d0060b6f1d11bcc14129fb3f0aa15f3839e580cfa4895a7d3411c56b26_x86_64_slspyc/requirements.txt"
Using download cache directory /github/home/.cache/serverless-python-requirements/downloadCacheslspyc

Environment: linux, node 16.19.1, framework 3.28.1 (local) 3.29.0v (global), plugin 6.2.3, SDK 4.3.2
Error: python3.9 -m pip help install Exited with code 1`

Experienced exactly the same problem, so far did not found solution...

@jarrod-cummings
Copy link

I've also been running into the same failure as above while trying to use serverless deploy inside of a docker container

Generated requirements from /var/www/src/serverless/requirements.txt in /var/www/src/serverless/.serverless/requirements.txt
Installing requirements from "/usr/local/.cache/serverless-python-requirements/44c71bffb51a563eb8850945081619f63a4ec735828b7e8150a7400b5fda5f1f_x86_64_slspyc/requirements.txt"
Using download cache directory /usr/local/.cache/serverless-python-requirements/downloadCacheslspyc

...
× Stack xxx failed to deploy (0s)

Environment: linux, node 18.15.0, framework 3.29.0 (local) 3.29.0v (global), plugin 6.2.3, SDK 4.3.2

Error: `/usr/bin/python3.9 -m pip help install` Exited with code 1
    at ChildProcess.<anonymous> (/usr/local/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)

@faif
Copy link

faif commented Jul 7, 2023

Same error here, tested both with Python 3.9 and 3.8, x64 and arm64 (all combinations). I'm always getting:

Environment: linux, node 16.20.1, framework 3.33.0 (local), plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues
Error:
Running "docker run --rm -v /root/.cache/serverless-python-requirements/a90009f9ea4c0b5b2cc0c3440e65fd9acd7381a42bfdf3dac3442b54d819fcf3_arm64_slspyc:/var/task:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z public.ecr.aws/sam/build-python3.9:latest-arm64 /bin/sh -c chown -R 0\:0 /var/useDownloadCache && python3.9 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\:0 /var/task && chown -R 0\:0 /var/useDownloadCache" failed with: ""
1 deprecation found: run 'serverless doctor' for more details

Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1

Please follow the advice of @ilyatovbin-pp and add some logging because it's not clear what the problem is. My requirements.txt file is fine, I can deploy the lambda locally to AWS without problems, but it fails when ran on GitLab. Using version 6.0.0, as found in the changelog.

@edwardleoni
Copy link

I'm having the same issue on github actions

Python 3.10 - Node 20 happens whether I do it all manually or use serverless/github-action@v3.2

image

@scottadean
Copy link

I'm kind of embarrassed, but my problem was docker was not running on my mac when running sls deploy
my error dump looked like this:

`Environment: darwin, node 18.15.0, framework 3.38.0 (local) 3.30.0v (global), plugin 7.2.0, SDK 4.5.1
Credentials: Local, "dev-default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues

Error:
Error: docker run --rm -v /Users/scott/Library/Caches/serverless-python-requirements/xxxxxx_x86_64_slspyc:/test alpine stat -c %u /bin/sh Exited with code 125`

@jingyi-zhao-01
Copy link

i encoutnered the same problem, the problem is gone with i remove the following packages from requirements.txt, seems like sometimes it is caused by package, nota problem from sls , any clue on this ?
certifi==2023.11.17
openssl==3.0.12
cryptography==41.0.7
idna==3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests