Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Conversation

@jplock
Copy link
Contributor

@jplock jplock commented Nov 27, 2019

My serverless.yml file looks like:

pythonRequirements:
    pythonBin: ".venv/bin/python3"
    invalidateCaches: true
    pipCmdExtraArgs:
      - "--trusted-host pypi.python.org"
      - "--trusted-host pypi.org"
      - "--trusted-host files.pythonhosted.org"

Before this change, the generated pipCmds looked like:

pipCmds: [
  [
    '.venv/bin/python3',
    '-m',
    'pip',
    'install',
    '--trusted-host pypi.python.org',
    '--trusted-host pypi.org',
    '--trusted-host files.pythonhosted.org',
    '-t',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc',
    '-r',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc/requirements.txt',
    '--cache-dir',
    '~/Library/Caches/serverless-python-requirements/downloadCacheslspyc'
  ]
]

And resulted in this error:

Error --------------------------------------------------
 
  Error: STDOUT: 
  
  STDERR: 
  Usage:   
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] <requirement specifier> [package-index-options] ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] -r <requirements file> [package-index-options] ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] [-e] <vcs project url> ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] [-e] <local project path> ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] <archive url/path> ...
  
  no such option: --trusted-host pypi.python.org
  
      at ~/envs/git/myproject/api/node_modules/serverless-python-requirements/lib/pip.js:324:13
      at Array.forEach (<anonymous>)
      at installRequirements (~/envs/git/myproject/api/node_modules/serverless-python-requirements/lib/pip.js:311:28)

After this change, the pipCmds looks like which seems to pass successfully to pip:

pipCmds: [
  [
    '.venv/bin/python3',
    '-m',
    'pip',
    'install',
    '--trusted-host',
    'pypi.python.org',
    '--trusted-host',
    'pypi.org',
    '--trusted-host',
    'files.pythonhosted.org',
    '-t',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc',
    '-r',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc/requirements.txt',
    '--cache-dir',
    '~/Library/Caches/serverless-python-requirements/downloadCacheslspyc'
  ]
]

@jplock
Copy link
Contributor Author

jplock commented Dec 2, 2019

The build failures don't seem related to this change.

@jplock
Copy link
Contributor Author

jplock commented Dec 5, 2019

@dschep any thoughts on this one?

@dschep dschep merged commit 64e20db into serverless:master Dec 6, 2019
@jplock jplock deleted the patch-1 branch December 7, 2019 00:32
@jplock
Copy link
Contributor Author

jplock commented Dec 18, 2019

@dschep I was wondering when the next release is going to be released that includes this change? Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants