PlatformIO Community

How to get PlatformIO to work through WSL? Getting no files found in UI

So I have PlatformIO installed in VS Code through WSL. I can create projects mostly fine, but what I’ve found is that PlatformIO uses \ for its paths as if it’s in a Windows filesystem. So my path ends up being something like /path/to/somewhere\project. This creates a folder that looks like somewhere\project, except for the fact that it ends up being a different weird character that creates an “invalid path” error in VS Code.

Since then, I’ve just renamed that folder, so now I can traverse into that folder in VS Code, but when I go to “Open Project” in PlatformIO home, it shows no files in that folder and says that there is no platformio.ini even though I see all the files very clearly in bash.

I’ve heard PlatformIO working well in WSL, but it has so far been very frustrating for me. Has anyone had similar issues and know how to fix it? Thanks

I wouldn’t use PlatformIO through WSL if I were you. You already encountered some problems with it. There will be more problems when you try to upload to your hardware, because WSL does not have access to the hardware drivers.

Also, how are you using WSL with vscode? Maybe there are issues with the remote extension. That could be the cause of your problems.

I also once tried to use PlatformIO through WSL, but I gave up after discovering the upload problems I’ve encountered.

I hope I could help you :smiley:

Oh that makes a lot of sense. I’ll try PlatformIO through Windows. Is there a lot of extra stuff that needs to be installed though? I’m low on space and I don’t want to have to install too many copies of all of the C/C++ dev stuff.

The used space depends on how many libraries you’ve got installed etc.
My entire PlatformIO installation needs ~1.5GB of space. Most of that space is required for the compilers for different platforms.

1 Like

If you were to run platformio directly via WSL, you’d probably be fine… but since you’re running it on top of VSCode running on Windows… you’re crossing the Windows/Linux barrier… and it’s all coming unstuck. Now, there are ways to run VSCode itself from under WSL (I think… or maybe that’s through other similar emulation layer… can’t remember now)… but that is probably harder to do than simply running PlatformIO (Core/CLI) natively. And the core itself is pretty small… it’s the compiler toolchains, and framework files that will gobble space up, but you can configure it so stuff is on a secondary drive if needed.

1 Like

Since this thread is the top Google result for “vs code platformio wsl2”… (It came up when I was first looking for solutions to this.)

VS Code and PlatformIO can be installed directly into WSL2, and it will work that way. (That’s assuming you have an Windows Insider build or have an X-Windows server running on Windows.) However, when installing VS Code, you’ll get a warning stating that the “official way” to use VS Code is under Windows and with the Remote - WSL extension.

Unfortunately, PlatformIO does not seem to be aware of the Remote - WSL extension as it currently tries to use Windows pathnames (back slashes) instead of Linux pathnames (forward slashes). There’s a year-old GitHub issue regarding this.

1 Like