SAM CLI executable not found - Pycharm
Asked Answered
P

4

11

I'm trying to configure PyCharm in order to run a Lambda Function.

First of all in AWS Toolkit I select the SAM CLI executable, and it goes well: enter image description here

Anyway, when I want to add a Lambda run configuration pycharm says: Invalid sam executable: "The system couldn't find the specific route." enter image description here

My system PATH variable: enter image description here

Someone could help me here please, I really don't know what else to do.

Many thanks! Xevi

Pettit answered 14/10, 2020 at 13:38 Comment(0)
M
6

This means that SAM is not installed on your system or path is not configured in pycharm. Kindly follow the instructions for installing SAM as per the AWS documentation.

Misstep answered 4/11, 2020 at 6:52 Comment(1)
Adding to system path worked for me. Had to restart PyCharm.Sixfooter
S
15

Actually, I encountered same problem and solved as following;

I assume that you use mac and write in terminal this;

which sam

This gives you the path where sam installed.

Then copy this and paste into sam cli executable path like below;

enter image description here

Sophistry answered 14/7, 2021 at 8:42 Comment(0)
M
6

This means that SAM is not installed on your system or path is not configured in pycharm. Kindly follow the instructions for installing SAM as per the AWS documentation.

Misstep answered 4/11, 2020 at 6:52 Comment(1)
Adding to system path worked for me. Had to restart PyCharm.Sixfooter
F
4

To help people like me: which sam should give a path to the SAM executable, like: /opt/homebrew/bin/sam

Then in Pycharm, open preferences (⌘,) Tools -> AWS, the the first input field should be 'SAM CLI Executable'.Or Put 'SAM' (uppercase) in the settings search bar.

Ferrel answered 5/2, 2022 at 15:2 Comment(0)
E
2

As of a 2023 edition of the toolkit, I faced a similar issue, with the additional nuance that the SAM CLI Executable field in the dialog was disabled when I tried to create a new PyCharm Serverless App project.

I solved it as follows:

  • show the AWS Toolkit tool window in an existing, standard PyCharm project. (Of course the toolkit needs to be installed already.)
  • click the gear for options, then on the ensuing menu, the wrench for Show AWS Settings. Enter the full path to the sam executable.
  • close the existing project. If you don't do this, it looks like the AWS Settings change may not take effect.
  • create a new project. I believe the SAM CLI Executable field in the dialog is still disabled! But it should not complain about not being able to find it.

It seems like OP probably made a similar setting change (perhaps via the global PyCharm settings?), so it could just be an issue of closing open projects to get that change to take.

Unless I'm completely misunderstanding the dialog, it seems sort of buggy that the path to sam isn't displayed for inspection at project creation time even after you've set it correctly.

Eucharist answered 18/4, 2023 at 20:44 Comment(1)
I used Cmd + Shift + A to run any command, and then typed Show AWS Settings and was able to set the path from there.Greasewood

© 2022 - 2024 — McMap. All rights reserved.