Lambda, Windows 10, Docker Toolbox, Numpy - Unable to find good bind path format



I am running Windows 10 Home with Docker Toolbox. I’m trying to deploy a lambda function that uses numpy. I have serverless.yml:

service: test 
  - serverless-python-requirements
    zip: true             
#    dockerFile: Dockerfile 
    dockerizePip: non-linux    

  name: aws
  runtime: python3.6
  stage: dev
  environment: ${file(./env.yml):${opt:stage, self:provider.stage}.env}
  region: ${file(./env.yml):${opt:stage, self:provider.stage}.aws.region}
  profile: ${file(./env.yml):${opt:stage, self:provider.stage}.aws.profile}

  individually: true  

    handler: index.handler_sf
#    timeout: 3  # in seconds (overrides default of 6, can also be done at provider level above)
#    memory: 256  # in MB (overrides default of 1024, can also be done at provider level above)
    module: functions/f1

and I get:

Serverless: Docker Image: lambci/lambda:build-python3.6

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

  Unable to find good bind path format

I’ve tried using the dockerFile: DockerFile as suggested here but that fails in similar way.


Any luck with this?

If I use Linux containers I get a different error.


@moneerrifai - no solution as of yet. I have posts here, on the python-requirements github issues, and stack overflow. Hopefully something soon.


I was unable to make the plugin work but I found a better solution anyhow - Lambda Layers. This is a bonus because it reduces the size of the lambda and allows code/file reuse. There is a pre-built lambda layer for numpy and scipy that you can use, but I built my own to show myself how it all works. Here’s how I made it work:

Create a layer package:

  1. Open an EC2 instance or Ubuntu or Linux or whatever - This is needed so we can compile the runtime binaries correctly
  2. Make a dependencies package zip - Must use the directory structure python/lib/python3.6/site-packages for python to find during runtime
mkdir -p tmpdir/python/lib/python3.6/site-packages 
pip install -r requirements.txt --no-deps -t tmpdir/python/lib/python3.6/site-packages 
cd tmpdir zip -r ../ . 
cd .. 
rm -r tmpdir
  1. Push layer zip to AWS - requires latest awscli
sudo pip install awscli --upgrade --user
sudo aws lambda publish-layer-version \
--layer-name py_dependencies \
--description "Python 3.6 dependencies [numpy=0.15.4]" \
--license-info "MIT" \
--compatible-runtimes python3.6 \
--zip-file fileb:// \
--profile python_dev_serverless
  1. To use in any function that requires numpy, just use the arn that is shown in the console or during the upload above
    handler: index.handler_f_use_numpy
      - functions/
      - arn:aws:lambda:us-west-2:XXXXX:layer:py_dependencies:1
  1. As an added bonus, you can push common files like constants to a layer as well. Here’s how I did it for testing use in windows and on the lambda:
import platform

# Set common path
COMMON_PATH = "../../layers/common/"
if platform.system() == "Linux": COMMON_PATH = "/opt/common/"

def handler_common(event, context):
    # Read from a constants.json file
    with open(COMMON_PATH + 'constants.json') as f:
        return text = json.load(f)