cannot import name 'warnings' from 'matplotlib.dates'
-
I did not find the Issues section in GitHub.
Python 3.8.3
Matplotlib 3.3.0file "github.com\backtrader-master\backtrader\plot\locator.py", line 35, in <module> from matplotlib.dates import (HOURS_PER_DAY, MIN_PER_HOUR, SEC_PER_MIN, ImportError: cannot import name 'warnings' from 'matplotlib.dates' (C:\Python38\lib\site-packages\matplotlib\dates.py)
But I changed the import line and it work for me
from matplotlib import warnings
-
I think the PR was submitted fixing this exact issue:
-
@Igor-san said in cannot import name 'warnings' from 'matplotlib.dates':
section
I reinstall the matplotlib with version 3.2.0 and everything is fine.
-
Matplotlib 3.3.x is not compatible with backtrader. Matplotlib 3.2.0 is fine.
Matplotlib 3.3.x cause strange problem, plot function will exhaust memory!
my dev env:
1, Mac OS
2, python 3.7.9
3, backtrader 1.9.76.123
4, Matplotlib 3.2.0
5, pycharm
6, datafeed: pandas dataframe -
MacOS big Sur
python 3.9.2
matplotlib 3.3.4
backtrader 1.9.76.123Change /usr/local/lib/python3.9/site-packages/backtrader/plot/locator.py
from:
from matplotlib.dates import (HOURS_PER_DAY, MIN_PER_HOUR, SEC_PER_MIN,
MONTHS_PER_YEAR, DAYS_PER_WEEK,
SEC_PER_HOUR, SEC_PER_DAY,
num2date, rrulewrapper, YearLocator,
MicrosecondLocator, warnings)to:
from matplotlib import warnings
from matplotlib.dates import (HOURS_PER_DAY, MIN_PER_HOUR, SEC_PER_MIN,
MONTHS_PER_YEAR, DAYS_PER_WEEK,
SEC_PER_HOUR, SEC_PER_DAY,
num2date, rrulewrapper, YearLocator,
MicrosecondLocator)