serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

EEXIST issue with sls deploy and dockerizePip

Open kalote opened this issue 5 years ago • 20 comments

Hello,

When I try to "sls deploy" using "dockerizePip: true" option, i get the following error:

Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Installing required Python packages with python3.6...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Linking required Python packages...

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

  EEXIST: file already exists, symlink '/Users/me/project/test/lambda/.serverless/requirements/requirements.txt' -> './requirements.txt'

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

Error: EEXIST: file already exists, symlink '/Users/me/project/test/lambda/.serverless/requirements/requirements.txt' -> './requirements.txt'
    at Object.fs.symlinkSync (fs.js:1014:18)

I'm running on macOS, with latest sls version, and latest serverless-python-requirements version.

Thanks for your support.

kalote avatar Nov 09 '18 06:11 kalote

Can you post your serverless config file please?

AndrewFarley avatar Nov 09 '18 06:11 AndrewFarley

service: test

provider:
  name: aws
  runtime: python3.6
  region: ap-southeast-1
  environment:
    JENKINS_TOKEN: ${file(./serverless.env.yml):JENKINS_TOKEN, ''}

functions:
  check_access:
    handler: access.main
    memorySize: 128
    events:
      - http:
          path: /check_access
          method: get
          cors: true

plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
    dockerizePip: true

My requirements.txt:

openshift
kubernetes
python-jenkins
urllib3==1.21.1
requests

kalote avatar Nov 09 '18 06:11 kalote

FYI, here is what i did from start:

  • tried to run sls deploy without dockerizePip settings => issues because i have python3.7 installed, not 3.6
  • tried to run sls deploy with dockerizePip settings => issue about EEXIST
  • tried to run sls deploy without dockerizePip settings but with pythonBin settings => same issue (EEXIST)
Serverless: Installing required Python packages with /usr/local/bin/python3.6...
Serverless: Linking required Python packages...

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

  EEXIST: file already exists, symlink '/Users/me/project/testlambda/.serverless/requirements/requirements.txt' -> './requirements.txt'

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

Error: EEXIST: file already exists, symlink '/Users/me/project/test/lambda/.serverless/requirements/requirements.txt' -> './requirements.txt'

Hope that helps :)

NOTE: After renaming requirements.txt into requirements, i don't have the issue anymore, BUT, the requirements are not packaged in the resulting zip file...

kalote avatar Nov 09 '18 07:11 kalote

Could you try rm -rf .serverless and re running (i think the pythonBin route is preferable in your case

dschep avatar Nov 12 '18 13:11 dschep

Thanks for the support, but I already tried to remove the .serverless folder and start from fresh, but I've got same result. EEXIST error. On Mon, Nov 12, 2018 at 22:27 Daniel Schep [email protected] wrote:

Could you try rm -rf .serverless and re running (i think the pythonBin route is preferable in your case

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/UnitedIncome/serverless-python-requirements/issues/278#issuecomment-437879431, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJinq1nl2YF5VaXr26JLVrV6B9FDFyaks5uuXc_gaJpZM4YWA4Q .

kalote avatar Nov 12 '18 22:11 kalote

This is very odd. I tested this on macOS 10.13.4 and wasn't able to recreate the issue.

My test repo is https://github.com/dschep-bug-repos/sls-py-req-278

Could you follow the readme and confirm it causes this EEXIST issue for you too?

dschep avatar Nov 12 '18 23:11 dschep

Using your repo, i don't have the EEXIST issue anymore ... Which is very odd, as i don't see a lot of differences between your setup and mine.

I will try to investigate a bit more on our differences, and keep you posted.

Thanks for the support

On Tue, Nov 13, 2018 at 8:49 AM Daniel Schep [email protected] wrote:

This is very odd. I tested this on macOS 10.13.4 and wasn't able to recreate the issue.

My test repo is https://github.com/dschep-bug-repos/sls-py-req-278

Could you follow the readme and confirm it causes this EEXIST issue for you too?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/UnitedIncome/serverless-python-requirements/issues/278#issuecomment-438074385, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJinjlbWlgJ-_Oy997dqZ46XGfbVgTpks5uugkZgaJpZM4YWA4Q .

kalote avatar Nov 13 '18 01:11 kalote

Hey all. I have had the same issue and after some trial&error I found out that the issue was fixed by upgrading the plugin (in my case it was a 3.x.x -> 4.x.x switch, so I suppose sth changed there). @kalote not sure if it's still an issue for you but anyways, for anybody that finds this thread, try running sls plugin install -n serverless-python-requirements.

raethlo avatar Mar 20 '19 13:03 raethlo

Added a label for visibility, please comment if you or anyone can replicate this with the latest release of the serverless framework and this plugin, otherwise will close.

AndrewFarley avatar Feb 28 '20 05:02 AndrewFarley

I'm having a similar issue on 5.1.0.

I'm using poetry and Python 3.7.

i have very little relevant in my serverless file:

package:
  include:
    - "!./**"
    - proj_dir/**
  excludeDevDependencies: false

sls deploy works just fine, but

sls deploy -f myFunc
Serverless: Generating requirements.txt from pyproject.toml...

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

  Error: EEXIST: file already exists, link....

petergaultney avatar May 30 '20 19:05 petergaultney

I'm having a similar issue on 5.1.0.

I'm using poetry and Python 3.7.

i have very little relevant in my serverless file:

package:
  include:
    - "!./**"
    - proj_dir/**
  excludeDevDependencies: false

sls deploy works just fine, but

sls deploy -f myFunc
Serverless: Generating requirements.txt from pyproject.toml...

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

  Error: EEXIST: file already exists, link....

Having the same issue. serverless deploy works fine, but serverless deploy function fails. Also on 5.1.0. Python 3.8. Serverless 2.8.0

# serverless.yml
...
plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
    layer: true
    dockerizePip: true
serverless deploy function --function myfunction --stage mystage --verbose
Serverless: Generated requirements from /home/.../requirements.txt in /home/.../.serverless/requirements.txt...
Serverless: Using static cache of requirements found at /home/.../.cache/serverless-python-requirements/fec9a9359ad54bf436ce426e1c7d6e79abf302f9feb6c822783404a2ebf42d6f_slspyc ...
Serverless: Packaging function: myfunction...
 
  Error --------------------------------------------------
 
  Error: EEXIST: file already exists, symlink '/home/.../serverless-python-requirements/fec9a9359ad54bf436ce426e1c7d6e79abf302f9feb6c822783404a2ebf42d6f_slspyc' -> '/home/.../.serverless/requirements'

sirfuzzalot avatar Oct 24 '20 04:10 sirfuzzalot

@sirfuzzalot Have you resolved this issue?

amediantsev avatar Dec 02 '21 17:12 amediantsev

Having the same issue since upgrading to serverless v3 and serverless-python-requirements 5.4.0. (I may have been seeing the same issue earlier, but it didn't seem as fatal, somehow.)

brettdh avatar May 24 '22 21:05 brettdh

Whoops, my error is most similar to @sirfuzzalot 's error, but a bit different:

Error: EEXIST: file already exists, symlink '/path/to/project/.requirements_cache/91e8d581ee3e2acc2fb3bc7d00d4788cce7c5e6ec79a1b55242428bcd67376a6_x86_64_slspyc.zip' -> '.serverless/pythonRequirements.zip'

Of course, now that I've posted this comment, I can't repro the issue. 🙃

brettdh avatar May 24 '22 21:05 brettdh

Aaaand it's back.

brettdh avatar May 25 '22 11:05 brettdh

Hello @brettdh - are you consistently running into this issue? If yes, do you maybe have a reproduction steps for it?

pgrzesik avatar May 25 '22 17:05 pgrzesik

It happens intermittently when I try to deploy a single function, and then it goes away. The state is probably changing when I change something between deploys, but I'm not sure. I don't have reliable repro steps yet.

brettdh avatar May 25 '22 18:05 brettdh

It seems to fail when I've recently run sls package, which creates .serverless/pythonRequirements.zip - but sls deploy function is also attempting to write that file. If this is the case, I should be able to make a minimal repro project sometime soon.

brettdh avatar May 26 '22 04:05 brettdh

I'm using this repo to show a minimal repro for a related, but different issue:

https://github.com/brettdh/serverless-layer-test

However, if you comment out the workaround mentioned in the README, it also serves as a reliable repro for this issue.

brettdh avatar Jun 07 '22 14:06 brettdh

Forgot to mention - related issue is #700.

brettdh avatar Jun 07 '22 14:06 brettdh