Failure to execute script 'esptool' when using Arduino Create

When trying to upload the blink example sketch to the Feather ESP32 V2, it fails to execute the script 'esptool'. I get the same error when trying to run the 'esptool' unix executable /Users/~user/.arduino-create/esp32/esptool_py/4.2.1/esptool

I've tried reinstalling the Arduino Create agent, updating Python, updating pySerial via PyPl. I've also tried installing esptool from the Espressif website, using other ESP boards, and using the other user account on my computer, but the same error persists.

I've searched the internet with no success. Does anyone have any ideas about how to fix this problem?

Computer: MacBook Pro 15" late 2016
OS: macOS 10.14.6 (Mohave)
Browser: Chrome
Python 3.10.6
Board: Adafruit ESP32 Feather V2

/usr/local/bin/arduino-cli compile --fqbn esp32:esp32:featheresp32:DebugLevel=none,FlashFreq=80,PartitionScheme=default,UploadSpeed=921600 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/486945634/build --build-path /tmp/arduino-build-91E7009CA357B8F5B2A1812AB255CA7C /tmp/486945634/Blink

Sketch uses 219005 bytes (16%) of program storage space. Maximum is 1310720 bytes.

Global variables use 16088 bytes (4%) of dynamic memory, leaving 311592 bytes for local variables. Maximum is 327680 bytes.

Upload started

Programming with: Serial

Flashing with command:/Users/brian/.arduino-create/esp32/esptool_py/4.2.1/esptool --chip esp32 --port /dev/cu.wchusbserial54790242231 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 /var/folders/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/extrafiles676009330/Blink.bootloader.bin 0x8000 /var/folders/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/extrafiles676009330/Blink.partitions.bin 0xe000 /var/folders/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/extrafiles676009330/tools/partitions/boot_app0.bin 0x10000 /var/folders/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/arduino-create-agent365579423/Blink.bin

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/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/_MEIq7o6DV/lib-dynload/_ctypes.cpython-38-darwin.so, 2): Symbol not found: _ffi_closure_alloc

Referenced from: /var/folders/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/_MEIq7o6DV/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/k2/6w1kq2hn64ndmhc4bp78jvjc0000gn/T/_MEIq7o6DV/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'

[1560] Failed to execute script 'esptool' due to unhandled exception!
1 Like

I'm also facing same problem

/usr/local/bin/arduino-cli compile --fqbn esp32:esp32:esp32doit-devkit1:DebugLevel=none,FlashFreq=80,UploadSpeed=921600 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/249875231/build --build-path /tmp/arduino-build-1C5D0F5FC5551F51854275B4143967CE /tmp/249875231/MyHome_jan13a

Sketch uses 1107493 bytes (84%) of program storage space. Maximum is 1310720 bytes.

Global variables use 51392 bytes (15%) of dynamic memory, leaving 276288 bytes for local variables. Maximum is 327680 bytes.

Upload started

Programming with: Serial

Flashing with command:C:/Users/LAB 3/.arduino-create/esp32/esptool_py/4.2.1/esptool.exe --chip esp32 --port COM3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 C:/Users/LAB3~1/AppData/Local/Temp/extrafiles228554162/MyHome_jan13a.bootloader.bin 0x8000 C:/Users/LAB3~1/AppData/Local/Temp/extrafiles228554162/MyHome_jan13a.partitions.bin 0xe000 C:/Users/LAB3~1/AppData/Local/Temp/extrafiles228554162/tools/partitions/boot_app0.bin 0x10000 C:/Users/LAB3~1/AppData/Local/Temp/arduino-create-agent967188959/MyHome_jan13a.bin

Pyserial is not installed for C:\Users\LAB 3\.arduino-create\esp32\esptool_py\4.2.1\esptool.exe. Check the README for installation instructions.

Traceback (most recent call last):

File "esptool.py", line 31, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "esptool\__init__.py", line 42, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "esptool\cmds.py", line 14, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "esptool\bin_image.py", line 14, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "esptool\loader.py", line 21, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "serial\__init__.py", line 29, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "serial\serialwin32.py", line 15, in <module>

File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module

File "ctypes\__init__.py", line 7, in <module>

ImportError: DLL load failed while importing _ctypes: The parameter is incorrect.

[3240] Failed to execute script 'esptool' due to unhandled exception!

Hi @goutham1020.

Which version of Windows are you using? Is it the 32-bit version of Windows?

I ask because, even though I didn't find any reports of this error from ESP32 users specifically, I did find some reports that indicated it is caused by using an outdated version of Windows:

{
  "Version": "1.2.7"
}

{
  "Commands": [
    "list",
    "open <portName> <baud> [bufferAlgorithm: ({default}, timed, timedraw)]",
    "(send, sendnobuf, sendraw) <portName> <cmd>",
    "close <portName>",
    "restart",
    "exit",
    "killupload",
    "downloadtool <tool> <toolVersion: {latest}> <pack: {arduino}> <behaviour: {keep}>",
    "log",
    "memorystats",
    "gc",
    "hostname",
    "version"
  ]
}

{
  "Hostname": "LAB3-PC"
}

{
  "OS": "windows"
}

downloadtool windows-drivers latest arduino keep

downloadtool bossac 1.7.0 arduino keep

downloadtool fwupdater latest arduino keep

downloadtool rp2040tools latest arduino keep

list

Network Ports:
[]

{
  "DownloadStatus": "Pending",
  "Msg": "The tool is already present on the system"
}

{
  "DownloadStatus": "Success",
  "Msg": "Map Updated"
}

{
  "DownloadStatus": "Pending",
  "Msg": "The tool is already present on the system"
}

{
  "DownloadStatus": "Success",
  "Msg": "Map Updated"
}

{
  "DownloadStatus": "Pending",
  "Msg": "The tool is already present on the system"
}

{
  "DownloadStatus": "Success",
  "Msg": "Map Updated"
}

Serial Ports:
[
  {
    "Name": "COM3",
    "SerialNumber": "0001",
    "IsOpen": false,
    "VendorID": "0x10C4",
    "ProductID": "0xEA60"
  }
]

{
  "DownloadStatus": "Pending",
  "Msg": "The tool is already present on the system"
}

{
  "DownloadStatus": "Success",
  "Msg": "Map Updated"
}

list

list

Network Ports:
[]

Serial Ports:
[
  {
    "Name": "COM3",
    "SerialNumber": "0001",
    "IsOpen": false,
    "VendorID": "0x10C4",
    "ProductID": "0xEA60"
  }
]

Network Ports:
[]

Serial Ports:
[
  {
    "Name": "COM3",
    "SerialNumber": "0001",
    "IsOpen": false,
    "VendorID": "0x10C4",
    "ProductID": "0xEA60"
  }
]

list

Serial Ports:
[
  {
    "Name": "COM3",
    "SerialNumber": "0001",
    "IsOpen": false,
    "VendorID": "0x10C4",
    "ProductID": "0xEA60"
  }
]

Network Ports:
[]

list

Serial Ports:
[
  {
    "Name": "COM3",
    "SerialNumber": "0001",
    "IsOpen": false,
    "VendorID": "0x10C4",
    "ProductID": "0xEA60"
  }
]

Network Ports:
[]

list

Serial Ports:
[
  {
    "Name": "COM3",
    "SerialNumber": "0001",
    "IsOpen": false,
    "VendorID": "0x10C4",
    "ProductID": "0xEA60"
  }
]

@goutham1020 that doesn't answer my question:

I never figured out the exact cause of my problem but I had both Python2 and 3 installed and I think esptool was calling one of the Python2 libraries. I updated my OS to 12.6 (Monterey) and everything worked fine.

@goutham1020 I know you’re using a different OS, but perhaps you can try updating to a newer version of Windows.

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