env: python3: no such file or directory

Hey guys so I am new to using nodemcu on arduino, and tried to just begin a simple blynking program on nodemcu1.0(ESP-12E Module).

I was recieving this error upon compilation, so I haven’t even plugged in my nodemcu, just hit the verify button, and this error continuously appeared:

env: python3: No such file or directory
exit status 127
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

I have all required boards and libraries downloaded, and eventually after not being able to find the issue, I cut down the code to the minimal possible code to make sure the error was not in my code:

void setup() {}
void loop() {}

I looked at the error, and updated my Mac OSX to have python 3.8, and also set the default global python to 3.8, however the exact same issue occurred. Then I went to the terminal, and found all the files used by the esp8266 library, and changed all the source versions to python3.

Again, the same error occurs.

I’ve been on this issue with the help of the internet and my dad for the entire day, and we have not been able to come up with a solution, so any fixes are much appreciated.

Thanks again.

I attached the text copied to the clipboard when I hit copy error messages:

Error Message env-python3.doc (35.5 KB)

The ESP8266 platform has a tool dependency on Python 3, but rather than installing a dedicated copy of Python 3 with the package, the ESP8266 platform developers assume you have Python 3 already installed at /usr/local/bin/python3.

The python3 file at the path shown in the error message is just a symlink to that location. So either you have Python 3 installed somewhere else, like /usr/bin/python3, or maybe you don't have Python 3 installed at all. If the former, you need to modify the symlink, as described here. If the latter, you need to install Python (and possibly modify the symlink as well if it was installed to a location other than /usr/local/bin/python3.

More information: https://github.com/esp8266/Arduino/issues/6931

env is looking for a path to python3 in your $PATH environment variable to determine where to run it from. The error is saying that env cannot find this path. This might have been solved by adding the path for python3 to the $PATH variable.

PATH=$PATH:/my/path/to/python3
launchctl setenv PATH $PATH

However, there should have been no reason to change all source files in your ESP8266 directory to point to python3. In fact, it may not have been desirable to do this as not all of them were written for python3.

I would suggest that you delete /Users/Siddie/Library/Arduino15/packages/esp8266/ and re-install the library to restore all files to their original state and then follow the symlink advice mentioned by pert.

pert: The ESP8266 platform has a tool dependency on Python 3, but rather than installing a dedicated copy of Python 3 with the package, the ESP8266 platform developers assume you have Python 3 already installed at /usr/local/bin/python3.

The python3 file at the path shown in the error message is just a symlink to that location. So either you have Python 3 installed somewhere else, like /usr/bin/python3, or maybe you don't have Python 3 installed at all. If the former, you need to modify the symlink, as described here. If the latter, you need to install Python (and possibly modify the symlink as well if it was installed to a location other than /usr/local/bin/python3.

More information: https://github.com/esp8266/Arduino/issues/6931

Ok so if I understand correctly, I need to move my python3 file, which is currently located in /Users/Siddie/.pyenv/shims/python3, into usr/local/bin/ and include the python file here.

can you confirm that I understood this correctly.

Thanks again

SidKadari: Ok so if I understand correctly, I need to move my python3 file, which is currently located in /Users/Siddie/.pyenv/shims/python3, into usr/local/bin/

I'm not familiar with pyenv. I would be nervous about moving anything from that location, as it might cause problems for your uses of Python outside the Arduino IDE.

You could copy it there, or you could update the python3 symlink that's located at /Users/{username}/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 to point to the location on your computer where Python 3 is already installed.

SidKadari: and include the python file here.

I don't know what you mean by "include". With an unmodified installation of the ESP8266 platform, you only need for the file /Users/{username}/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 to either be a symlink pointing to your installation of Python 3, or for the Python 3 installation to be in that folder.

If you have made some unspecified modifications to the ESP8266 platform while attempting to fix this error, then I couldn't say what you would need to do to make it work. I agree with BitSeeker that it's best for you to delete your ESP8266 platform and re-install it. The Arduino IDE caches the platform archive files, so the reinstallation doesn't require downloading all that stuff from the Internet all over again and thus is very quick.

pert: I'm not familiar with pyenv. I would be nervous about moving anything from that location, as it might cause problems for your uses of Python outside the Arduino IDE.

You could copy it there, or you could update the python3 symlink that's located at /Users/{username}/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 to point to the location on your computer where Python 3 is already installed. I don't know what you mean by "include". With an unmodified installation of the ESP8266 platform, you only need for the file /Users/{username}/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 to either be a symlink pointing to your installation of Python 3, or for the Python 3 installation to be in that folder.

If you have made some unspecified modifications to the ESP8266 platform while attempting to fix this error, then I couldn't say what you would need to do to make it work. I agree with BitSeeker that it's best for you to delete your ESP8266 platform and re-install it. The Arduino IDE caches the platform archive files, so the reinstallation doesn't require downloading all that stuff from the Internet all over again and thus is very quick.

Awsome this fixed the error. By include I meant a symlink pointing to it, I just didn't know the technical terms, I'm new to a lot of this stuff,

Thanks so much and I was having one other issue and was wondering if you guys could help.

When I connect my NodeMCU to the computer, the device appears in my system report (Mac OSX if I didn't mention before), however in the Arduino IDE the port does not appear. I connected my arduino nano with its respective cable, and the port showed up and all the code worked perfectly, however with the NodeMCU the port does not appear.

My initial thought is it is an issue with the cable, but was wondering if there might be another issue I don't know about.

Thanks again for the help with the python directory that was very useful.

Could be a problem with the cable or you may need to install a driver, maybe CH340 or CP2102 depending on which USB chip the board has.

BitSeeker: Could be a problem with the cable or you may need to install a driver, maybe CH340 or CP2102 depending on which USB chip the board has.

I downloaded a CH341 Driver, it did not fix the issue.

I do not believe the cable is the issue, because when I go to the system report, the usb cable is detected, so I had assumed that the cable is not the issue.

U said CH340, I downloaded something coming from a file titled CH341SER_MAC, but the README simply said CH34X USB SERIAL DRIVER. If you believe this is the issue, please let me know I will download both the 340 and 2102 drivers.

Never mind I downloaded the 2102 driver and its working perfectly now.

Thanks again guys!

Mine has a CH340 chip, but I have had this for some time. I notice the newer boards have a CP2102 chip which is why I mentioned both. I probably should have said have a look at the board to see which chip is has. Glad you got it sorted though.

SidKadari: Never mind I downloaded the 2102 driver and its working perfectly now.

Thanks again guys!

Hello I have the same problem as you, I cannot communicate with the ESP, could you show me your configuration at the level of the USB port and what you have selected as wifi?

thank you