Ubuntu vscode pio extension install: PlatformIO: Can not find working Python 3.6+ Interpreter

I was using pio on vscode for a year but something broke and I don’t understand what. I’m running the ElementaryOS derivative of Ubuntu 20 (focal).

$ which python
/usr/bin/python

$ python --version
Python 3.8.10

$ echo $PATH
/opt/ros/noetic/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

So it seems my default Python should be 3.6+ compliant, right?

But when I install the pio vscode extension I get this error:

PlatformIO: Can not find working Python 3.6+ Interpreter. Please install the latest Python 3 and restart VSCode.

If I use the “I have Python” button a force it to /usr/bin/python the error persists.

BTW, I did install python3-venv with ‘sudo apt install python3-venv’.

Also, if I try to install via the 'get-platformio.py" I get these errors:

$ python3 get-platformio.py
Traceback (most recent call last):
File “get-platformio.py”, line 68, in
main()
File “get-platformio.py”, line 60, in main
bootstrap()
File “get-platformio.py”, line 44, in bootstrap
import pioinstaller.main
File “”, line 259, in load_module
File “/home/user/Development/.piocore-installer-lkj4jp7q/tmp79xn8h_x/pioinstaller.zip/pioinstaller/main.py”, line 22, in
File “”, line 259, in load_module
File “/home/user/Development/.piocore-installer-lkj4jp7q/tmp79xn8h_x/pioinstaller.zip/pioinstaller/core.py”, line 28, in
File “”, line 259, in load_module
File “/home/user/Development/.piocore-installer-lkj4jp7q/tmp79xn8h_x/pioinstaller.zip/pioinstaller/home.py”, line 18, in
File “”, line 259, in load_module
File “/home/user/Development/.piocore-installer-lkj4jp7q/tmp79xn8h_x/pioinstaller.zip/requests/init.py”, line 45, in
File “”, line 259, in load_module
File “/home/user/Development/.piocore-installer-lkj4jp7q/tmp79xn8h_x/pioinstaller.zip/requests/exceptions.py”, line 11, in
File “”, line 259, in load_module
File “/home/user/Development/.piocore-installer-lkj4jp7q/tmp79xn8h_x/pioinstaller.zip/requests/compat.py”, line 72, in
ImportError: cannot import name ‘JSONDecodeError’ from ‘simplejson’ (unknown location)

Clearly, something is deeply wrong here. Any help is much appreciated.

I reinstalled vscode from Flathub and for some reason PIO Extension then installed without any problems.

I’m using platformio on Ubuntu 20.4, it’s been a few months now, and I’ve just come across this problem, it says it didn’t find the python interpreter, however I was already using version 3.8.10 (/usr/bin/python3)
I have already reinstalled the extension and so far I have had no success.

Installing sudo apt install -y python3-venv fixed the problem for me on ubuntu

11 Likes

@ josebarreto1 that fixed my issues as well. Thank You.

1 Like

that fixed my issues as well. but why platformio do not use default python?

1 Like

That also fix the problem for me, thanks!

1 Like

This is still not fixed, but thanks for the workaround.

1 Like

Yeah… This fixed my issue…

1 Like

The solution described in the link below worked fine for me, without installing Flathub package, just first updating Python (if necessary), and then the virtual environment of your installed Python.
https://github.com/platformio/platformio-core-installer/issues/1774

Solved here also. :ok_hand:
Thank you.