PlatformIO Community

Failed to install

Brand new Ubuntu install
Brand new VSCode install
Attempt to install Platformio IDE:

Error: Could not create PIO Core Virtual Environment. Please create it manually -> http://bit.ly/pio-core-virtualenv Error: Virtualenv Create: Traceback (most recent call last): File “/home/tom/.platformio/.cache/tmp-140064yrvsMluN1bJ/virtualenv-16.1.0/src/virtualenv.py”, line 20, in import distutils.spawn ModuleNotFoundError: No module named ‘distutils.spawn’ at t.value (/home/tom/.vscode/extensions/platformio.platformio-ide-1.8.1/node_modules/platformio-node-helpers/dist/index.js:1:31159)

And, a moment later:

[2019-08-02 09:10:23.224] [renderer1] [error] Cannot read property ‘stack’ of undefined: TypeError: Cannot read property ‘stack’ of undefined
at t.onMessage.process.on.t.catch.t (/snap/code/11/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:759:84)

Any ideas how to fix this? (Or what’s wrong?)
Thanks,
Tom.

Clang is a prerequisite. Installed Clang, tried again, success.

[RESOLVED]

1 Like

Well, that’s just annoying… the C/C++ extension which the PlatformIO extension has a dependency of used to install that… either step 2/4 or 3/4 IIRC.

I just checked on a clean 18.04 LTS VM, and it does… The error you got does actually tell you in a round-about way the real fix, and doing a sudo apt install clang just happens to fix it, but by installing 300MB+ of stuff unnecessarily…

ubuntu_pio_vscode_fail

Checking python3 was working (there’s no python2 on ubuntu by default now)… and then virtualenv… well, there’s the problem! Installing it, and restarting VSCode fixes it up nicely. I couldn’t tell offhand what package being installed with clang fixed it… perhaps python27?

ubuntu_pio_vscode_fail_fix

Were I more experienced perhaps I would have arrived at the same solution. I read somewhere along the way that Clang had been a prereq, and it worked fine after installation.

FWIW, an identical IDE install on Windows 10 immediately after this worked flawlessly the first time.

Do you suggest/recommend uninstalling Clang and then simply installing virtualenv? It’s the first thing on an empty 1TiB drive so space is not an issue (yet).

Following a if it ain't broke, don't fix it policy… I’d say leave it… As while technically, doing an sudo apt remove clang python27 && sudo apt install virtualenv && sudo apt install autoremove should still satisfy the prerequisites whilst removing unnecessary stuff and reducing the install size, there’s always the chance something else will break along the way.

On Windows, the PlatformIO extension downloads a standalone python package, so virtualenv is probably baked in.