0

"python3": executable file not found in $PATH
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

"python3": executable file not found in $PATH

by clocktower on Sun Jul 03, 2022 6:27 pm

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?

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by sj_remington on Sun Jul 03, 2022 7:25 pm


sj_remington
 
Posts: 456
Joined: Mon Jul 27, 2020 4:51 pm

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

by clocktower on Sun Jul 03, 2022 7:38 pm

sj_remington wrote:This may be relevant:
https://forum.arduino.cc/t/python-execu ... le/1008150


Thanks for the effort. It didn't help.

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by sj_remington on Sun Jul 03, 2022 7:57 pm

Do you have python3 installed?

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

sj_remington
 
Posts: 456
Joined: Mon Jul 27, 2020 4:51 pm

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

by clocktower on Sun Jul 03, 2022 8:27 pm

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.

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by sj_remington on Sun Jul 03, 2022 9:20 pm

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

sj_remington
 
Posts: 456
Joined: Mon Jul 27, 2020 4:51 pm

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

by clocktower on Sun Jul 03, 2022 9:26 pm

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.

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by adafruit_support_mike on Tue Jul 05, 2022 9:08 pm

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 | TOGGLE FULL SIZE
which python python3

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

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

by clocktower on Tue Jul 05, 2022 9:17 pm

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

I can execute Python 3.5.2.

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by adafruit_support_mike on Wed Jul 06, 2022 5:42 pm

Okay, you do have the Python3 intepreter.

What do you get from:

Code: Select all | TOGGLE FULL SIZE
ls -l /usr/bin/py*

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

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

by clocktower on Wed Jul 06, 2022 6:04 pm

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

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by adafruit_support_mike on Wed Jul 06, 2022 10:17 pm

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

What do you get from:

Code: Select all | TOGGLE FULL SIZE
/usr/bin/python --version
If it's some version of Python-3, enter:

Code: Select all | TOGGLE FULL SIZE
sudo ln -s /usr/bin/python /usr/bin/python3
If it's some version of Python-2, enter:

Code: Select all | TOGGLE FULL SIZE
sudo ln -s `which python3` /usr/bin/python3

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

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

by clocktower on Wed Jul 06, 2022 10:30 pm

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)

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

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

by adafruit_support_mike on Sat Jul 09, 2022 8:56 pm

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 | TOGGLE FULL SIZE
sudo sh -c "ln -s `which python3` /usr/local/bin/python3"
The /usr/local file tree isn't locked out.

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

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

by clocktower on Sat Jul 09, 2022 9:29 pm

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.

clocktower
 
Posts: 47
Joined: Sun May 24, 2015 3:10 pm

Please be positive and constructive with your questions and comments.