Skip to content

Failure when installing requirements from lambda.json #17

@lbjay

Description

@lbjay

Nice tool, 1st off.

I'm getting errors when I specify a list of requirements in lambda.json.

Here's my redacted config:

{
  "name": "myFunction",
  "description": "Does stuff",
  "region": "us-east-1",
  "handler": "my_function.lambda_handler",
  "timeout": 30,
  "memory": 1024,
  "requirements": ["arrow==0.7.0", "pyhorn==0.5.0", "pyloggly==0.1.0"]
}

Here's the output:

λ Building Package
DEBUG:lambda_uploader.package:Virtualenv stdout: Using real prefix '/home/jluker/.pyenv/versions/2.7.10'
New python executable in /home/jluker/projects/dce-elk/.lambda_package/venv/bin/python2.7
Also creating executable in /home/jluker/projects/dce-elk/.lambda_package/venv/bin/python
Installing setuptools, pip, wheel...done.

DEBUG:lambda_uploader.package:Virtualenv stderr: 
DEBUG:lambda_uploader.package:Installing requirements found [u'arrow==0.7.0', u'pyhorn==0.5.0', u'pyloggly==0.1.0'] in config
DEBUG:lambda_uploader.package:Pip cmd: ['/home/jluker/projects/dce-elk/.lambda_package/venv/bin/pip', 'install', u'arrow==0.7.0 pyhorn==0.5.0 pyloggly==0.1.0']
DEBUG:lambda_uploader.package:Pip stdout: 
DEBUG:lambda_uploader.package:Pip stderr: Exception:
Traceback (most recent call last):
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run
    wheel_cache
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/basecommand.py", line 272, in populate_requirement_set
    wheel_cache=wheel_cache
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/req/req_install.py", line 213, in from_line
    wheel_cache=wheel_cache, constraint=constraint)
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/req/req_install.py", line 67, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse
    reqs = list(parse_requirements(s))
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2924, in parse_requirements
    "version spec")
  File "/home/jluker/projects/dce-elk/.lambda_package/venv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2900, in scan_list
    raise RequirementParseError(msg, line, "at", line[p:])
RequirementParseError: Expected ',' or end-of-list in arrow==0.7.0 pyhorn==0.5.0 pyloggly==0.1.0 at  pyhorn==0.5.0 pyloggly==0.1.0

⁉️ Unexpected error. Please report this traceback.
Traceback (most recent call last):
  File "/home/jluker/envs/dce-elk/lib/python2.7/site-packages/lambda_uploader/shell.py", line 124, in main
    _execute(args)
  File "/home/jluker/envs/dce-elk/lib/python2.7/site-packages/lambda_uploader/shell.py", line 53, in _execute
    pkg = package.build_package(pth, cfg.requirements)
  File "/home/jluker/envs/dce-elk/lib/python2.7/site-packages/lambda_uploader/package.py", line 35, in build_package
    pkg.install_requirements(requirements)
  File "/home/jluker/envs/dce-elk/lib/python2.7/site-packages/lambda_uploader/package.py", line 94, in install_requirements
    raise Exception('pip returned unsuccessfully')
Exception: pip returned unsuccessfully

Fatal error: local() encountered an error (return code 1) while executing 'lambda-uploader --no-upload -VV --profile test'

Aborting.

I added an extra LOG.debug in there to see the actual pip subprocess cmd. It's puzzling because if I execute same command in the shell it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions