__init__() unexpected argument 'uri': when building project

Im getting an error on every pio run command in VSCode

Using Platformio 5.2.5
I tried removing platformio extension and .platformio folder and reinstalling but with the same result

TypeError: __init__() got an unexpected keyword argument 'uri':
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 181:     
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Bas\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Bas\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Bas\.platformio\platforms\espressif32\builder\main.py", line 282:
    target_elf = env.BuildProgram()
  File "C:\Users\Bas\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:   
    return self.method(*nargs, **kwargs)
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
  File "C:\Users\Bas\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:   
    return self.method(*nargs, **kwargs)
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 141:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\Bas\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:   
    return self.method(*nargs, **kwargs)
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1104:
    project.install_dependencies()
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 928:
    if lm.get_package(spec):
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 236:
    for pkg in self.get_installed():
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 209:
    pkg = PackageItem(pkg_dir)
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 405:     
    self.metadata = self.load_meta()
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 440:     
    return PackageMetaData.load(manifest_path)
  File "C:\Users\Bas\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 393:     
    data["spec"] = PackageSpec(**data["spec"])
=================================== [FAILED] Took 1.34 seconds =================================== 

Environment    Status    Duration
-------------  --------  ------------
debug          FAILED    00:00:01.340
============================== 1 failed, 0 succeeded in 00:00:01.340 ==============================

Turns out to be a difference in a .git/.piopm file of one of my dependencies …
One of the libs has “uri” in stead of “url”

{"type": "library", "name": "SenseFrameWork", "version": "1.0.0+sha.05167d5", "spec": {"owner": null, "id": null, "name": "SenseFrameWork", "requirements": null, "uri": "git+https://github.com/I-Connect/SenseFramework"}}

Where does this file come form, who generates it?

The PIO packet manager metafile should be generated by PlatformIO.

CC @ivankravets possible issue in a library registry update against core 5.x?

1 Like

The issue happens when a user tries to downgrade PlatformIO Core 6.0 to 5.0. The only solution is to remove installed packages with PIO Core 6.0 and reinstall them with PIO Core 5.0.

Is Core 6.0 release at the moment, or still in alpha/beta ?

6.0 is still in development, but it is very stable. We are finalizing a totally new unit testing engine.

Any idea when it will be released?
If I understood correctly the library manager (package manager) now also automatically deletes dependencies from .pio folder. Is this correct and can this feature be disabled?

We plan to release it in May.

This is a feature, or better saying, it was a bug and we fixed it. See Old dependencies are not removed from .pio folder · Issue #3076 · platformio/platformio-core · GitHub

If you change deps in a configuration file, we clean up previous deps.

Some how I am now experiencing that it is deleting (or re-installing) dependencies without changes to that specific dependency in the platformio.ini… also deleting any changes i had made and not yet pushed :frowning:

What do you mean under “not pushed”?

Please note that packages are cached. The restoring of dependent packages comes from the offline storage.

I meant that I made “manual” changes to the lib in the .pio/libdeps folder and had not yet pushed those changes to the repository on github.

I know this isn’t the ideal situation but it seems the only way to develop changes to dependent private libraries. I’ve tried including private libraries as submodules of my main repository but that doesnt go well with the dependency finder as it does not download the dependencies of the library when building

o_o You never push the .pio folder, this is a temporary, PlatformIO managed and created one.

If lib_deps is correct, it should recreate it the same on every computer correctly in accordance to its core version.

1 Like

I understand that .pio is temporary and only meant to include readonly clones of stable libraries …
But in our situations the (many) private libraries that we use are not stable yet, they are developed while we are developing projects that use them.

In the ideal world any library changes needed would first be made in a separate local clone of the library, tested there and then pushed to the repository so platformio can update them in the .pio of the main project. But given the amount of changes needed and only limited possibilities to test those changes on hardware outside of the main project, this will not work for us.

That is why we are making changes to libraries from within the .pio/libdeps folder

But then I would push those into the lib/ folder and edit them there, then they won’t be in the libdepsibs folder. The new core also has lib_deps = symlink://<some path> which will not make a local copy anymore but a symbolic link.

1 Like

I tried including libraries as submodules of my main project, having them cloned in the /lib folder, but then the library dependency finder doesn’t process them correctly, and also downloads them in the .pio/libdeps folder or doesn;t include dependencies of that library in the .pio/libdeps

See also my posts on Depencies of local libraries are not installed automatically · Issue #2910 · platformio/platformio-core · GitHub

I would love to have a better solution for the way we are working now, but I can’t seem to find any that also still make the main project containing all needed dependencies so I can just clone the main project, “press build” and it will do everything needed and complete the full build from scratch

Could you provide a simple project to reproduce this issue?

I’ve created a public repo at GitHub - Bascy/TestSubmodules with some dependencies

TestSubModules depends on lib1 and lib3
Lib1 depends on lib2

Lib1 and lib2 are cloned as submodules in /lib
If you build this project, then lib2 is downloaded into .pio/libdeps even though it is already available in /lib

I don’t want to add symlink::/lib/lib2 to the main project because the project is not directly dependent on lib2, but I do, in some situations, want to edit lib2 while working in the main project

Hm yes, I think PlatformIO ‘blindly’ downloads the dependency lib2 into piolibdeps because the lib1 manifest says so

and doesn’t see that it already exists in lib/.

I think that actually without the library.json of lib1 it would work (deleting it).

I think this case is tricky – if the library.json wants the git version explicitly, but it also exist in lib/, what does it respect? The version in lib/ may not be the git version. On the other hand one could say if it was manually put in lib/ then we can always infer that that version is to be used.

1 Like

I see the dilemma, but I would expect it do work like you said here

How do I “… remove installed packages with PIO Core 6.0 and reinstall them with PIO Core 5.0…”? I am using macos, I uninstalled PlatformIO and VScode and deleted my .platformio directory. I reinstalled both, but no luck.