[IPython-dev] ITorch on IPython 3 -- problems?

MinRK benjaminrk at gmail.com
Sun Feb 22 03:09:32 EST 2015


On Sat, Feb 21, 2015 at 7:35 PM, Andrew Payne <andy at payne.org> wrote:

> On getting iTorch working with IPython 3.0:
>
>> I didn’t play with it too much, but I submitted a couple of PRs
>> <https://github.com/facebook/iTorch/pulls?q=is%3Apr+author%3Aminrk> to
>> get iTorch working with IPython 3.0 last week. After those, it seemed to be
>> working for me.
>>
> I've dug into this more deeply and now I'm wondering how you got it
> working.
>
> The iTorch kernel uses kernel messaging v4 (properly reported after your
> PR). It uses 'pyout' messages to send stdout.
>
> When sending the messages, iTorch copies the header from the received
> message, including whatever 'version' field is in there.  See:
> https://github.com/facebook/iTorch/blob/master/IOHandler.lua#L73
>
> IPython 3 seems to send execute_request messages with it's current version
> setting, 5.0.  This causes iTorch to reply with a 'pyout' message tagged as
> version 5.0.  Which in turn, causes IPython to skip adapting the message to
> v5 (since it already thinks it's v5, in kernel/adapter.py).  And since
> 'pyout' is not in v5, it dropped the message on the floor.
>

This is caused by a problem in how iTorch builds message headers from
copies of the parent header, which it shouldn't do. I fixed most of these
in #19 <https://github.com/facebook/iTorch/pull/19>, but apparently not all
of them.


>
> (I've opened a PR to fix this in iTorch by always setting the version to
> 4.0, see:  https://github.com/facebook/iTorch/pull/28)
>
> However, it raises questions:
>
>    - Should IPython be sending v5 messages to a kernel that advertises v4?
>
>
No, it shouldn't be, other than the initial kernel_info_request, which is
kept compatible with v4 because it is used to determine the protocol
version implemented by the kernel. After that reply is handled, the version
adaptation should be preventing this.

>
>    -
>    - Should the kernel messaging code be more verbose (log.warn, or
>    something) when it gets a message type it doesn't understand?
>
> For message *type* yes, for message *version*, probably, but I'm not sure.

-MinRK


> -andy
>
>
>
>
>
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150222/b89a2429/attachment.html>


More information about the IPython-dev mailing list