Mac OS update -- Killed ESP32 sketch

I updated to mac os 12.3 yesterday. Now, when I "verify" sketch with ESP32 board, I get error

exec: "python": executable file not found in $PATH
Error compiling for board ESP32C3 Dev Module.

python3 is in my path
echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/usr/local/bin/python3:/Library/Apple/usr/bin

1 Like

I had something similar happen to me in linux, it appeared when it went to python 3. Different location and I believe different libraries.

Install the latest Python 2 from:

Did that ... install python2 from above link... Same error message

exec: "python": executable file not found in $PATH
Error compiling for board Adafruit ESP32 Feather.

Python is now python2
If I use terminal,
python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin

Does it work if you create an alias for python3?

Using

 nano ~/.zshrc

I entered

alias python='python3'

at the bottom following the directions on https://wpbeaches.com/make-an-alias-in-bash-or-zsh-shell-in-macos-with-terminal/ and then restarted terminal and it worked at the command-line. It might work for you.

I literally have the same issue since yesterday. I installed

  • xcode command line tools
  • installed latest python 3.x

Nothing has helped so far. @tom2020 let me know once you figure something out

Im having the same issue. I can compile it for Arduino UNO etc but can not compile for ESP32. It is weird because, it was working last week...

Hello guys.

I fixed this issue and please following steps to resolve this issue and theres no need to restart Arduino app at any point in the steps.

  1. In Arduino preferences, enable Show verbose output during [ :heavy_check_mark:] compilation [ :heavy_check_mark:] upload and compile again
  2. Notice the entire command where it is failing and you must see it will probably be failing at python .../gen_esp32part.py ...
  3. Edit the board compiler's platform config using the command open $HOME/Library/Arduino15/packages/esp32/hardware/esp32/2.0.2/platform.txt (or use any text editor you like)
  4. Search for gen_esp32part.py and replace that python with entire path of your python. Like below

# From
tools.gen_esp32part.cmd=python "{runtime.platform.path}/tools/gen_esp32part.py"

# To
tools.gen_esp32part.cmd=/usr/local/bin/python "{runtime.platform.path}/tools/gen_esp32part.py"
  1. Save and close
  2. Simply compile again and it will work.

Let me know if this helped or not.

18 Likes

Thats because esp32 compiler uses python in the process and Arduino simply uses this config from platform.txt

It works, but small correction:

# From
tools.gen_esp32part.cmd=python "{runtime.platform.path}/tools/gen_esp32part.py"

# To
tools.gen_esp32part.cmd=/usr/local/bin/python "{runtime.platform.path}/tools/gen_esp32part.py"

You forgot " before {runtime.platform.......

TNX

4 Likes

On my mac os,
tools.gen_esp32part.cmd=/usr/local/bin/python3 "{runtime.platform.path}/tools/gen_esp32part.py"

I have python3 installed, not python2

Thanks for solving this problem. Things work again for me.

3 Likes

@bhargav3
@tom2020

Thank You, solved my problem!

Herbert Gramsch

Thanks !!

@bhargav3
@tom2020
Thank you, solved the mystery!

Vineeth

[Mac OS update – Killed ESP32 sketch]
OTA Just discovered Over The Air program does NOT work

java.io.IOException: Cannot run program "python": error=2, No such file or directory

Sketch uses 1023702 bytes (78%) of program storage space. Maximum is 1310720 bytes.
Global variables use 56056 bytes (17%) of dynamic memory, leaving 271624 bytes for local variables. Maximum is 327680 bytes.
python /Users/sally/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/tools/espota.py -i 192.168.2.187 -p 3232 --auth= -f /var/folders/3f/qgrplnzj7yjf75sf6y6wjr600000gn/T/arduino_build_529497/DS18B20_Final_21B.ino.bin
java.io.IOException: Cannot run program "python": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

Worked great! Thank you!

Mac OS update – Killed ESP32 OTA. sketch

Looking for "python"... don't know where it is looking
java.io.IOException: Cannot run program "python": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)

That change (the original suggestion and problem) didn't work for me. Neither did installing Python2.7 "next" to Python3.

What did work was changeing 'python' to 'python3' where the full path was suggested.
This is for ESP boards, not any others.

(ps. Heltec ESP WiFi compiles are still broken.)

There were two references to python when I looked at that file. I changed both.

tools.esptool_py.network_cmd=/usr/bin/python3 "{runtime.platform.path}/tools/espota.py" -r
tools.gen_esp32part.cmd=/usr/bin/python3 "{runtime.platform.path}/tools/gen_esp32part.py"

1 Like