The issue has already been reported on nanopb’s boards:
opened 03:28PM - 01 Aug 22 UTC
closed 11:00AM - 11 Dec 22 UTC
The latest VSCode+PIO environment does not seem to like the version number of th… e latest versions: `nanopb/Nanopb@^0.4.6.4`
Error message: `ValueError: Invalid simple block '^0.4.6.4'`
I tried to upgrade from `nanopb/Nanopb@^0.4.6` but no newer version seems to work with PIO.
Stacktrace:
```
Library Manager: Removing Nanopb @ 0.4.6+4
Library Manager: Nanopb@0.4.6+4 has been removed!
Error: Traceback (most recent call last):
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\__main__.py", line 102, in main
cli() # pylint: disable=no-value-for-parameter
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\cli.py", line 71, in invoke
return super().invoke(ctx)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\run\cli.py", line 144, in cli
process_env(
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\run\cli.py", line 201, in process_env
result = {"env": name, "duration": time(), "succeeded": ep.process()}
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\run\processor.py", line 83, in process
install_project_env_dependencies(
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\package\commands\install.py", line 132, in install_project_env_dependencies
_install_project_env_libraries(project_env, options),
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\package\commands\install.py", line 241, in _install_project_env_libraries
spec = PackageSpec(library)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 184, in __init__
self._parse(self.raw)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 291, in _parse
raw = parser(raw)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 316, in _parse_requirements
self.requirements = tokens[1].strip()
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\platformio\package\meta.py", line 231, in requirements
else semantic_version.SimpleSpec(str(value))
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\semantic_version\base.py", line 647, in __init__
self.clause = self._parse_to_clause(expression)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\semantic_version\base.py", line 1043, in _parse_to_clause
return cls.Parser.parse(expression)
File "C:\Users\Norbi\.platformio\penv\lib\site-packages\semantic_version\base.py", line 1063, in parse
raise ValueError("Invalid simple block %r" % block)
ValueError: Invalid simple block '^0.4.6.4'
```
Apparently part of the problem may be some assumptions on pio’s end? My attempt to lock it to an earlier version explicitly as:
lib_deps = nanopb/Nanopb@0.4.5
or even something as old as 0.4.1
does not seem to change anything, it is still trying to get 0.4.6.4 and fails in the same way as in the linked ticket.
Is there currently no way to use nanopb with pio without some brute force contingencies?
As the issue says,
is not a valid semantic versioning of the X.Y.Z form at all, and should be fixed on the library side.
In the meantime I recommend locally cloning the repo in the lib/
folder of the project and fixing the version string in the library.json
therein.
Ok, so it is not valid for this version, but why then am I unable to fetch the other versions where the syntax is ok? Does it refuse to load any version of a library that has a single version that does not conform? Won’t this stay broken forever even when they do release a nicely named version?
Versions with a correct semver work perfectly fine.
>pio pkg install -g -l "nanopb/Nanopb@0.4.6"
Library Manager: Installing nanopb/Nanopb @ 0.4.6
Downloading [####################################] 100%
Unpacking [####################################] 100%
Library Manager: Nanopb@0.4.6+4 has been installed!
Per above no.
Per above no.
I’ve opened issue PIO Registry accepts invalid SemVers · Issue #4389 · platformio/platformio-core · GitHub so that this can get rectified for the currently broken versions.