PlatformIO Community

Platformio.__main__

Honestly, I think Ive deleted something but not sure when or where.

Traceback (most recent call last):
File “/usr/local/bin/platformio”, line 7, in
from platformio.main import main
ImportError: No module named platformio.main

I’ve done a fresh install of VS and platformio but I still get this.

Any recommendations welcomed.

Seems like you have installed PlatformIO globally. Try and use the isolated environment that is automatically installed with the VSCode plugin and uninstall the global installation (pip3 uninstall platformio etc.)

I ran that command but get the message

WARNING: Skipping platformio as it is not installed.

Any idea?

Maybe pip uninstall platformio? Did you install it as an apt package? (sudo apt remove platformio)?

I tried both those commands and this is the outcome

MacBook-Pro:~ user$ sudo apt remove platformio
Password:
Unable to locate an executable at “/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/apt” (-1)
MacBook-Pro:~ user$ pip uninstall platformio
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with ‘-m pip’ instead of running pip directly.
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 Release process - pip documentation v23.0.dev0 pip 21.0 will remove support for this functionality.
WARNING: Skipping platformio as it is not installed.
MacBook-Pro:~ user$

Did you install it with the brew? Then brew remove platformio.

In any case, you can try and remove the platformio files in /usr/local/bin (there may be more than platformio, like pio, or piogdb .

For a clean uninstall, also remove <home folder>/.platformio completely. Then reinstall the PlatformIO VSCode extension.

Perfect, clearing out the bin file and a fresh install has done trick.

Thank you so much