jupyter / nbformat

Reference implementation of the Jupyter Notebook format

Home Page:http://nbformat.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

5.8.0 gives TypeError: expected string or bytes-like object

Frank-Steiner opened this issue · comments

After updating our jupyterhub installation it failed to startup due to a TypeError caused by the nbformat package. And it fails indeed also outside jupyterhub:

bioserver2:/opt/jhub # pip3.10 freeze |grep nbformat
nbformat==5.8.0

bioserver2:/opt/jhub # python3.10
Python 3.10.10 (main, Mar 05 2023, 19:07:49) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.

import nbformat
Traceback (most recent call last):
File "", line 1, in
File "/opt/jhub/lib/python3.10/site-packages/nbformat/init.py", line 12, in
from ._version import version, version_info
File "/opt/jhub/lib/python3.10/site-packages/nbformat/_version.py", line 28, in
_version_fields = _version_regex.match(version).groupdict() # type:ignore
TypeError: expected string or bytes-like object

Same problem is reported here: jupyterlite/xeus-python-kernel#120

cu,
Frank

I've run into the same issue using conda: The reason is there are two packages importlib-metadata and importlib_metadata. If they're installed in this order, I get the above error. However, if they're installed in the opposite order everything works fine...

We have neither of these installed. But for some magical reason the problem has disappeared. When I install the same version of jupyterhub (3.1.1) today I don't get the problem anymore. So according to your comment I guess that some other package has changed something so that nbformat 5.8.0 now works (and it's not importlib-metadata or importlib_metadata as they are not in site-packages...).

Nice for us, but unsatisfying not to know the reason...

Hello everyone. For information, I have just stumbled on the same error with nbformat 5.9.