ranaroussi / quantstats

Portfolio analytics for quants, written in Python
Apache License 2.0
4.59k stars 809 forks source link

Jupyter import issue: `magic(...)` is deprecated #342

Open svendaj opened 3 months ago

svendaj commented 3 months ago

Hi @ranaroussi , you are doing fantastic job (using also your yfinance). I have issue with importing QuantStats to Kaggle notebooks (IPython version 8.20.0). pip install is successful, but when

import quantstats as qs

line 300 of qs.utils throws:

File /opt/conda/lib/python3.10/site-packages/quantstats/utils.py:300, in _in_notebook(matplotlib_inline)
    297 if shell == "ZMQInteractiveShell":
    298     # Jupyter notebook or qtconsole
    299     if matplotlib_inline:
--> 300         get_ipython().magic("matplotlib inline")
    301     return True
    302 if shell == "TerminalInteractiveShell":

and fails with

DeprecationWarning: `magic(...)` is deprecated since IPython 0.13 (warning added in 8.1), use run_line_magic(magic_name, parameter_s).