Skip to content

How Do I deploy a function with python packages in private pip server #177

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

Closed
gerbenbas opened this issue Apr 19, 2018 · 9 comments
Closed

Comments

@gerbenbas
Copy link

Hi everyone,

I’ve been using the serverless framework for a while to deploy functions that use python packages. For that purpose, I have been using the serverless-python-requirements plugin. This all works great. However, I now want to deploy a function that uses a python package that is hosted at a private pip server.

Locally, I add this pip server to my pip.conf file like this:

[install]
extra-index-url = https://$USERNAME:$PASSWORD@$URL/simple/

This works great when I install a package on my own device. However, when I try to deploy my function with the private python package in the requirements.txt, I get the following error:

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

   Could not find a version that satisfies the requirement
 $PACKAGE_NAME (from -r .serverless/requirements.txt
 (line 11)) (from versions: )
No matching distribution
found for $PACKAGE_NAME (from -r .serverless/requirements.txt
(line 11))

It thus appears to me that the python requirements plugin uses the regular pip server and not the private pip server that I configured and use when I run pip install $PACKAGE_NAME.

Does any of you have an idea on how I can configure serverless so that it uses the private pip server?

Thank you in advance,

Gerben

@dschep
Copy link
Contributor

dschep commented Apr 19, 2018

Are you using the dockerizePip option?

@dschep
Copy link
Contributor

dschep commented Apr 19, 2018

If not, this looks like it might be related to #176 and the use of --isolated.

dschep added a commit that referenced this issue Apr 19, 2018
@gerbenbas
Copy link
Author

I do not use the dockerizePip option.

@dschep
Copy link
Contributor

dschep commented Apr 19, 2018

In that case, try out v4.0.1 which should fix the issue.

@gerbenbas
Copy link
Author

That indeed fixed it! Thank you very much!

@dschep
Copy link
Contributor

dschep commented Apr 19, 2018

Excellent!

@dschep dschep closed this as completed Apr 19, 2018
@jasonkuhrt
Copy link

jasonkuhrt commented Jun 8, 2018

I'm getting this error and I have these versions:

{
  "name": "unresponsive",
  "description": "foobar",
  "license": "UNLICENSED",
  "repository": "github:dialoguemd/unresponsive",
  "version": "0.1.0",
  "dependencies": {},
  "devDependencies": {
    "serverless-pseudo-parameters": "^1.6.0",
    "serverless-python-requirements": "^4.0.3",
    "serverless-step-functions": "^1.4.1"
  }
}

Error exactly:

❯ sls deploy --stage dev
Serverless: Generating requirements.txt from Pipfile...
Serverless: Installing requirements of requirements.txt in .serverless...

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

    Could not find a version that satisfies the requirement dialogue.api-client==0.0.2 (from -r .serverless/requirements.txt (line 5)) (from versions: )
No matching distribution found for dialogue.api-client==0.0.2 (from -r .serverless/requirements.txt (line 5))

@jasonkuhrt
Copy link

Maybe relevant is that:

  • I am using pipenv
  • I am adding support for the other index via env var: PIP_EXTRA_INDEX_URL

@cgrimal
Copy link

cgrimal commented Jun 9, 2018

Hi @jasonkuhrt, since this issue has been closed, I guess it would be better to open a new one.
Please provide us your serverless configuration as well. Thanks.

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

4 participants