Issue with installation on Ubuntu 20.04


I am encountering an error that I cannot solve when launching a fresh installation of JupyterLab on my machine, and any help would be greatly appreciated as I cannot run JupyterLab at all as of now.

When I try and launch JupyterLab by using jupyter lab I get the following output:

Traceback (most recent call last):
  File "~/.local/bin/jupyter-lab", line 5, in <module>
    from jupyterlab.labapp import main
  File "~/.local/lib/python3.8/site-packages/jupyterlab/", line 45, in <module>
    from .extensions import MANAGERS as EXT_MANAGERS
  File "~/.local/lib/python3.8/site-packages/jupyterlab/extensions/", line 24, in <module>
    for entry in entry_points(group="jupyterlab.extension_manager_v1"):
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 933, in entry_points
    return EntryPoints(eps).select(**params)
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 930, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 16, in unique_everseen
    k = key(element)
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 18, in normalized_name
    return dist._normalized_name
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 855, in _normalized_name
    or super()._normalized_name
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 473, in _normalized_name
    return Prepared.normalize(
  File "~/.local/lib/python3.8/site-packages/importlib_metadata/", line 773, in normalize
    return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
  File "/usr/lib/python3.8/", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object

The command jupyter --version outputs:

Selected Jupyter core packages...
IPython          : 8.12.2
ipykernel        : 6.25.1
ipywidgets       : 8.1.0
jupyter_client   : 8.3.0
jupyter_core     : 5.3.1
jupyter_server   : 2.7.2
jupyterlab       : 4.0.5
nbclient         : 0.8.0
nbconvert        : 7.7.4
nbformat         : 5.9.2
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.9.0

[I tried also by pip-installing manually notebook and qtconsole but nothing change]

I’m on Ubuntu 20.04, I’ve tried wit both Linux 5.14.0-1059-oem and 5.15.0-79-generic kernels but I get the same result in both.

I had a previous installation of jupyterlab that was launching but not rendering properly latex equations anymore (after months/years I had that jupyterlab version). I then tried to re-install it (following the instruction in the documentation) and here I am.

I have also tried using JupyterNotebook - it launches, I can open my ipynb files, but I cannot select any kernel so it does not perform any evaluation.

Thank you to anyone who can help!