Update all libraries for version 6.0

In version 5 of Platformio the “Update All” command was very convenient, with which I could update all the frameworks and my global libraries, but now in version 6, using the new “pio pkg update” command, only the components present in the currently open project. How can I automatically update all my assets at the same time as in the previous version? That is the contents in the folders: .platformio\platforms .platformio\packages .platformio\lib.

The pio pkg update command has a -g option to update global packages (like platforms, frameworks, global libs etc). Is this what you mean?

I tried the command -g but I get nothing, the terminal returns with no output and waiting for a new command. I checked that I had something to update, and I had 3 frameworks not yet updated.

Hi @maxgerhardt

Funnily enough, I just tried a pio update and got told off, so trying the suggested pio pkg update --global did nothing and simply returns the cursor immediately. Running without the global option does update stuff though.

norman@Hubble2:~/SourceCode/PlatformIO/EEPROMupload$ pio update
This command is deprecated and will be removed in the next releases. 
Please use `pio pkg update` instead.

norman@Hubble2:~/SourceCode/PlatformIO/EEPROMupload$ pio pkg update --global

norman@Hubble2:~/SourceCode/PlatformIO/EEPROMupload$ pio pkg update
Resolving uno environment packages...
Platform Manager: Updating atmelavr @ 3.4.0
Platform Manager: Removing atmelavr @ 3.4.0
Platform Manager: atmelavr@3.4.0 has been removed!
Platform Manager: Installing platformio/atmelavr @ 4.0.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: atmelavr@4.0.0 has been installed!

Weird!

Cheers,
Norm.

Your report is exactly what I get, the pio pkg update command works, but only for the current workspace, so you have to repeat it for each project that uses different libraries or frameworks. It used to be much better, just one command to update everything.

1 Like

Maybe @ivankravets has an idea here?

1 Like

It works if you specify packages that you would like to update. See pio pkg update — PlatformIO latest documentation

For example

pio pkg update -g -p atmelavr
1 Like

We dropped support for global packages in favor of declrative approach when working on embedded projects. This is a part of our mission on improving the lives of everyday engineers. Using global packages and updating them to the latest versions can break your projects that are not compatible with the new API.

The @maxgerhardt can confirm, we receive very often complaints when developers say that “1 month ago my project worked and after the pio update it does not work anymore”. Of course, pointing to the semantic versioning solves this issue. However, it is better if we can predict these breaking changes.

Please note that PlatformIO Core 6.0 DOES NOT duplicate your dev-platforms and toolchains for every project. Even when you manage multiple project with isolated deps using semantic versioing, PlatformIO automatically resolves dependdecys from its internal common storage. The only libraries are duplicated because LDF depends on them. Nevertheless, libraries are also cached to the .cached folder.

I think you will be thankful to PIO Core 6.0 if you back to your project after 5-10 years and you will see “SUCCESS” when running pio run.

1 Like

So you always have to specify what to update, which is always manual, and you have to repeat it for each framework and library. Personally I think it is a shame to have lost that function, perhaps put it in the background, for example only as a CLI command for those who want to use it again. Then if you know that it is a feature that gives you problems, it would be enough not to use it.

That is not true if you follow declaring practices and use pio pkg update. Please note that the next update to the PlatformIO IDE for VSCode will bring commands to manage project dependencies.

We understand that people are used to Eclipse-based and ArduinoIDEs and “global” things (toolchains, SDKs, libraries). Sorry, we have absolutely opposite vision to existing tools in the market on how embedded development workflow should look. This is the reason why over 2,000,000 developers around the globe move away from the competitive tools to the PlatformIO.

P.S: We didn’t have plans to make problems for developers or add any complexity. We just improve our ecosystem to guarantee developers full project reproducibility on any host machines even after decades.

I understand, thanks.

but how am I supposed to update the libs now?
is it possible via CLI?

if I can’t update it all in one command, how can I update a single libs to the latest version?

Trying with pio pkg update with no luck… O_o

pio pkg update -g -p ArduinoJson
Error: Could not find the package with 'ArduinoJson' requirements for your system 'windows_amd64'

Where did you get this command? It is wrong. See docs pio pkg update — PlatformIO latest documentation

thanks for the reply ivan… I’m just doing some trial and error but I sincerely don’t understand how it is supposed to work now… it was my error.
from the docs I read.

Update the project dependencies, custom packages from the [PlatformIO Registry](https://registry.platformio.org/), or external sources.

***If no custom packages (`--library`, `--platform`, or `--tool`) are specified, the command will update the following project dependencies based on [“platformio.ini” (Project Configuration File)](https://docs.platformio.org/en/latest/projectconf/index.html#projectconf):***

** Library dependencies declared using the [lib_deps](https://docs.platformio.org/en/latest/projectconf/sections/env/options/library/lib_deps.html#projectconf-lib-deps) option*

This should mean that if I do
pio pkg update
it should update all libs that are in the platformio.ini or not?

because the command does not update libs.

the only way to update libs is to specify the lib name like:
pio pkg update --library ArduinoJson

Yes, it should. How to reproduce your issue?

Thanks for the answer Ivan, I really appreciate it.

I have various projects that are all affected by this problem.

All projects have a platformio.ini file on the root of the project, all projects uses ArduinoJson,

To reproduce the problem, try to force
ArduinoJson@6.19.4
then remove the version number in the platformio.ini file,
ArduinoJson
and try to update, it should download the 6.20.0 but it says that all the libs are updated.

I know that it’s better to specify which version to use in the libs_deps section but I prefer to always use the latest and let the tests do the work to double check that everything is working.

Solved in PlatformiIO not upgrading libraries - #4 by ivankravets