Open johnne opened 1 year ago
Thanks for reporting the issue @johnne
The error originated from
The easy fix would be to ignore invalid version number. Then a follow up could be to handle invalid version.
Would you be willing to open a PR? The first step would be to wrap the version parsing with a try-except:
try:
version = parse(entry.get("version", ""))
except InvalidVersion:
name = entry.get("name")
version = entry.get("version")
self.log.warning(f"Unable to parse version '{version}' of '{name}'")
continue
With InvalidVersion
to be imported from packaging.version
.
Thank you! I edited the installation I have and that seems to get rid of the error message.
I will open a PR
Thanks for trying the fix. Would you mind posting here the log about which package failed to be parsed?
This is what I get when running jupyter lab --debug
and doing grep "Unable to parse version"
from the debug log.
Thanks a lot @johnne
So as expected most packages failing are none-python ones as they do not require to conform to Python version syntax. And in recent version of packaging
those are not allowed. The fix you made (thanks again) will avoid the bug but prevent to handle those packages. Would you be willing to do a follow-up PR to handle version for those packages?
Basically we should internalize the old LegacyVersion
from packaging
that was the fallback when failing to parse a version string.
See: https://github.com/pypa/packaging/blob/20.9/packaging/version.py
The code was
try:
return Version(version)
except InvalidVersion:
return LegacyVersion(version)
So the follow-up PR would be to change the try-except
introduced in #202 by:
raw_version = entry.get("version", "")
try:
version = parse(raw_version)
except InvalidVersion:
name = entry.get("name")
msg = f"Falling back to 'LegacyVersion' for version '{raw_version}' of '{name}'"
self.log.debug(msg)
version = LegacyVersion(raw_version)
and copying the definition of LegacyVersion
(and all the code used by it) from https://github.com/pypa/packaging/blob/20.9/packaging/version.py
Would you be willing to do the follow-up PR?
FYI I released 5.2.1 with your fix.
Description
I'm getting an error message saying "An error occurred while retrieving available packages" as well as "I know you want to give up, but wait a bit longer.." which never ends. In my terminal I get
I'm able to run both
conda search --json
andmamba search --json
which I saw could be a problem in another issue (#127)Reproduce
jupyter lab
Expected behavior
No error messages
Context
Other labextensions (built into JupyterLab) app dir: /Users/johnlarsson/mambaforge/envs/jupyter/share/jupyter/lab @quarto/jupyterlab-quarto v0.1.42 enabled OK
Command Line Output
Browser Output