Raspberry Pi OS - Error: Python 3.6 or later is required for this operation

HI

I got that error trying to run platformio with VSCode :

pi@raspberrypi:~ $ pio system info
Error: Python 3.6 or later is required for this operation.
Please check a migration guide:
https://docs.platformio.org/en/latest/core/migration.html#drop-support-for-python-2-and-3-5

So I’ve done the migration that was asked for about python but the error is still there !

I’ve checked the process and “USER_HOME_DIR/.platformio/penv” was actualy newly created after I deleted it, then ran the Installer Script.

You might have multiple PlatformIO core installations. Try to remove everything (rm -rf ~/.platformio, pip uninstall platformio, sudo -H pip3 uninstall platformio) until PlatformIO is completely gone. Then use the installer script to re-install it again with Python3 and add it to the path.

Here is the command I’ve lastly done considering your answer .

   pi@raspberrypi:~/Documents/PlatformIO $ cd ~
pi@raspberrypi:~ $ pwd
/home/pi
pi@raspberrypi:~ $ ls -al | grep ./plat
pi@raspberrypi:~ $ pip uninstall platformio
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Found existing installation: platformio 5.2.1b2
Uninstalling platformio-5.2.1b2:
  Would remove:
    /home/pi/.local/bin/pio
    /home/pi/.local/bin/piodebuggdb
    /home/pi/.local/bin/platformio
    /home/pi/.local/lib/python2.7/site-packages/platformio-5.2.1b2.dist-info/*
    /home/pi/.local/lib/python2.7/site-packages/platformio/*
    /home/pi/.local/lib/python2.7/site-packages/scripts/99-platformio-udev.rules
    /home/pi/.local/lib/python2.7/site-packages/scripts/docspregen.py
    /home/pi/.local/lib/python2.7/site-packages/scripts/fixsymlink.py
    /home/pi/.local/lib/python2.7/site-packages/scripts/get-platformio.py
    /home/pi/.local/lib/python2.7/site-packages/scripts/install_devplatforms.py
Proceed (y/n)? y
  Successfully uninstalled platformio-5.2.1b2
pi@raspberrypi:~ $ sudo -H pip3 uninstall platformio
Skipping platformio as it is not installed.
pi@raspberrypi:~ $ rm -rf ~/.platformio
pi@raspberrypi:~ $ 

I didn’t need to use the installer script to re-install it again with Python3 and add it to the [path].
platformio installed by itself when I started back VSCode.
And it seems to now work properly.

Great thanks !

Yeh, pip (aka pip2 for Python2) had PlatformIO installed, that was your issue.