Skip to content

Validation of runtimes #30

@sriram-mv

Description

@sriram-mv

Description:

Runtime Validation for python works by invoking the python executable in the path to check if the local python runtime version matches the required runtime.

This relies on how the path is setup to find the appropriate version of python.

ISSUE

  • When trying to build python2.7 lambda applications from within a sam installation housed in a python3.6 environment, one sees the following error message.
(venv) srirammv@localrainbow:~/sam-app$sam build
2018-11-26 13:40:16 Building resource 'HelloWorldFunction'
Build Failed
Error: python executable found in your path does not match runtime.
 Expected version: python2.7, Found version: python3.6.
 Possibly related: https://github.com/awslabs/aws-lambda-builders/issues/30

WORKAROUND:

Fixing this involves following steps:

  • Moving up python executable of version python2.7 on the path
export PATH=/usr/bin:$PATH
python --version
2.7.10
(venv) srirammv@localrainbow::~/sam-app$sam build
2018-11-26 13:58:56 Building resource 'HelloWorldFunction'
2018-11-26 13:58:56 Running PythonPipBuilder:ResolveDependencies
2018-11-26 13:58:57 Running PythonPipBuilder:CopySource

Build Succeeded

Built Artifacts  : .aws-sam/build
Built Template   : .aws-sam/build/template.yaml

Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Package: sam package --s3-bucket <yourbucket>

PERMANENT FIX

A more permanent fix is in the works: #35

line in question: https://github.com/awslabs/aws-lambda-builders/blob/develop/aws_lambda_builders/validate.py#L17

RELATED GITHUB ISSUE

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