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

Unable to link dependency 'psycopg2' because a file by the same name exists in this service #75

Closed
Mortinke opened this issue Sep 11, 2017 · 6 comments

Comments

@Mortinke
Copy link

Currently I use the version v3.0.0-beta.4 to fix #72.

Unfortunaly, I run in the next issue and get now the following error:

$ SLS_DEBUG=1 serverless deploy -s dev -r eu-central-1 -v
Serverless: Installing required Python packages for runtime python2.7...
Serverless: Linking required Python packages...

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

  Unable to link dependency 'psycopg2' because a file by the same name exists in this service

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

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

Error: Unable to link dependency 'psycopg2' because a file by the same name exists in this service
    at fse.readdirSync.map.e (D:\Workspace\git\aws.cloudformation.utils\node_modules\serverless-python-requirements\index.js:213:21)
    at Array.map (native)
    at ServerlessPythonRequirements.linkRequirements (D:\Workspace\git\aws.cloudformation.utils\node_modules\serverless-python-requirements\index.js:198:40)
From previous event:
    at PluginManager.invoke (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:217:22)
    at PluginManager.spawn (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:229:17)
    at Deploy.BbPromise.bind.then.then (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\plugins\deploy\deploy.js:101:50)
From previous event:
    at Object.before:deploy:deploy [as hook] (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\plugins\deploy\deploy.js:99:10)
    at BbPromise.reduce (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:217:55)
From previous event:
    at PluginManager.invoke (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:217:22)
    at PluginManager.run (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:236:17)
    at variables.populateService.then (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:107:33)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Serverless.run (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:94:74)
    at serverless.init.then (C:\Users\sebastian.martinka\AppData\Roaming\npm\node_modules\serverless\bin\serverless:32:50)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           6.10.3
     Serverless Version:     1.17.0

serverless.yml

custom:
  pythonRequirements:
    pythonBin: C:\Python\Python2.7\python.exe
package: # this section is optional, but suggested. It reduces deploy size
  exclude:
    - node_modules/**  # Omit JavaScript dependencies, you're using Python!!
    - venv/**  # Omit your virtualenv if you've created one locally for development
plugins:
  - serverless-python-requirements

requirements.txt

cat requirements.txt
psycopg2==2.7.3.1

npm

$ npm list
aws.cloudformation.utils@1.0.0 D:\Workspace\git\aws.cloudformation.utils
`-- serverless-python-requirements@3.0.0-beta.4
  +-- archiver@1.3.0
  | +-- archiver-utils@1.3.0
  | | +-- lazystream@1.0.0
  | | `-- normalize-path@2.1.1
  | |   `-- remove-trailing-separator@1.1.0
  | +-- async@2.5.0
  | +-- buffer-crc32@0.2.13
  | +-- glob@7.1.2
  | | +-- fs.realpath@1.0.0
  | | +-- inflight@1.0.6
  | | | `-- wrappy@1.0.2
  | | +-- inherits@2.0.3
  | | +-- minimatch@3.0.4
  | | | `-- brace-expansion@1.1.8
  | | |   +-- balanced-match@1.0.0
  | | |   `-- concat-map@0.0.1
  | | +-- once@1.4.0
  | | `-- path-is-absolute@1.0.1
  | +-- readable-stream@2.3.3
  | | +-- core-util-is@1.0.2
  | | +-- isarray@1.0.0
  | | +-- process-nextick-args@1.0.7
  | | +-- safe-buffer@5.1.1
  | | +-- string_decoder@1.0.3
  | | `-- util-deprecate@1.0.2
  | +-- tar-stream@1.5.4
  | | +-- bl@1.2.1
  | | +-- end-of-stream@1.4.0
  | | `-- xtend@4.0.1
  | +-- walkdir@0.0.11
  | `-- zip-stream@1.2.0
  |   `-- compress-commons@1.2.0
  |     `-- crc32-stream@2.0.0
  |       `-- crc@3.4.4
  +-- bluebird@3.5.0
  +-- fs-extra@3.0.1
  | +-- graceful-fs@4.1.11
  | +-- jsonfile@3.0.1
  | `-- universalify@0.1.1
  +-- glob-all@3.1.0
  | `-- yargs@1.2.6
  |   `-- minimist@0.1.0
  `-- lodash@4.17.4
@Mortinke
Copy link
Author

Mortinke commented Sep 11, 2017

I added console.log(exception) and console.log(e) after the lines 205 and 209 and found out, that I ran in this issues: nodejs/node-v0.x-archive#6342

https://github.com/UnitedIncome/serverless-python-requirements/blob/1f5b72cb32e196865e61ef3cf187a8f327060f80/index.js#L203-L216

Here you can find the error messages I got

{ Error: EPERM: operation not permitted, symlink '.requirements\psycopg2' -> 'D:\Workspace\git\aws.cloudformation.utils\psycopg2'
    at Error (native)
    at Object.fs.symlinkSync (fs.js:1068:18)
    at fse.readdirSync.map.e (D:\Workspace\git\aws.cloudformation.utils\node_modules\serverless-python-requirements\index.js:204:15)
    at Array.map (native)
    at ServerlessPythonRequirements.linkRequirements (D:\Workspace\git\aws.cloudformation.utils\node_modules\serverless-python-requirements\index.js:198:40)
    at ServerlessPythonRequirements.tryCatcher (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
  errno: -4048,
  code: 'EPERM',
  syscall: 'symlink',
  path: '.requirements\\psycopg2',
  dest: 'D:\\Workspace\\git\\aws.cloudformation.utils\\psycopg2' }
{ Error: ENOENT: no such file or directory, readlink 'D:\Workspace\git\aws.cloudformation.utils\psycopg2'
    at Error (native)
    at Object.fs.readlinkSync (fs.js:1028:18)
    at fse.readdirSync.map.e (D:\Workspace\git\aws.cloudformation.utils\node_modules\serverless-python-requirements\index.js:209:28)
    at Array.map (native)
    at ServerlessPythonRequirements.linkRequirements (D:\Workspace\git\aws.cloudformation.utils\node_modules\serverless-python-requirements\index.js:198:40)
    at ServerlessPythonRequirements.tryCatcher (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (D:\Workspace\git\aws.cloudformation.utils\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'readlink',
  path: 'D:\\Workspace\\git\\aws.cloudformation.utils\\psycopg2' }

I fixed the issue with this instruction.

@dschep
Copy link
Contributor

dschep commented Sep 11, 2017

Hrm. I had considered switching to copy instead of symlink on win32 platforms. Does that seem like a good idea?

@Mortinke
Copy link
Author

Yes, I think that it's a good idea! Not everyone will have the opportunity to modify the group polices in the company.

@nthienan
Copy link

@dschep, @Mortinke, Is there any other workaround? My computer is in company and I don't have permission to change group polices

@Mortinke
Copy link
Author

Mortinke commented Jan 2, 2018

Hi @nthienan,

sorry, but I still use the solution from instruction. I think the only other possible solution is the change to copy, mentioned by @dschep.

@dschep
Copy link
Contributor

dschep commented Jan 2, 2018

I just setup windows builds last week so I should be able test this now so I'll build it when I get the chance.

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

3 participants