ESP8266 Python issue: LookupError: no codec search functions registered: can't find encoding

Hi there!

Pls. let me know if this is the right place to post this or if there's a more specialized ESP8266 topic or forum.

I have Arduino IDE 1.9.19 running on macOS Big Sur 11.6
Installed ESP8266 Boards from:
http://drazzy.com/package_drazzy.com_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json
And then installed version 3.0.2

When I try to compile a simple program I get this:

atal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: no codec search functions registered: can't find encoding

I ran the Python executable separately on the shell and got the same result and tried playing around with PYTHONHOME, PYTHONPATH, LANG etc. to see if I could even get the bundled Python to run by itself with no avail.

I believe that earlier versions relied on you having local Python installed, but this one comes with a bundled Python. It would seem like an easy thing to fix but I am not a Python expert so not getting very far. Perhaps this is a well known issue, not sure :frowning:

Any help greatly appreciated!

--
Alex

I found a similar report here:

which was claimed to be fixed by this:

Even though it is titled "on Windows", that change is in effect on all operating systems. But that fix is in the 3.0.2 release, so clearly it did not solve the problem for you.

The general (not specific to Arduino and ESP8266) issue is discussed here:

This is not a Python bug, this is a symptom of setting PYTHONHOME and/or PYTHONPATH when they’re not needed. In nearly all cases you don’t need to set either of them; in the case of PYTHONHOME it’s almost always a mistake to set.

I recommend checking whether PYTHONHOME is set in /etc/launchd.conf. If so, remove it:

Thanks for all the pointers, but haven't found a solution yet.

PYTHONHOME and PYTHONPATH are not set so that's not the issue either.

I also tried installing from git per: Installing β€” ESP8266 Arduino Core 3.1.1-12-g6dfebec8 documentation

And that also has some problems but are different, and in that case it's unable to load _posixsubprocess.

It seems that either way ESP8266 3.0.2 is currently broken for Arduino IDE and macOS Big Sur.

I'm sorry to hear that. I use the ESP32 platform on Windows and Linux all the time without any problems, but I don't have easy access to a macOS machine.

Maybe one of the other forum users who is on macOS can comment about their experiences using the ESP32 Arduino platform.

Hi in0 ! Thanks for all your help, really appreciate it !

I just tried downgrading to 3.0.1 and it works!

  1. Make sure to remove 3.0.2 first
  2. Install 3.0.1 and it works just fine

I hope it helps other Big Sur users!

Best,

--
Alex

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.