Forums

fresh jupyter notebook spamming me with DeprecationWarning

/home/straits/.virtualenvs/pandas23/lib/python3.6/site-packages/jupyter_client/jsonutil.py:67: DeprecationWarning: Interpreting naive datetime as local 2018-09-05 07:08:07.599023. Please add timezone info to timestamps. new_obj[k] = extract_dates(v)

I started a new jupyter notebook using the same virtualenv I use with other notebooks. The new notebook is mostly reusing code from the other notebooks. But almost every cell is throwing this DeprecationWarning.

  1. I can't figure out the specific code fragment its complaining about -- the message isn't very useful
  2. This drives me mad and i want to fix the complain, or supress the message, but I would like to be warned aobut other problems as the emerge.
  3. I'm not seeing this behavior in the other, similar notebooks

What can I do about this?

My package versions:

(pandas23) 07:11 ~/bd $ pip list 
Package          Version  
---------------- ---------
backcall         0.1.0    
certifi          2018.8.13
chardet          3.0.4    
colorspacious    1.1.2    
cycler           0.10.0   
decorator        4.3.0    
et-xmlfile       1.0.1    
gspread          3.0.1    
httplib2         0.11.3   
idna             2.7      
ipykernel        4.8.2    
ipython          6.4.0    
ipython-genutils 0.2.0    
jdcal            1.4      
jedi             0.12.0   
jupyter-client   5.2.3    
jupyter-core     4.4.0    
kiwisolver       1.0.1    
matplotlib       2.2.2    
numpy            1.14.3   
oauth2client     4.1.2    
openpyxl         2.5.3    
pandas           0.23.0   
parso            0.2.1    
pexpect          4.5.0    
pickleshare      0.7.4    
pip              10.0.1   
prompt-toolkit   1.0.15   
ptyprocess       0.5.2    
pyasn1           0.4.4    
pyasn1-modules   0.2.2    
Pygments         2.2.0    
pyparsing        2.2.0    
python-dateutil  2.7.3    
pytz             2018.4   
pyzmq            17.0.0   
requests         2.19.1   
rsa              3.4.2    
scikit-learn     0.19.2   
scipy            1.1.0    
seaborn          0.9.0    
setuptools       39.2.0   
simplegeneric    0.8.1    
six              1.11.0   
sklearn          0.0      
tornado          4.5.3    
traitlets        4.3.2    
urllib3          1.23     
wcwidth          0.1.7    
wheel            0.31.1   
xlrd             1.1.0

I'm guessing that the code you're running is generating dates that do not have timezone information on them so when jupyter deserializes them as they are passed from the server to the client, it complains.

You can turn them off with:

warnings.filterwarnings("default", "", DeprecationWarning, "", 0)

and you can removed that periodically to check for other issues if you want to.

I tried:

import warnings
warnings.filterwarnings("default", "", DeprecationWarning, "", 0)

but it still is still throwing:

/home/straits/.virtualenvs/pandas23/lib/python3.6/site-packages/jupyter_client/jsonutil.py:67: DeprecationWarning: Interpreting naive datetime as local 2018-10-01 10:29:58.295410. Please add timezone info to timestamps.
  new_obj[k] = extract_dates(v)

Is it suppressing any of the deprecation warnings at all? Or is it still showing just as many as it did before you added those lines?

No, it's consistently annoying me with the same deprecation warning regardless.

Did you stop/start the kernel after adding the warning-suppression code?