0

Problem

Python import fails when there is a jupyter notebook files in the same directory.

Files

$ cat a.py 
from b import (
    test
)


test()

$ cat b.py
def test():
    print("hoge")

Jupyter notebook c.py.

enter image description here

Errors

CTRL-C CTRL-C in the a.py in emacs and it shows the error.

enter image description here

Once it failed, it start showing another error of no module named.

enter image description here

Without jupyter notebooks in the same directory, it works.

enter image description here

Environment

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
 of 2020-03-26, modified by Debian

enter image description here

Workaround

It looks the jupyter console reported issue is relevant.

I have a similar issue; a Void Linux contributor has PR'ed an omnipus jupyter update and running jupyter console triggers the RuntimeWarning about ZMQSocketChannel.msg_ready not being awaited. Downgrading only python3-jupyter_client to 6.1.0_2 (the version currently packaged in Void) resolves the issue.

PyZMQ is installed via the python3-pyzmq-22.1.0_1 package in Void, although an earlier version also triggered the issue.

On python3.7, downgrading from jupyter-client 7.0.1 to 6.1.12 worked for me.

Run below and the issue apparently is gone.

pip install jupyter-client==6.1.12

Question

Please help understand what is causing this issue and how to fix it.

1 Answer 1

1

Based on a quick skim through the bug report, this is a regression in jupyter-client version 7.0. Downgrading to jupyter-client 6.1.x is the proper solution, until a new release of 7.0 includes the fix. The fix appears to already be merged, so that could happen any day now. In any case, it has nothing to do with Emacs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.