Backtrader error (matplotlib)


i have the following errors when running some codes in backtrader in jupyter notebook: i followed many suggestions to downgrade matplotlib etc but to no avail.

ImportError: cannot import name 'warnings' from 'matplotlib.dates' (C:\Users\johny\anaconda3\lib\site-packages\matplotlib\dates.py)

i have also the following imports:
import backtrader as bt
import yfinance as yf
import matplotlib
from matplotlib import warnings
from datetime import datetime

i will be most grateful to get help.

Hi John,



You can try downgrading matplotlib to version 3.2.2 as suggested in this forum.



Alternatively, to suppress warnings you can try importing warnings directly from the warnings module instead of matplotlib:

import warnings
warnings.filterwarnings('ignore')

Hope this helps!

Thanks,
Rushda Ansari