Esptool.py ImportError and AttributeError on MacOS 10.14

I am receiving an ImportError from esptool. While the downloads page says 10.14 is still supported, I do notice the following possible relevant in the traceback:

_ctypes.cpython-38-darwin.so (which was built for Mac OS X 10.15)

Arduino IDE 1.8.19 and 2.0.0, all libraries and boards up to date
Mac OS Mojave 10.14
Python 3.6.5

The example below is trying to compile/verify with an empty sketch. My environment worked as of a month ago, but I did accept library and board definition updates. This behavior is the same in 1.8.19 and 2.0.0.

Thanks!

Traceback (most recent call last):
  File "esptool/loader.py", line 48, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "serial/tools/list_ports.py", line 31, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "serial/tools/list_ports_posix.py", line 33, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "serial/tools/list_ports_osx.py", line 26, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "ctypes/__init__.py", line 7, in <module>
ImportError: dlopen(/var/folders/8x/fqxqxbq96s1bs57318xzvpm00000gp/T/_MEID4ngyt/lib-dynload/_ctypes.cpython-38-darwin.so, 2): Symbol not found: _ffi_closure_alloc
  Referenced from: /var/folders/8x/fqxqxbq96s1bs57318xzvpm00000gp/T/_MEID4ngyt/lib-dynload/_ctypes.cpython-38-darwin.so (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libffi.dylib
 in /var/folders/8x/fqxqxbq96s1bs57318xzvpm00000gp/T/_MEID4ngyt/lib-dynload/_ctypes.cpython-38-darwin.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "esptool.py", line 31, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "esptool/__init__.py", line 42, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "esptool/cmds.py", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "esptool/bin_image.py", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "esptool/loader.py", line 53, in <module>
AttributeError: module 'sys' has no attribute 'VERSION'
[41626] Failed to execute script 'esptool' due to unhandled exception!

exit status 1

Compilation error: exit status 1

This other report looks related:

Hi @twoeven

That is for the Arduino IDE application itself. The IDE also uses arbitrary tools supplied by the platform of the board you are compiling for. The minimum operating system requirements of those tools are at the discretion of the platform creator.

esptool is a component of the ESP32 platform's toolchain. This platform was created by 3rd parties with no direct involvement from Arduino.

They discuss the problem here:

It seems the two most simple options:

  • Use Boards Manager to install ESP32 boards platform version 1.0.6 (this was the last version before the incompatibility was introduced in ESP32 boards platform version 2.0.0.
  • Update your macOS operating system.

Some more complicated options are discussed at the link above.

:+1: Thanks!

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

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