You are not logged in.

#1 2017-07-07 12:58:11

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

[Solved] Sagemath, jupyter, and the bloody JSON encoder...

When using Sage's notebook, via jupyter, whenever evaluating a cell, regardless of its content (as long as it is valid code), I get the following warning:

    /usr/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-07-07 12:19:20.338945. Please add timezone info to timestamps.
    chunks = self.iterencode(o, _one_shot=True)

A bit of googling indicated that this was indeed a bug, that has in the meantime, been fixed. However, no matter how much I updated, I keep stumbling upon across it. So to see if I could compile a list of steps to reproduce the problem, I uninstalled everything Sage plus dependencies (and also removed ~/.sage and ~/.jupyter)

# pacman -Rs sagemath sage-notebook sagemath-jupyter

Then I installed sagemath-jupyter, which pulls the necessary dependencies for sage et al.

# pacman -S sagemath-jupyter

Now start the notebook:

$ jupyter notebook

Then with kernel sagemath selected, type (eg)

print("foo")

and hit Shift+Enter (for evaluation). You get the above warning. The reason I post this in the forum, as opposed to a bug report, is because I found so little information about this bug in Archlinux that I can't help but wonder if I misconfigured something (and then forgot about it until I needed the notebook again...)

Thank you in advance.

EDIT TO ADD: I also have installed kernels for Python 2 and 3, but this warning is NOT shown when using either of those.

Last edited by gauthma (2017-07-10 13:05:29)

Offline

#2 2017-07-07 14:29:23

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,097

Re: [Solved] Sagemath, jupyter, and the bloody JSON encoder...

Add

warnings.filterwarnings(action='ignore')

to ~/.sage/init.sage

Offline

#3 2017-07-07 16:59:53

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Sagemath, jupyter, and the bloody JSON encoder...

arojas wrote:

Add

warnings.filterwarnings(action='ignore')

to ~/.sage/init.sage

Thanks, this definitely makes working in the notebook more bearable... but of course does not fix the underlying problem... is a bug report appropriate?

Offline

#4 2017-07-07 17:35:51

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,097

Re: [Solved] Sagemath, jupyter, and the bloody JSON encoder...

Well, you said it has been fixed already, so it will make its way into the repos eventually. If you can pinpoint where the fix is you can open a backport request, otherwise it can be a mess to dig into the gazillion python modules involved here to figure out where the issue is. A full backtrace of the warning would definitely help.

Offline

#5 2017-07-07 17:55:41

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Sagemath, jupyter, and the bloody JSON encoder...

Well, my understanding of this is that the problem (which is with jupyter only) is fixed. And in fact, when using jupyter with a Python 2 or 3 kernel, I don't get that warning.

It only happens when using sage, which is I think the problem must be in sage's kernel. I originally thought that the link said the problem with sage was fixed; it was only when I searched again for that link above that I noticed that the underlying problem was about jupyter alone -- that is the one that is fixed. Sorry about that hmm

Which means submitting a bug report (about the sage kernel) might not be the worst of ideas...

Offline

#6 2017-07-08 00:01:17

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,097

Re: [Solved] Sagemath, jupyter, and the bloody JSON encoder...

According to that link the fix is in ipykernel 4.6.1, which is not in our repos yet

Offline

#7 2017-07-10 13:05:15

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Sagemath, jupyter, and the bloody JSON encoder...

Well, I guess that settles it then smile

Offline

Board footer

Powered by FluxBB