Context: I’m using Windows 11. I created a SAM application using sam init
command –> AWS quick start templates –> Hello World. I used Python 3.12 and zip options. The default app gets created fine. I didn’t change anything in the app. sam validate
works fine. I’m using VS Code and installed all required extensions.
Problem: When I run sam build
, I get the following error.
PS C:Coderecruiting-publisherpublisher> sam build
Starting Build use cache
Manifest file is changed (new hash: 3298f13049d19cffaa37ca931dd4d421) or dependency folder (.aws-samdeps304a89a5-e3d6-4793-bbca-6529fa62dac1)
is missing for (HelloWorldFunction), downloading dependencies and copying/building source
Building codeuri: C:Coderecruiting-publisherpublisherhello_world runtime: python3.12 metadata: {} architecture: x86_64 functions:
HelloWorldFunction
Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations : ['C:\Users\xxx\AppData\Local\Microsoft\WindowsApps\python.EXE', 'C:\Users\xxx\AppData\Local\Microsoft\WindowsApps\python3.EXE'] which did not satisfy constraints for runtime: python3.12. Do you have python for runtime: python3.12 on your PATH?
This is surprising, as I do have a Python 3.12 runtime (see below)
PS C:Coderecruiting-publisherpublisher> py --version
Python 3.12.3
Everything on Google indicates that there may be a difference between the python runtime that the SAM app is trying to use and the runtime that is installed on the OS. In my case they’re both the same (as you can see above). Any help would be appreciated!
What I tried is described above. I was expecting a successful build.
Vishal Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.