10

I am running Arduion IDE 1.8.12 on Ubuntu 18.04.4 LTS.

I am trying to compile Example code for ESP32 Camera module (standard camera module with default example on Arduino IDE) and I got this error (which I think is not Arduino issue, but Python):

"exec: "python": executable file not found in $PATH
Error compiling for board ESP32 Wrover Module" 

Same message with all ESP32.

I also did sudo apt install python. Got back this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python is already the newest version (2.7.15~rc1-1).
0 modernizētas, 0 instalētas no jauna, 0 tiks noņemtas un 6 netiks modernizētas.

When I type Python in Terminal, got this back:

Python 2.7.17 (default, Nov  7 2019, 10:07:09)
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Thank you for help!

BR, Valters

wotesi
  • 319
  • 1
  • 3
  • 15
  • 1
    Do you mean to be using python 2.7? Usually 3.x is recommended as 2.7 is deprecated and no longer being supported. – Rashid 'Lee' Ibrahim Mar 19 '20 at 17:50
  • What is the command that you run? esptool.py? – rolf82 Mar 19 '20 at 18:38
  • @Rashid'Lee'Ibrahim the version of python installed on Ubuntu and other Debian based distros is 2.7, so it is not unusual to see 2.7 used. Also, I have updated the version of python to 3.6.9 and I am getting the same problem. – Eoghan May 16 '20 at 21:57

7 Answers7

13

I created a symbolic link as such, linking python with python3, it worked for my ubuntu 18.04 machine

sudo ln -s /usr/bin/python3 /usr/bin/python
Orgosoft
  • 155
  • 1
  • 3
11

In MacOS running this command in Terminal.app under your current user

sed -i -e 's/=python /=python3 /g' ~/Library/Arduino15/packages/esp32/hardware/esp32/*/platform.txt

seems to fix it.The command modifies all the platform.txt files under your local installation of the ESP32 tools (~/Library/Arduino15/packages/esp32/hardware/esp32) and replaces the word python by python3 wherever it finds it

Charith Jayasanka
  • 4,033
  • 31
  • 42
9

I did this for Ubuntu 20.04 LTS:

apt install python-is-python3
duedl0r
  • 9,289
  • 3
  • 30
  • 45
2

To solve & Fixed the following upload error from Arduino To ESP32-CAM (And for ESP32 too): environment: ubuntu 20.04 64bit, Arduino 1.8.13 ESP32-CAM And yp-05 (for ESP's serial connection)

  • exec: "python": executable file not found in $PATH
  • Error compiling for board AI Thinker ESP32-CAM.

The solution is:

  1. Installing the package (for example python-is-python3_3.8.2-4_all):

sudo dpkg -i python-is-python3_3.8.2-4_all.deb
2) Wiring

WIRES colors: | black | NO | WHITE | GRAY | BROWN | EMPTY
yp-05 legs ordere: | GRD | EMPTY | VCC | TX | RX | DIR esp32s CAM: | GRD | EMPTY | 3.3V | GPIO 3 UOR | GPIO 1 UOT | EMPTY

*** just For Upload: SHORT ESP32-CAM 100 & GRD

I hope it will save time to start using ESP32-CAM (And ESP32 too).

That's it - Solved & Run!

Dock
  • 444
  • 5
  • 13
eyal_r
  • 44
  • 1
2

If you are on MacOs 12 and above please edit the platform file, change from python to python3 as follows; preferences->user/path/arduino/packages/hardware/esp32/version/platform.txt and edit the line that looks as follows:tools.gen_esp32part.cmd=python3 "{runtime.platform.path}/tools/gen_esp32part.py"

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 05 '22 at 14:26
1

Rather than make a symlink, on Ubuntu and derivatives, you can make "python" the default with the alternatives facility. See this question and answer, but just reference python3 rather than python3.6.

How to change python3 to default in linux mint

0

I ran into this today (building for the TTGO T-Watch 2020); it was because I was using the Flatpak version of Arduino and it didn't include a straight python binary (only python3).

Confirmed with:

$ flatpak run --command=ls cc.arduino.arduinoide -l /usr/bin/|grep python
lrwxrwxrwx  1 nfsnobody nfsnobody       9 Feb  5 16:30 python3 -> python3.7
-rwxr-xr-x  2 nfsnobody nfsnobody   14512 Jan  1  1970 python3.7
lrwxrwxrwx  1 nfsnobody nfsnobody      17 Feb  5 16:30 python3.7-config -> python3.7m-config
lrwxrwxrwx  1 nfsnobody nfsnobody       9 Feb  5 16:30 python3.7m -> python3.7
-rwxr-xr-x  2 nfsnobody nfsnobody    3309 Jan  1  1970 python3.7m-config
lrwxrwxrwx  1 nfsnobody nfsnobody      16 Feb  5 16:30 python3-config -> python3.7-config

I'm not sure of the "right" solution, but after some trial and error the winning workaround seemed to be:

$ cd /var/lib/flatpak/runtime/org.freedesktop.Platform/x86_64/19.08/active/files/bin
$ sudo ln -s python3 python

Of course, then I ran into another problem (no pyserial)...

mibus
  • 1