Can't get PlatformIO Core to use Python3 on macOS Big Sur

I’m try to resolve the error:

Python 2 and Python 3.5 are not compatible with PlatformIO Core 5.0.
Please check the migration guide on how to fix this warning message:

https://docs.platformio.org/en/latest/core/migration.html#drop-support-for-python-2-and-3-5

I’m on macOS Big Sur, with PlatformIO Core installed via Homebrew. Trying to follow the instructions at the link above isn’t working.

python3 --version returns Python 3.9.1
which python3 returns /usr/local/bin/python3
pio system info gives me:

--------------------------  -------------------------------------
PlatformIO Core Executable  /usr/local/bin/platformio
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core             5.0.4
System Type                 darwin_x86_64
PlatformIO Core Directory   /Users/dean/.platformio
Python Executable           /usr/local/opt/python@2/bin/python2.7
Platform                    Darwin-20.2.0
Tools & Toolchains          0
Global Libraries            0
Development Platforms       0
Python                      2.7.17-final.0
--------------------------  -------------------------------------

I’ve also tried deleting the penv directory, nuking my .platformio directory and reinstalling directly from the plaformio site.

What am I doing wrong?

Hmmm Mac-OS may be a special case with its Python 2 version? (@ivankravets)

Otherwise it looks like with that Homebrew install method, it installed PlatformIO by doing a pip install platformio with a pip for Python2 version.

You may try to uninstall it again via some homebrew command and do a pip3 install platformio with the Python3-Pip, or use the installer script.

1 Like

It means you have multiple PlatformIO Core in the system. See Redirecting...

The Homebrew’s version should use Python 3. It seems you use old Homebrew’s formula.

I recommend uninstalling ALL PlatformIO Cores and install the official using our installer script. It will install PlatformIO Core into the isolated environment. You can later extend your PATH with PlatformIO Core’s commands. See Redirecting...

Thanks so much, @ivankravets and @maxgerhardt!

I removed the homebrew version and reinstalled from the script, fixed up my path, and all is well.

1 Like