PlatformIO extension won't install on M1 after running Install script

I recently attempted an install of the CLI tools by running the curl example from the website. The install appeared to work, but I no longer can install the VSCode extension.

Things I tried:
1 Delete ~/.platformio and reinstall
2 Reinstall VSCode (removing all support directories)
3 brew install platformio and unchecking “use builtin PIOCore”
4 Unchecking “use builtin python”

All but #3 returned this error:

VSCode: 1.74.3
PIO IDE: v2.99.4
System: Darwin, 22.2.0, arm64

%23 Exception

Error: Error: Compatible PlatformIO Core not found.
Reason: Could not run `/Users/me/.platformio/penv/bin/platformio --help`.
Error: Traceback (most recent call last):
File "/Users/me/.platformio/penv/bin/platformio", line 5, in <module>
  from platformio.__main__ import main
File "/Users/me/.platformio/penv/lib/python3.10/site-packages/platformio/__main__.py", line 21, in <module>
  from platformio import __version__, exception, maintenance
File "/Users/me/.platformio/penv/lib/python3.10/site-packages/platformio/maintenance.py", line 22, in <module>
  from platformio import __version__, app, exception, fs, telemetry
File "/Users/me/.platformio/penv/lib/python3.10/site-packages/platformio/telemetry.py", line 30, in <module>
  from platformio import __version__, app, exception, util
File "/Users/me/.platformio/penv/lib/python3.10/site-packages/platformio/util.py", line 28, in <module>
  from platformio.device.list.util import list_serial_ports as get_serial_ports
File "/Users/me/.platformio/penv/lib/python3.10/site-packages/platformio/device/list/util.py", line 21, in <module>
  import zeroconf
File "/Users/me/.platformio/penv/lib/python3.10/site-packages/zeroconf/__init__.py", line 25, in <module>
  from ._cache import DNSCache  %23 noqa %23 import needed for backwards compat
ImportError: dlopen(/Users/me/.platformio/penv/lib/python3.10/site-packages/zeroconf/_cache.cpython-310-darwin.so, 0x0002): tried: '/Users/me/.platformio/penv/lib/python3.10/site-packages/zeroconf/_cache.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/me/.platformio/penv/lib/python3.10/site-packages/zeroconf/_cache.cpython-310-darwin.so' (no such file), '/Users/me/.platformio/penv/lib/python3.10/site-packages/zeroconf/_cache.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))


  at /Users/me/.vscode/extensions/platformio.platformio-ide-2.99.4-darwin-arm64/node_modules/platformio-node-helpers/dist/index.js:1:5362
  at ChildProcess.o (/Users/me/.vscode/extensions/platformio.platformio-ide-2.99.4-darwin-arm64/node_modules/platformio-node-helpers/dist/index.js:1:4660)
  at ChildProcess.emit (node:events:526:28)
  at ChildProcess.emit (node:domain:475:12)
  at maybeClose (node:internal/child_process:1092:16)
  at ChildProcess._handle.onexit (node:internal/child_process:302:5)

Having Rosetta (2) installed to run x86_64 binaries on your ARM M1 is mandatory.

I do have Rosetta 2 installed:

/usr/bin/pgrep -q oahd && echo Yes || echo No
Yes

I get the error whether I’m running the ARM, Intel or Universal version of VSCode.

I assume the plugin uses a self-contained python instance… is there anything else in my local environment that can cause this?

Hm. Not sure why it would still be complaining about an architecture mismatch when VSCode is running as an x86_64 process and wants to load the x86_64 ZeroConf library. Maybe @ivankravets has some more ideas?

1 Like

Sorry, a lot of issues with the “zeronconf” package. We have just removed it from the PlatformIO Core and will install it on demand. See

Could you open PlatformIO IDE Terminal and type pio upgrade --dev. Restart VSCode. It should work now. The upcoming PlatformIO Core 6.1.6 will not depend on the “zeroconf”.

Calling pio shows the same error. This is with trying ~/.platformio/penv/bin/platformio and trying pio installed via brew

I would be willing to do a full reinstall of VSCode and PlatformIO but at this point I’m not sure what to remove. on the platformIO side, other than running the brew uninstall platformio and rm -rf ~/.platformio.

I also tried installing the CLI tools via the main site’s curl command. I do not know what was installed as it was base64 encoded

Yes, it is impossible to switch to the “dev” version with brew. We plan to release PIO Core 6.1.6 next week.

I was able to get version 6.1.6rc1 installed via brew and working with VSCode. I had to build and install zeroconf.

  • Install platformio via brew: brew install platformio
  • Install “poetry” using my brew-installed Python3: pip3 install poetry
  • Force build/install zeroconf: pip3 install --no-binary :all: zeroconf
  • Run pio upgrade --dev

At this point I have a working install of pro via brew. I installed the VSCode plugin and configured it to use the brew instance:

{
    "platformio-ide.customPATH": "/opt/homebrew/bin/platformio",
    "platformio-ide.useBuiltinPIOCore": false,
    "platformio-ide.useBuiltinPython": false,
    "platformio-ide.useDevelopmentPIOCore": true
}

At this point the PlatformIO started working in VSCode and I can build my existing project.