Libraries "Install to..." wrong folder

I modify most of the libraries per project use, therefore, I have to have them separate in the project folder. However, since a new version (I stopped using PlatformIO for a couple of months) and PlatformIO Library (Install to…) is “folder locked” after the first install to always saves libraries to the same folder (wrong folder, wrong project). Even reinstall (VSC + PlatformIO) do not help. This problem affecting a new project, old inspected projects and manually converted projects (.piolibdeps (move to)-> .pio/libdeps/[env_name]).
Is there anyone to help with it, is it a bug?
Thank you.

Not quite sure what you mean there…

.piolibdeps (move to)-> .pio/libdeps/[env_name]

… is expected behaviour as of PlatformIO v4… it now has both build and PIO managed libraries under the one .pio folder.

As to why it’s installing libraries to the wrong project, I can say, as I don’t usually use the GUI to install libraries, and specifiy them directly in the projects platformio.ini.

What I can see from a quick look at it is that if you haven’t opened the project via PIO Home, it doesn’t get listed at the bottom of the main screen under Recent Projects, and also doesn’t appear to show up in the Install to... projects list… maybe give that a try to ‘refresh’ what projects PIO Home knows about? When the PIO Home Project Configurator is out of beta, it will be easier to manage that, but for now that is probably what’s needed?

Edit: Another aspect seems to be that a newly created project isn’t added to that list… so if you’ve just created a new project, it doesn’t appear in the ‘recent projects’ or ‘install to…’ lists! :open_mouth:

Thank you pfeerick for your help.
Install to… showing properly location/name projects. Unfortunately, regardless which one I use it always choose the one directory. Moreover, it is not consistent: in one pc its save to another project directory - making a mess, on another one is putting all lib folders in the [user]/.platformio/penv/Scripts/.pio/libsdev/[env_name]?!?, eventually creating different folders with [env_name].
Booth working similar to global as you can load only one library (regardless of the project you chose)!
Moreover, as I mentioned before, most of my libraries are modified, therefore, it needs to be loaded manually (not auto in platformio.ini).
regarding “.piolibdeps (move to)-> .pio/libdeps/[env_name]” this is instruction (on this forum) how to convert old project into new project: .piolibdeps folder

Have you got the same version of platformio on both machines? i.e. what’s shown at the front page of platformio home?


For information re migrating from 3.x to 4.x… there’s also the specific documentation page for that.

The one that’s putting stuff in [user]/.platformio/penv/Scripts/.pio/libsdev/[env_name] sounds like it is bugged… might be best to delete the [user]/.plaformio when VSCode isn’t running and let the PlatformIO extension trigger a clean re-install on that machine.

I have the newest VSC and newest PlatformIO as per your picture. As mentioned I already reinstall both. The same problem is with a newly created project, I just mention old projects as it is also affected.
Regarding delete folder do you suggest that I shall delete existing working project where libraries are saved? Regarding second PC I have limited access and I cannot experiment with deleting folders.
You seem very helpful, will you test this problem on your site in this way:
Create the first project, save the library to… first project, close it, open second and install to… second project same library, isn’t say already installed (because saving to the same directory)? I can see when is saving libraries its create file (still wrong directory) [env_name].lock (in my case is waveshare_ble400.lock).
Moreover, if I create a new project I have to run Inspect it (compiling ok) to see a project on the list when install to…

I’m new to PlatformIO. But I stumbled on this because I have the same problem?

Using Library Manager, I guess GLOBAL installed libraries would go here;
For a LOCAL PROJECT install, I would have thought it would be installed in the lib folder of the project. But it doesn’t. I find mine ending up here;


In which folder have you created your project where you installed the libraries in?

I just tried using the platform.ini to ‘auto download’ the library. I get this;

I think it’s related…

I had to add ‘Everyone’ to the folder security.

Where in the documentation does it talk about folder permissions? I’m even running VSCode/PlatformIO in Administrator mode, but I’m assuming its the PlatformIO Python script that doesn’t have the access rights…

Even with the Everyone permissions, the Library Manager refuses to save the library under the Project/lib directory.
Off to a rough start with PlatformIO!!!

Using the CLI, it installs it to the correct location

So why is the GUI not working properly?

This is a PlatformIO Core system folder. PlatformIO Installer can remove it any time without any warning. Why did you use this path? How did you find it? Even, why this path?

Could you show a screenshot from GUI? Do you select a project folder when installing library?

P.S: I recommend using lib_deps option where PlatformIO will automatically handle all dependencies. See Redirecting...

I’ve posted an issue here; Library Manager - Install to Local Project Wrong Location · Issue #1582 · platformio/platformio-vscode-ide · GitHub

I didn’t choose this path. I installed Python 3.8.2 and VSCode with their default options. I ‘found’ it, because I installed a Library GLOBAL and LOCAL using the Library Manager GUI and then did a File Explorer search for the Library name. These are the locations I found them in.

When I click this;

and then INSTALL, it installs here C:\Users\USERNAME\.platformio\penv\Scripts\.pio\libdeps\esp01_1m\{libraryname}

lib_deps is great - it works as intended (see the Github issue link). But. I like being able to install Libraries manually, and this is clearly a bug/issue with the software.

1 Like

I just commented on this on the Github issue @mriksman posted, as I can confirm this behaviour, and it also explains what another user and I experienced in another thread (actually, 2 different reports), and just realised I also opened a issue for that, so I’ll cross-reference that also on Github).

Trying to install a library to a project (rather than global storage) via PIO Home seems to go completely wrong… and on Linux installs to ~/.platformio/penv/bin/ which IIRC corresponds with C:\Users\USERNAME\.platformio\penv\Scripts on Windows. It seems as if the base part of the install path is completely wrong, as everything after that (i.e. .pio\libdeps\esp01_1m or .pio/libdeps/pro16MHzatmega328) is otherwise correct.

Fixed in PIO Core 4.2.2.

1 Like