VSCode/PlatformIO IDE + Clion/PlatformIO : multiple PIO core conflicts

Hello,

  1. I have a VSCODE + PIO IDE v3.3.4 plugin (Platform IO core v6.1.16)

  2. I have installed CLion and the PlatformIO for CLion plugin (Platform IO core v5.0.3) but I meet some issues:

  • When creating a new platformIO project, I can’t choose ESP32 boards. So I try to use an arduino Uno board project with the Arduino framework.
  • I meet a build error after the project creation : PlatformIO utility exit code: 2
  • If I try to run “update platforms” in “Tools\PlatformIO” menu, I have the following error messages:
Obsolete PIO Core v5.0.3 is used (previous was 6.1.16)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/page/faq.html#multiple-platformio-cores-in-a-system
Error: Traceback (most recent call last):
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\deeja\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\deeja\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\commands\home\command.py", line 52, in cli
    inject_contrib_pysite()
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\manager\core.py", line 80, in inject_contrib_pysite
    contrib_pysite_dir = get_core_package_dir("contrib-pysite")
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\manager\core.py", line 37, in get_core_package_dir
    pkg = pm.get_package(spec)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 236, in get_package
    for pkg in self.get_installed():
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 209, in get_installed
    pkg = PackageItem(pkg_dir)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 400, in __init__
    self.metadata = self.load_meta()
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 430, in load_meta
    return PackageMetaData.load(manifest_path)
  File "c:\users\deeja\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 388, in load
    data["spec"] = PackageSpec(**data["spec"])
TypeError: __init__() got an unexpected keyword argument 'uri'

I understand there is a conflict with 2 versions of platformIO core but I don’t know why I don’t have the same last versions for both IDE (VSCode and CLion) and how to change the path of the platformIO core in the CLion plugin.

Rem. : I can see there are some settings in the platform IO IDE plugin of VSCode IDE ( platformio-ide.useBuiltinPIOCore and platformio-ide.customPATH) but I don’t know where they are in the CLion platformIO plugin.

If you don’t have any custom modifications / work done in the PlatformIO-internal folder c:\users\deeja\.platformio\, my advice would be to completely delete PlatformIO from the system and cleanly reinstall it.

That is, following the documentation:

  • Delete C:\Users\deeja\.platformio\ completely
  • Delete any PlatformIO core version that may be installed via pip with pip uninstall platformio and python -m pip uninstall platformio in a regular terminal (also with pip3, python3)
  • Cleanly reinstall the PlatformIO core using this method
  • Add PlatformIO to your PATH so CLion can find it, per documentation
  • Delete the .pio folder of your project (contains old build files produced by the old core)

After all that, a restart of the system and CLion, CLion should now be using only the new core.

I have found an other platformio folder in the following directory : C:\.platformio

Then there are 2 versions installed :
C:\.platformio → currently used by VSCode.
%HOMEPATH%\.platformio → curently used by CLion.

I think (but not sure) I have previously installed VSCode at “current user level”, then uninstall it before install it again at “all users level” this time.
So, the %HOMEPATH%\.platformio was unused until I install CLion.
But with CLion, there is a conflict detected unlike with VSCode.

To solve the issue, I have finally deleted the %HOMEPATH%\.platformio folder, then uninstall and install again the platformio plugin for CLion.
I will had to specify the platfomio path in CLion Settings → languages & frameworks → PlatformIO with the C:\.platformio path because it seems CLion can’t detected platformio in this folder.

Rem. : I’m using Windows 10

To get the platformio location for each IDE (VSCode and CLion), I have done the following code in the embedded terminal : pip show platformio