Trying to install Platformio into VSCode, but it can't find Python, even though it is onboard!

I’m getting very frustrated! I have a Lenovo W540 laptop with 8Gb Ram, running Windows 10 Pro. I am trying to install the Platformio.ide extension in VSCode. I get the same error every time, about Python 2.7 or 3.5 interpreter not found. I have tried installing Python 2.7, 2.8, 3.0, 3.5, and 3.8. I have checked, and verified that Python was added to Path. No matter what I try, Platformio won’t find Python, and errors out on the installation. I have turned off all anti-virus and security software, but still no luck. Does anyone have any idea what I am doing wrong? Please help!

Stupid question time.

Have you restarted VSCode since installing Python and adding it to %PATH%? If not, it won’t know that Python is now on the path.

If you open a Windows command line session and type python --version does it work? If so, it’s definitely on %PATH%.

If not, did you download Python as per Redirecting...?

Cheers,
Norm.

1 Like

Also check that in the extension settings for “Python”, your interpreter path is set correctly.

Norman, Yes, I did everything you mentioned and still no go, but thanks!

Max, I checked this. It is also correct. Thanks for info.

Ok, in a moment of madness, I remembered that my laptop had been “upgraded” from a perfectly workable Windows 7 Professional, to a version of Windows 10 way back when the upgrade was free. It was never used for anything thereafter as I do all my work and business stuff on Linux.

So, I booted into Windows 10 and attempted an install of PlatformIO from scratch. I get a different problem to you I’m afraid, but this is what I did.

My System

  • Dell Vostro 1720
  • 8 GB RAM (maxed out)
  • Dual Core CPU.
  • Ahem, much older than 10 years.

TL;DR

  • Python 3.8.6 installed ok;
  • VSCode installed ok;
  • PlatformIO Installed ok;
  • PlatformIO Home screen will not load - it sits at a “Loading…” prompt eternally.

Edit After Win10 updated itself and a reboot, the PlatformIO Home page displays correctly. Sketch created and compiled ok.

Install Python

I went to Python Release Python 3.8.6 | Python.org and downloaded the "Windows Exe Installer 64 bit version. When done, I double-clicked it, dismissed the pop-up from Norton/Symantec and OK’d the installer to continue.

I ticked all the options to install for everyone and to add Python to the path. It executed and installed Python.

When done, I opened a new CMD session, and the python --version command returned 3.8.6. So far so good.

Install VSCode

I then went to Download Visual Studio Code - Mac, Linux, Windows and grabbed the 64 bit Windows “user installer” version. On completion, I double-clicked to run and ticked all the options to Create desktop icons, register menu options in Explorer, register known file extensions.

When it finished installing, it opened all by itself. I checked installed extensions, there were none.

Install PlatformIO IDE

On the extensions tab, in VSCode, I serahced for PlatformIO and clicked the “install” button for PlatformIO IDE 2.1.0. That did a few things, and took quite a while to do it - Linux is far far faster!

  • Download portable Python Interpreter - Interesting as I’ve already installed Python 3.8.6.

  • Install PlatformIO Core. This took quite a while. But did finish. I was asked to reload the Window, so I did.

I then checked the installed extensions - I have:

  • C/C++ for VSCode (Microsoft) version 1.0.1.
  • PlatformIO IDE version 2.0.1.

That is all.

Reboot VSCode, just to be sure. It’s a Windows thing!

On restarting, the PlatformIO Home page sits at a “Loading…” prompt for ages. I gave up after 15 minutes of nothing happening. A quick look in Help->Toggle Developer Options → Console Tab showed no errors that were related.

I thought maybe a reboot would be needed, it’s Windows after all. Big Mistake! Laptop now hung up at the “Getting Windows Ready, Don’t turn off your computer” prompt.

Trust me, the laptop will be turned off and my Windows partition reformatted for Linux to use.

However, there does seem to be a problem with VSCode and/or PlatformIO IDE on my version of Windows 10, but it does appear that I can see Python after installing it first.

Speaking of which, the “portable Python Interpreter” downloaded by PlatformIO and installed into c:\users\norman\.platformio\python3 appears to be Python 3.7.7.

I’m now wondering:

  • Is Windows 10 not usable with VSCode and PlatformIO? It can’t be as there are plenty of users (Think Marlin and 3D printers) - so it must be my ancient version of Windows 10.

  • Is it actually necessary to pre-install a Python interpreter before installing VSCode and PlatformIO - the developer tools console appears to show that PlatformIO is using the portable installation.

  • Will I ever get my laptop back from the greasy grip of Windows updater? :frowning_face:

Sorry, I’m no help I’m afraid.

EDIT Suddenly, the laptop shutdown! It was finished updating. I restarted and after a quick (very quick) “updating … 100%”) I was into Windows 10 again. This time, after opening VSCode, I saw a prompt on the status bar, “Checking PlatformIO core…” and when it finished, the PlatformIO Home page loaded.

To be sure it all worked, I created a new project, in the default location, for an Arduino Uno and named it Blink.

Hmm, interesting, I see on Windows, you get a src/main.cpp created with a blank Arduino sketch inside it. That’s not happening on Linux - as far as I remember.

Clicked Build and after lots of stuff downloaded, the build was a success.

Cheers,
Norm.

1 Like

Norman,
I just had a chance to follow your example on my Win 10 machine. I did everthing step-by-step as you wrote, and downloaded the exact files you mentioned. Well, Python 3.8.6 resides happily on my system, and is listed in the path. VSCode loaded and resides happily on my system, right up to where I install PlatformIO.ide. I get the error message “Failed to load PlatformIO”. I give up! lol.

I need this setup to write and modify Marlin firmware for my 3D printers. This is the only task I would ever see myself using. I wish to tap into your knowledge, if you would permit me.

I see a lot of these posts are based on Linux machines, and you yourself mentioned your preference for it. I know nothing about Linux, other than there are a lot of different versions. I grew up on MS-Dos and Windows as a user, but not a programmer. Getting the ability to edit Marlin is vital to me. If I want to set up a very minimal Linux machine solely to run the VSCode and its required components, what would I need? Can I use an old Chromebook or netbook? What Linux version would be best for me? Thanks in advance for any guidance you can provide me.

Tony

It doesn’t need dedicated hardware at all. If you’ve got a ‘powerfull’ host machine (that is e.g., some 50GB disk space to spare and 4GB of free RAM), just install Virtualbox (or any other virtual machine software, VMWare, …), feed it a freely available Linux-distribution installation ISO (e.g., Xubuntu) in its (virtual) “disk drive” and install the distro in the VM. Installation tutorial videos are found all over the web.

1 Like

Morning @tonymedsker,

You haven’t run out of disc space by any chance? Just a thought.

Does it have any extensions other than the ones I mentioned? I think the Arduino extension interferes, for example, also the non-microsoft C/C++ extensions are best avoided.

Not without a huge pile of pain. If you don’t have a spare 64 bit computer (VSCode is 64 bit only now, Atom is still 32 bit though) then VirtualBox is probably best.

Linux isn’t difficult. My wife’s laptop “upgraded” to Windows 10, from 8, and was fine for a few days. Then it took over 24 hours to download and apply updates. All she wanted was to send an email! I installed Linux Mint for her. No problems at all. Win 10 deleted! :grinning:

DM me if you need help.

Cheers,
Norm.

1 Like

Morning Norman,

My system is a Lenovo Thinkpad W540 running Win 10 Pro, with 500Gb HD partitioned into 2 drives, and each drive is less than 40% used. I am running 16Gb RAM, and can add another 16Gb if I need it. I purchased it as a refurb on newegg.com for less than $300, if memory serves.

When I set up VSCode, there were no other extensions than the C++ by Microsoft.

I was surprised that you said changing a chromebook to linux would be difficult, as I was told that Chrome O.S. is Linux based. My intent was to format whatever system
was present and install Linux. Like I said, that computer’s only purpose would be for writing Marlin firmware. I will keep in mind about 64 bit, however.

Thanks again for your assistance!

Maxgerhardt,

Thanks for your input! I am not familiar with the whole virtual machine ideas. I’m retired, and never knowingly used virtual machine stuff, so I guess that makes me somewhat of a newbie, or at least easily confused. That being said, I will study the info on that Virtualbox link you provided. Thanks again!

Morning @tonymedsker,

I was reading in one of the Linux magazines about it recently, and it didn’t appear straight forward. Some Chromebooks need to be write enabled by removing a screw on the motherboard, others don’t. The magazine article isn’t on-line yet, except for subscribers, so this is a recent (2020) link to install Ubuntu alongside Chrome-OS which might be of use, if you are feeling brave.

Good luck.

WARNING Step 5 states that Since all local data and settings were deleted when you entered Developer Mode, you may have to re-enter your network details, language, and keyboard orientation on the OS welcome screen, as well as agree to the operating system’s terms and conditions. Once completed, sign in to your Chromebook.

That’s something you might want to bear in mind, it appears to wipe your data, or local data. I think that note should be step 0!

You could probably dual boot your Lenovo to give Win 10 and Linux, but this would involve a repartitioning of your hard drive (scary stuff first few times) and obviously, a full backup. You certainly have enough oomph and RAM.

My own laptop is a dual core with 8G and is very old. Still working though. I have VirtualBox with about 4 different VMs running. I can only run one at a time due to RAM contraints though.

Cheers,
Norm.

There are two themes: PIO has a problem, and people who prefer Linux really prefer Linux.
I have a Linux machine, and I tried to install Arduino IDE. It’s installed, and it will open, but it won’t allow connections.
I am the Administrator on this machine.

I’ve always been a user, so I have no use for the added work of operating Linux. Now I have to program the computer I’m using to program my MCU? Retrograde for a user.

You didn’t add your user to the dialout group did you?

sudo usermod -a -G dialout <username>

It’s in the instructions, to be done after running the install.sh script. https://www.arduino.cc/en/Guide/Linux

Cheers,
Norm.

2 Likes

There you go again with ‘the instructions.’

My son sent me an instructional that didn’t work, so I kept trying them until one got me a result.

Thank you very much.
But I’m not really excited to use Arduino IDE again.
I’ll install PIO, if I can install it.
I wish I could just click on something. It’s 2020. I took BASIC in 1979. We’re supposed to click on something in 2020, or make a gesture or a smirk.

ESP IDF is a few months away. That’s built for Linux.

Any idea how I can make PlatformIO install right? With kits? I have “0 kits”.

I always find instructions worth a read. That way I know how domething should be operated. My wife has a different approach – she presses buttons, throws levers, and bangs things until they work the way she wants them to! :wink:

I have no idea what you did to break things, other than moving some project folders around.

I’m sure that you uninstalled VSCode, and by doing so, the PlatformIO extension. You also removed the PlatformIO tools etc from your user’s account.

In other words, you have cleaned up, ready to install, so it should be a simple case of installing VS\code, adding the PlatformIO extension, opening an existing project, and compiling.

It’s not working! So, go to Help->Toggle Developer Tools, then click on Console – is there anything listed in amber/yellow or red? If so, please copy and paste it here. Thanks.

I don’t know what “0 kits” means as an error message - the required toolset/compilers/etc should get downloaded on first compile.

You don’t happen to have installed Python 3.9 have you? Can you run python --version in a command line session. 3.9 has, I believe, broken some PlatformIO installations. I’m not sure why.

You might like to check if PlatformIO is using your installed Python or its own version. Go to settings in VSCode and search for “platformio python”. Is th option to “attempt to use a portable python interpretor” checked or unchecked?

Whathappens if you toggle it and try a build? Anything? Reset it back afterwards if no joy.

Cheers,
Norm.

1 Like

It says:
Platformio-ide: Use Builtin Python
“Use a portable python 3 interpreter if available” is checked.

I have Python 3.8.

I think it’s telling me that no software development kits have been installed.
That’s pretty clearly what it was getting at by “0 kits have been installed.”

Sounds like it’s using it’s own Python then, regardless of your 3.8.

I’ve never seen that error message, nor has Google!

Development kits are installed when a project is compiled for the first time. I assume you have tried this? (Silly question department!)

Cheers,
Norm.

Is there another kind of kit?

SDK is the only place where I’ve seen the word used.

I tried your ‘sudo’ business above, and:
“bash: syntax error near unexpected token ‘newline’”

I can’t roll my eyes enough to express how ridiculous this feels, after thirty years of user-friendly interface. My experience of Linux so far is exactly like when you go to a foreign country and have to fill out thirty forms instead of one because they’re backward.