PlatformIO Community

PlatformIO core stuck on old version, having trouble installing VScode plugin

Hello,

I am trying to get PlatformIO back up and running on a computer that I have not used in awhile. When I try to install via VScode, I get the following error:

Error: Error: Compatible PlatformIO Core not found.
Reason: PlatformIO Core version 5.0.4 does not match version requirements >=5.1.

at c:\Users\david\.vscode\extensions\platformio.platformio-ide-2.4.0\node_modules\platformio-node-helpers\dist\index.js:1:5240
at ChildProcess.r (c:\Users\david\.vscode\extensions\platformio.platformio-ide-2.4.0\node_modules\platformio-node-helpers\dist\index.js:1:5134)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:467:12)
at ChildProcess.cp.emit (c:\Users\david\.vscode\extensions\platformio.platformio-ide-2.4.0\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1048:16)
at Pro...

Seems that the core version that I have is old. So, I have tried:

-make sure that .platformio is deleted from my user directory
-uninstall and reinstall VScode, and then the PlatformIO extension

got the same error.

Then, I tried to manually upgrade python and pip, and manually install the PlatformIO core. Weirdly, it says that it is installing 5.2.4, but after the install I check the version and it says that it has 5.0.4:

C:\Users\david\Desktop>pip install -U platformio
Collecting platformio
  Using cached platformio-5.2.4.tar.gz (219 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: bottle==0.12.* in c:\python310\lib\site- 
   packages (from platformio) (0.12.19)
    Requirement already satisfied: click!=8.0.2,<9,>=8 in 
c:\python310\lib\site-packages (from platformio) (8.0.3)
Requirement already satisfied: colorama in c:\python310\lib\site- 
packages (from platformio) (0.4.4)
Requirement already satisfied: marshmallow<4,>=2 in 
c:\python310\lib\site-packages (from platformio) (3.14.1)
Requirement already satisfied: pyelftools<1,>=0.27 in 
c:\python310\lib\site-packages (from platformio) (0.27)
Requirement already satisfied: pyserial==3.* in c:\python310\lib\site- 
packages (from platformio) (3.5)
Requirement already satisfied: requests==2.* in c:\python310\lib\site- 
packages (from platformio) (2.26.0)
Requirement already satisfied: semantic_version==2.8.* in 
c:\python310\lib\site-packages (from platformio) (2.8.5)
Requirement already satisfied: tabulate==0.8.* in c:\python310\lib\site- 
packages (from platformio) (0.8.9)
Requirement already satisfied: zeroconf==0.37.* in c:\python310\lib\site- 
packages (from platformio) (0.37.0)
Requirement already satisfied: aiofiles==0.8.* in c:\python310\lib\site- 
packages (from platformio) (0.8.0)
Requirement already satisfied: ajsonrpc==1.* in c:\python310\lib\site- 
packages (from platformio) (1.2.0)
Requirement already satisfied: starlette==0.17.* in c:\python310\lib\site- 
packages (from platformio) (0.17.1)
Requirement already satisfied: uvicorn==0.16.* in c:\python310\lib\site- 
packages (from platformio) (0.16.0)
Requirement already satisfied: wsproto==1.0.* in c:\python310\lib\site- 
packages (from platformio) (1.0.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\python310\lib\site- 
packages (from requests==2.*->platformio) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in 
c:\python310\lib\site-packages (from requests==2.*->platformio) (1.26.7)
Requirement already satisfied: idna<4,>=2.5 in c:\python310\lib\site- 
packages (from requests==2.*->platformio) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in 
c:\python310\lib\site-packages (from requests==2.*->platformio) (2.0.9)
Requirement already satisfied: anyio<4,>=3.0.0 in c:\python310\lib\site- 
packages (from starlette==0.17.*->platformio) (3.4.0)
Requirement already satisfied: h11>=0.8 in c:\python310\lib\site- 
packages (from uvicorn==0.16.*->platformio) (0.12.0)
Requirement already satisfied: asgiref>=3.4.0 in c:\python310\lib\site- 
packages (from uvicorn==0.16.*->platformio) (3.4.1)
Requirement already satisfied: ifaddr>=0.1.7 in c:\python310\lib\site- 
packages (from zeroconf==0.37.*->platformio) (0.1.7)
Requirement already satisfied: sniffio>=1.1 in c:\python310\lib\site- 
packages (from anyio<4,>=3.0.0->starlette==0.17.*->platformio) (1.2.0)
Using legacy 'setup.py install' for platformio, since package 'wheel' is not 
installed.
Installing collected packages: platformio
    Running setup.py install for platformio ... done
Successfully installed platformio-5.2.4


C:\Users\david\Desktop>C:\Users\david\.platformio\penv\Scripts\platformio.exe --version
PlatformIO Core, version 5.0.4

Also, if I try to manually upgrade it, it happily reports that it already has 5.0.4:

C:\Users\david\Desktop>C:\Users\david\.platformio\penv\Scripts\platformio.exe upgrade
Please wait while upgrading PlatformIO ...
PlatformIO has been successfully upgraded to 5.0.4
Release notes: https://docs.platformio.org/en/latest/history.html

Any help would be greatly appreciated!

You install PlatformIO in your global environment.

And no the isolated Python environment in there stays completely unmodified.

You should never globally install PlatformIO due to possibly conflicting with other Python pacakges on your system and having duplicate cores (FAQ).

You should remove PlatformIO globally (pip uninstall platformio) and follow PlatformIO Core not updating to the latest version on macOS 11.6.x - #4 by ivankravets.

1 Like

Thanks for your reply!

Unfortunately, this did not work - I used pip uninstall platformio and then removed my penv and python3 subdirs from the .platformio folder in my user directory. I’m on Windows but it looks similar to what the link you referenced for Mac said to do.

C:\WINDOWS\system32>pip uninstall platformio
Found existing installation: platformio 5.2.4
Uninstalling platformio-5.2.4:
  Would remove:
    c:\python310\lib\site-packages\platformio-5.2.4-py3.10.egg-info
    c:\python310\lib\site-packages\platformio\*
    c:\python310\lib\site-packages\scripts\99-platformio-udev.rules
    c:\python310\lib\site-packages\scripts\docspregen.py
    c:\python310\lib\site-packages\scripts\fixsymlink.py
    c:\python310\lib\site-packages\scripts\get-platformio.py
    c:\python310\lib\site-packages\scripts\install_devplatforms.py
    c:\python310\scripts\pio-script.py
    c:\python310\scripts\pio.exe
    c:\python310\scripts\piodebuggdb-script.py
    c:\python310\scripts\piodebuggdb.exe
    c:\python310\scripts\platformio-script.py
    c:\python310\scripts\platformio.exe
Proceed (Y/n)? y
  Successfully uninstalled platformio-5.2.4

but then when I restarted VScode it did the usual trying to finish the platformio routine, and gave me the same error:

Error: Error: Compatible PlatformIO Core not found.
Reason: PlatformIO Core version 5.0.4 does not match version requirements >=5.1.

	at c:\Users\david\.vscode\extensions\platformio.platformio-ide-2.4.0\node_modules\platformio-node-helpers\dist\index.js:1:5240
	at ChildProcess.r (c:\Users\david\.vscode\extensions\platformio.platformio-ide-2.4.0\node_modules\platformio-node-helpers\dist\index.js:1:5134)
	at ChildProcess.emit (events.js:315:20)
	at ChildProcess.EventEmitter.emit (domain.js:467:12)
	at ChildProcess.cp.emit (c:\Users\david\.vscode\extensions\platformio.platformio-ide-2.4.0\node_modules\cross-spawn\lib\enoent.js:34:29)
	at maybeClose (internal/child_process.js:1048:16)
	at Pro...

I do not know where this 5.0.2 version lives! Also, the penv and python3 folders are back.

Thank you!

There should be no core 5.0.4 found if you removed the entire c:\Users\david\.platformio folder per the last post I linked you to. You did that, right?

I did! Hence the mystery.

Delete it again and see if it does a reinstall after VSCode is restarted.

Wow, thanks for the fast reply!

Here is what I have tried this morning:

  • Deleted .platformio directory again
  • Went to recycle bin, saw the other 4 times that I have deleted the .platformio directory, emptied recycle bin
  • Restarted VScode, it tried to install platformio again, and errors out with the same error
  • Deleted .platformio folder, uninstall VScode, delete .vscode directory
  • Restart computer, freshly install VScode and platformio extension
  • platformio extension install still fails saying that there is core 5.0.4 hanging around somewhere! Argh!

The left sidebar has a button for the extensions, and the PlatformIO one should have a cogwheel subsettings menu. There should be a setting like “Use Built-In Python” and “Use-Built-In Core”. Are those turned on or off?

image

Here is what it shows!

This all looks good… I’m baffled why it would reinstall an old version even after deleting the .platformio folder…

Can you open a CLI and execute pio upgrade --dev there, what is the output?

If it’s still the old version, what does pip install -U platformio show?

So weird! Glad that I am not missing something obvious though, haha

Well, when I run pio from the command line, the command is not found on account of the previous comment instructing me to remove the manually installed CLI. But, in my first comment up there, you can see what happens when it is installed - using pip to install it directly, it seems to be pulling 5.2.4.

I can run C:\Users\david\.platformio\penv\Scripts\platformio.exe --version to try the one that was just freshly pulled by VScode after removing my old .platformio directory, and it’s telling me that it has 5.0.4!

OK, so I think I got it to work. I checked my Path variable, and removed all other installations of Python that are mentioned in it, except for the 3.10 that I installed for the purposes of getting platformio. After this, VScode installed the platformio plugin successfully, and I can see projects and the toolbar etc.

I guess that the module installer was using a different version of python somehow, and this triggered it to download an older version of the core?

Anyway, thanks for the help! I’m sure it won’t be the last time lol