"python3": executable file not found in $PATH

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

"python3": executable file not found in $PATH

Post by clocktower »

I am just setting up for an ESP32-S2 Feather under Arduino 1.8.19 on a Mac. Blink tells me "exec: "python3": executable file not found in $PATH".

Any advice?

User avatar
sj_remington
 
Posts: 997
Joined: Mon Jul 27, 2020 4:51 pm

Re: "python3": executable file not found in $PATH

Post by sj_remington »


User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

sj_remington wrote:This may be relevant:
https://forum.arduino.cc/t/python-execu ... le/1008150
Thanks for the effort. It didn't help.

User avatar
sj_remington
 
Posts: 997
Joined: Mon Jul 27, 2020 4:51 pm

Re: "python3": executable file not found in $PATH

Post by sj_remington »

Do you have python3 installed?

If so, where, and where is the IDE looking for it? Post the complete error message.

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

sj_remington wrote:Do you have python3 installed?

If so, where, and where is the IDE looking for it? Post the complete error message.
I can execute Python3 from Terminal.

The complete error message is:

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

I believe my Python2 is at "/usr/bin/python"
and Python3 is at "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3"

If I enter Arduino through Terminal I don't get the error message.

User avatar
sj_remington
 
Posts: 997
Joined: Mon Jul 27, 2020 4:51 pm

Re: "python3": executable file not found in $PATH

Post by sj_remington »

Consider adding the python3 executable location to the $PATH variable.

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

sj_remington wrote:Consider adding the python3 executable location to the $PATH variable.
I would love to do that, but I have no idea how to access $PATH in the Arduino app.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: "python3": executable file not found in $PATH

Post by adafruit_support_mike »

Apple removed Python-2 in macOS 12.2 because it's officially deprecated and abandoned, and doesn't install Python3 by default.

What output do you get from:

Code: Select all

which python python3

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

/usr/bin/python
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

I can execute Python 3.5.2.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: "python3": executable file not found in $PATH

Post by adafruit_support_mike »

Okay, you do have the Python3 intepreter.

What do you get from:

Code: Select all

ls -l /usr/bin/py*

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

ls -l /usr/bin/py*
-rwxr-xr-x 4 root wheel 925 Feb 25 2019 /usr/bin/pydoc
lrwxr-xr-x 1 root wheel 74 Mar 15 2019 /usr/bin/pydoc2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
-rwxr-xr-x 1 root wheel 66880 Sep 20 2019 /usr/bin/python
-rwxr-xr-x 4 root wheel 925 Feb 25 2019 /usr/bin/python-config
lrwxr-xr-x 1 root wheel 75 Mar 15 2019 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 Mar 15 2019 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 1 root wheel 66880 Sep 20 2019 /usr/bin/pythonw
lrwxr-xr-x 1 root wheel 76 Mar 15 2019 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7

I might point out that other people have the same error, and ask about it online. Sometimes people say a proposed solution works, sometimes it doesn't. The only one that worked for me was to launch Arduino from within Terminal. The following one worked for some people, but not me:

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

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: "python3": executable file not found in $PATH

Post by adafruit_support_mike »

I've been working my way to a more general and durable solution.

What do you get from:

Code: Select all

/usr/bin/python --version
If it's some version of Python-3, enter:

Code: Select all

sudo ln -s /usr/bin/python /usr/bin/python3
If it's some version of Python-2, enter:

Code: Select all

sudo ln -s `which python3` /usr/bin/python3

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

Thanks for your efforts. No luck yet:

sudo ln -s `which python3` /usr/bin/python3
Password:
ln: /usr/bin/python3: Operation not permitted

(I entered my password)

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: "python3": executable file not found in $PATH

Post by adafruit_support_mike »

Ah.. right. MacOS has security rules that don't allow changes in certain key directories. /usr/bin is one of them.

Try:

Code: Select all

sudo sh -c "ln -s `which python3` /usr/local/bin/python3"
The /usr/local file tree isn't locked out.

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: "python3": executable file not found in $PATH

Post by clocktower »

You are persistent! Thank you. But, no luck.

sudo sh -c "ln -s `which python3` /usr/local/bin/python3"
Password:
ln: /usr/local/bin/python3: File exists

Still failure to compile with the following error, but I can still compile if I launch Arduino from within Terminal.

Multiple libraries were found for "WiFi.h"
Used: /Users/bryan/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/libraries/WiFi
Not used: /Applications/ Bryan's/Arduino/Arduino 1.8.19.app/Contents/Java/libraries/WiFi
exec: "python3": executable file not found in $PATH
Error compiling for board Adafruit Feather ESP32-S2.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”