The additional light I can shed is that IOPub is handled via a background IO thread. When you display/print/etc., we handoff messages to be sent on the IO thread. When .flush() is called, a Python threading.Event is used to synchronize with the thread to ensure that any past sends have actually occurred. Something in the import mechanism is preventing this background thread from waking. This PR <https://github.com/ipython/ipykernel/pull/276> should prevent us from waiting for a flush event during imports.
-Min On Mon, Oct 30, 2017 at 12:43 AM, John <[email protected]> wrote: > I reported this issue at pypy here > > https://bitbucket.org/pypy/pypy/issues/2690/importing- > module-when-pypy-is-kernel-for > > and they debugged it to a certain point and are wondering if some IPython > experts can shed some light on problem. > > > pypy2-v5.9.0-linux64/site-packages/ipykernel/iostream.py(319)flush() > -> evt = threading.Event() > (Pdb) n > > pypy2-v5.9.0-linux64/site-packages/ipykernel/iostream.py(320)flush() > -> self.pub_thread.schedule(evt.set) > (Pdb) n > > pypy2-v5.9.0-linux64/site-packages/ipykernel/iostream.py(321)flush() > -> evt.wait() > > > John > > On Thursday, October 19, 2017 at 12:37:57 PM UTC-7, John wrote: >> >> I have jupyter installed on an ubuntu linux machine using Anaconda with >> Python 3. I also installed pypy and pypy3 on the ubuntu linux machine and >> configured them as kernels for the Jupyter notebook. When I open a notebook >> I am able to switch between the 3 kernels, namely Python3 , PyPy and PyPy3. >> The problem I am having is that the following import statement fails when >> PyPy is configured as the kernel for the notebook. >> >> from test import * >> >> executing this line in a notebook cell fails when PyPy is the kernel for >> the notebook, but it works fine when the notebook is configured to have the >> PyPy3 kernel or the Python3 kernel. It also works fine when Python2 is the >> kernel. The contents of the test.py file is the following. >> >> import IPython >> from IPython.core.display import Javascript >> display(Javascript("""console.log('hello')""")) >> a = 1 >> display(a) >> >> When I execute the cell containing >> >> from test import * >> >> when PyPY is the kernel the cell execution never completes and the * >> symbol remains displayed to the left of the cell indefinitely. >> >> >> -- > You received this message because you are subscribed to the Google Groups > "Project Jupyter" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jupyter/8b5c051f-ed37-4bdc-8d0e-d63813398510%40googlegroups.com > <https://groups.google.com/d/msgid/jupyter/8b5c051f-ed37-4bdc-8d0e-d63813398510%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAHNn8BX9s0MwdOhgsGVKcUaYgVYK-dyyuiK6fOs3L2PEsps3fg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
