Using Pymcuprog for upload

There might be a general problem with installing a Python tool such as pymcuprog in the global Python istallation and then calling it from within PlatformIO, which uses its own (and usually different) Python installation.

What you can try is removing pymcuprog from the global installation (pip uninstall pymcuprog I think), then executing pio system info in a CLI to get the Python Executable (e.g.), then using that as

<python executable> -m pip install -i https://test.pypi.org/simple/ pymcuprog==3.10.4.136

(test version per comment) to install it in PlatformIO’s environment. Maybe it makes a difference.