Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
I am encountering an ImportError when attempting to use Matplotlib v3.8.0 in my Python package's tests, specifically when running them with pytest. This issue does not occur with older versions of Matplotlib, such as v3.7.3.
Code for reproduction
>>>importmatplotlib.pyplotaspltTraceback (mostrecentcalllast):File"<stdin>",line1,in<module>File"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/pyplot.py",line66,in<module>frommatplotlib.figureimportFigure,FigureBase,figaspectFile"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/figure.py",line43,in<module>frommatplotlibimport_blocking_input,backend_bases,_docstring,projectionsFile"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py",line58,in<module>frommpl_toolkits.mplot3dimportAxes3DFile"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py",line1,in<module>from .axes3dimportAxes3DFile"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py",line23,in<module>frommatplotlibimport_api,cbook,docstring,_preprocess_dataImportError:cannotimportname'docstring'from'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)
Actual outcome
When running the tests, I receive the following ImportError:
tests/integration/test_cli.py:263: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../.local/lib/python3.10/site-packages/pyKVFinder/main.py:214:incliplot_frequencies(frequencies,output_plot)../../.local/lib/python3.10/site-packages/pyKVFinder/utils.py:952:inplot_frequenciesimportmatplotlib.pyplotasplt../../.local/lib/python3.10/site-packages/matplotlib/pyplot.py:66:in<module>frommatplotlib.figureimportFigure,FigureBase,figaspect../../.local/lib/python3.10/site-packages/matplotlib/figure.py:43:in<module>frommatplotlibimport_blocking_input,backend_bases,_docstring,projections../../.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py:58:in<module>frommpl_toolkits.mplot3dimportAxes3D/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py:1:in<module>from .axes3dimportAxes3D__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _""" axes3d.py, original mplot3d version by John Porter Created: 23 Sep 2005 Parts fixed by Reinier Heeres <reinier@heeres.eu> Minor additions by Ben Axelrod <baxelrod@coroware.com> Significant updates and revisions by Ben Root <ben.v.root@gmail.com> Module containing Axes3D, an object which can plot 3D objects on a 2D matplotlib figure. """fromcollectionsimportdefaultdictimportfunctoolsimportinspectimportitertoolsimportmathfromnumbersimportIntegralimporttextwrapimportnumpyasnp>frommatplotlibimport_api,cbook,docstring,_preprocess_dataEImportError:cannotimportname'docstring'from'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py:23:ImportError
Expected outcome
I expected my tests to run successfully with Matplotlib v3.8.0, just as they did with v3.7.3.
Additional information
Has this worked in earlier versions?
It is working in previous versions (eg, v3.7.3).Do you know why this bug is happening?
When running the following command to get the Matplotlib Backend:
importmatplotlib;print(matplotlib.get_backend())
I got the following error:
Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>File"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py",line1275,inget_backendreturnrcParams['backend']File"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py",line759,in__getitem__frommatplotlibimportpyplotaspltFile"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/pyplot.py",line66,in<module>frommatplotlib.figureimportFigure,FigureBase,figaspectFile"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/figure.py",line43,in<module>frommatplotlibimport_blocking_input,backend_bases,_docstring,projectionsFile"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py",line58,in<module>frommpl_toolkits.mplot3dimportAxes3DFile"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py",line1,in<module>from .axes3dimportAxes3DFile"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py",line23,in<module>frommatplotlibimport_api,cbook,docstring,_preprocess_dataImportError:cannotimportname'docstring'from'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)
Operating system
Pop!_OS 22.04 LTS
Matplotlib Version
3.8.0
Matplotlib Backend
ImportError: cannot import name 'docstring' from 'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/init.py)
Python version
3.10.12
Jupyter version
6.5.1 (Not using Jupyter notebook)
Installation
pip