Aws-toolkit-jetbrains: Error: PythonPipBuilder:None - Binary validation failed! Error on MacOS

Created on 13 Mar 2019  路  14Comments  路  Source: aws/aws-toolkit-jetbrains

*Build Fails when you try to build serverless application *

When I try to build my serverless application, it fails with the error:

Error: PythonPipBuilder:None - Binary validation failed!

This happens with both my conda environment and my virtualenv environment.

When I try to use sam build in commandline, it fails with the same error when I am not in my designated conda environment but it works perfectly fine when I am in the designated conda env. For virtual env it works perfectly when I am in commandline.

To reproduce

  1. Create a new project with Hello World Sam template
  2. Right click on the template file and select "Deploy Serverless Application.
  3. Select relevant bucket and add the name and click "deploy".

Expected behavior
I expect this to deploy the application.

Screenshots
Screenshot 2019-03-13 at 12 29 56 AM

Your Environment

  • OS: macOS 10.14.3
  • JetBrains' Product: PyCharm
  • JetBrains' Product Version: 2018.3
  • Toolkit Version: 1.1
  • SAM CLI Version: 0.12.0
  • JVM/Python Version: 3.6
guidance

Most helpful comment

All 14 comments

I had this same problem yesterday. In my case, I had Python 3.7 installed as my main Python (also on macOS). I was able to reproduce the problem outside of PyCharm, just by doing sam build at a command line. That led me to learning there is a --debug command line option which eventually led me to discover that I had to install Python 3.6, because SAM doesn't support 3.7.

I tell you my story in hopes maybe it will help you get to the root of your problem, even though you said you're using 3.6. In other words, try it from a command line and see if you can take aws-toolkit-jetbrains out of the equation.

You are correct. I had 3.7 as my main Python. I'm downgrading. Will report as soon as it is done.

Today the python version has to match the runtime so that pip compiles native dependencies correctly. You should be able to have multiple python versions and it will check them all (ie. python2.7, python3.6, python3.7 all on your path)

I Downgraded my base Python to 3.6 as I am using Anaconda. The first error has disappeared, thankfully. Thank you guys for that tip.

Now I see the following error:

`/usr/local/bin/sam package --template-file /Users/asimami/experiments/testsam/.aws-sam/build/template.yaml --output-template-file /Users/asimami/experiments/testsam/.aws-sam/build/packaged-template.yaml --s3-bucket hellolayers.banseljaj.com
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000001071db5c0 (most recent call first):`

Putting it here if anyone else might have the same error.

For the tutorial Im using an anaconda env set on my pycharm project with python --version 3.6.6

But I'm still seeing the same error when I deploy ...

What interpreter is SAM inside pycharm using when deploying ? The project interpreter or system python interpreter ?

Thanks

(generic) Macs-Mac-mini:homes-scraper jo$ python --version
Python 3.6.6 :: Anaconda, Inc.
/usr/local/bin/sam build --template /Users/jo/PycharmProjects/homes-scraper/aws-lambda/template.yaml --build-dir /Users/jo/PycharmProjects/homes-scraper/aws-lambda/.aws-sam/build
2019-03-24 19:03:09 Building resource 'HelloWorldFunction'
Error: PythonPipBuilder:None - Binary validation failed!
Build Failed

@jvidin Judging from the behavior you're seeing, it seems almost certain SAM is using a version other than your project version of 3.6.6. If your system version is 3.7, change it to 3.6 and see if that solves the problem like it did in my case.

BTW, this isn't really an issue with aws-toolkit-jetbrains. It's an issue with SAM, as you proved by running the build on the command line.

@tbradley-sans .. yess . it was a hell of a fight . but after downgrading my anaconda (base) python3.7 to python 3.6 plus correcting my path its now running

Now having issues with AccessDenied , but this is another story.

An error occurred (AccessDenied) when calling the CreateChangeSet operation: User: arn:aws:iam::146147641623:user/home-user-1 is not authorized to perform: cloudformation:CreateChangeSet on resource: arn:aws:cloudformation:eu-west-1:146147641623:stack/hello-from-pycharm/*

If it makes you feel any better, @jvidin , I'm fighting with IAM, too, at this exact moment! bitmoji

Newer sam versions will check for multiple versions of python which helps. Try to install 3.6 next to 3.7 (so that python3.6 and python3.7 are both on your path)

Using option -u, --use-container can resolve the runtime inconsistent issue.

But how do you use option -u when it's the Jetbrains SAM plugin that is doing the sam build?

@tbradley-sans Version 1.2 was released last night, pictures below show the settings locations

Screen Shot 2019-03-27 at 10 04 41 AM
Screen Shot 2019-03-27 at 10 05 24 AM

On Docker ... Can anyone confirm me that SAM works with 'Docker Machine' ?
I'm on an old Mac that does not support 'Docker for Mac' and running into the issue below.
Error: Running AWS SAM projects locally requires Docker. Have you got it installed?

I can easily run Docker cmds from terminal. And start containers from Pycharm

Screen Shot 2019-03-27 at 20 58 13

All things aws newbie...following aws tutorial (https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html) encountered same issue. Modified step 1 from "sam init --runtime python3.7" to "sam init --runtime python3.6" and ran the "sam build" command to success..

Was this page helpful?
0 / 5 - 0 ratings