Traceback won't show code, rather "No such file or directory: '/tmp/ipykernel_...."

Hi, I haven’t seen this problem anywhere that I’ve searched for it, so opening a thread here.

I have only one python kernel and it seems to be registered correctly. I start the jupyter process from the environment where that kernel is defined.

Nevertheless when execution halts, the Traceback only shows a list of dummy-temp files instead of showing me the actual source:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /tmp/ipykernel_921537/87034632.py:1 in <module>                                                  │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/tmp/ipykernel_921537/87034632.py'                         │
│                                                                                                  │
│ /tmp/ipykernel_921537/2913516290.py:74 in train_aa_model                                         │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/tmp/ipykernel_921537/2913516290.py'                       │
│                                                                                                  │
│ /tmp/ipykernel_921537/4085664280.py:7 in aa_demo                                                 │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/tmp/ipykernel_921537/4085664280.py'                       │
│                                                                                                  │
│ /tmp/ipykernel_921537/3398868504.py:153 in decode_it                                             │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/tmp/ipykernel_921537/3398868504.py'                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'NoneType' object is not subscriptable

.

I tried re-registering the kernel, and my permissions seem to be ok:

$ ls -al ~/.local/share/jupyter
total 431
drwxr-xr-x 4 shawley  33280 Jan  6 06:28 ./
drwxr-xr-x 5 shawley  33280 Jan  5 23:42 ../
drwxr-xr-x 3 shawley  33280 Jan  6 06:28 kernels/
-rw-r--r-- 1 shawley 376832 Jan  2 12:07 nbsignatures.db
-rw------- 1 shawley   1386 Dec  7 02:46 notebook_secret
drwx-----T 2 shawley  41472 Jan  6 06:44 runtime/

As I say, there is only one kernel…

$ jupyter kernelspec list
Available kernels:
  python3    /admin/home-shawley/.local/share/jupyter/kernels/python3

So, how do I get it to actually show my code, instead of referencing non-existtent tmp files?
Thanks!

( btw, I do have write permission to /tmp. However I see no directory /tmp/ipykernel_921537 in existence. If I manually make one,… it doesn’t help. Restarting things doesn’t help. )

Answer (thanks to Zach Mueller): This is due to a package called rich, which I have no idea how I acquired it.

Simply running pip uninstall rich and restarting the kernel – no need to reluanch Jupyter! – fixed the problem. Yay!

1 Like

Thanks for posting about this. I had come across it elsewhere and had yet to connect the dots.

For the record, I think this is the issue post at the rich repo.