Title: [Bug]: ImportError when using Matplotlib v3.8.0 in Python package tests · Issue #26827 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: ImportError when using Matplotlib v3.8.0 in Python package tests · Issue #26827 · matplotlib/matplotlib
X Title: [Bug]: ImportError when using Matplotlib v3.8.0 in Python package tests · Issue #26827 · matplotlib/matplotlib
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. ...
Open Graph 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 ...
X 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 ol...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/26827
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: ImportError when using Matplotlib v3.8.0 in Python package tests","articleBody":"### Bug summary\n\nI 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.\n\n### Code for reproduction\n\n```python\n\u003e\u003e\u003e import matplotlib.pyplot as plt\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/pyplot.py\", line 66, in \u003cmodule\u003e\r\n from matplotlib.figure import Figure, FigureBase, figaspect\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/figure.py\", line 43, in \u003cmodule\u003e\r\n from matplotlib import _blocking_input, backend_bases, _docstring, projections\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py\", line 58, in \u003cmodule\u003e\r\n from mpl_toolkits.mplot3d import Axes3D\r\n File \"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py\", line 1, in \u003cmodule\u003e\r\n from .axes3d import Axes3D\r\n File \"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py\", line 23, in \u003cmodule\u003e\r\n from matplotlib import _api, cbook, docstring, _preprocess_data\r\nImportError: cannot import name 'docstring' from 'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)\n```\n\n\n### Actual outcome\n\nWhen running the tests, I receive the following ImportError:\r\n\r\n```python\r\ntests/integration/test_cli.py:263: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n../../.local/lib/python3.10/site-packages/pyKVFinder/main.py:214: in cli\r\n plot_frequencies(frequencies, output_plot)\r\n../../.local/lib/python3.10/site-packages/pyKVFinder/utils.py:952: in plot_frequencies\r\n import matplotlib.pyplot as plt\r\n../../.local/lib/python3.10/site-packages/matplotlib/pyplot.py:66: in \u003cmodule\u003e\r\n from matplotlib.figure import Figure, FigureBase, figaspect\r\n../../.local/lib/python3.10/site-packages/matplotlib/figure.py:43: in \u003cmodule\u003e\r\n from matplotlib import _blocking_input, backend_bases, _docstring, projections\r\n../../.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py:58: in \u003cmodule\u003e\r\n from mpl_toolkits.mplot3d import Axes3D\r\n/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py:1: in \u003cmodule\u003e\r\n from .axes3d import Axes3D\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\n \"\"\"\r\n axes3d.py, original mplot3d version by John Porter\r\n Created: 23 Sep 2005\r\n \r\n Parts fixed by Reinier Heeres \u003creinier@heeres.eu\u003e\r\n Minor additions by Ben Axelrod \u003cbaxelrod@coroware.com\u003e\r\n Significant updates and revisions by Ben Root \u003cben.v.root@gmail.com\u003e\r\n \r\n Module containing Axes3D, an object which can plot 3D objects on a\r\n 2D matplotlib figure.\r\n \"\"\"\r\n \r\n from collections import defaultdict\r\n import functools\r\n import inspect\r\n import itertools\r\n import math\r\n from numbers import Integral\r\n import textwrap\r\n \r\n import numpy as np\r\n \r\n\u003e from matplotlib import _api, cbook, docstring, _preprocess_data\r\nE ImportError: cannot import name 'docstring' from 'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)\r\n\r\n/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py:23: ImportError\r\n```\n\n### Expected outcome\n\nI expected my tests to run successfully with Matplotlib v3.8.0, just as they did with v3.7.3.\n\n### Additional information\n\n- Has this worked in earlier versions?\r\nIt is working in previous versions (eg, v3.7.3).\r\n\r\n- Do you know why this bug is happening?\r\nWhen running the following command to get the Matplotlib Backend: \r\n```python\r\nimport matplotlib; print(matplotlib.get_backend())\r\n```\r\nI got the following error:\r\n```python\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py\", line 1275, in get_backend\r\n return rcParams['backend']\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py\", line 759, in __getitem__\r\n from matplotlib import pyplot as plt\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/pyplot.py\", line 66, in \u003cmodule\u003e\r\n from matplotlib.figure import Figure, FigureBase, figaspect\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/figure.py\", line 43, in \u003cmodule\u003e\r\n from matplotlib import _blocking_input, backend_bases, _docstring, projections\r\n File \"/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py\", line 58, in \u003cmodule\u003e\r\n from mpl_toolkits.mplot3d import Axes3D\r\n File \"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py\", line 1, in \u003cmodule\u003e\r\n from .axes3d import Axes3D\r\n File \"/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py\", line 23, in \u003cmodule\u003e\r\n from matplotlib import _api, cbook, docstring, _preprocess_data\r\nImportError: cannot import name 'docstring' from 'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)\r\n```\n\n### Operating system\n\nPop!_OS 22.04 LTS\n\n### Matplotlib Version\n\n3.8.0\n\n### Matplotlib Backend\n\nImportError: cannot import name 'docstring' from 'matplotlib' (/home/ABTLUS/joao.guerra/.local/lib/python3.10/site-packages/matplotlib/__init__.py)\n\n### Python version\n\n3.10.12\n\n### Jupyter version\n\n6.5.1 (Not using Jupyter notebook)\n\n### Installation\n\npip","author":{"url":"https://github.com/jvsguerra","@type":"Person","name":"jvsguerra"},"datePublished":"2023-09-19T14:42:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":49},"url":"https://github.com/26827/matplotlib/issues/26827"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:456683b1-7caa-6439-1ed4-4d2ced2c6570 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DB4:25F708:DB3CCC:1238F85:6A52CBC0 |
| html-safe-nonce | 80d4c340cda780527ed36931f55f641199c1e68f7604ad030e4972c3b94ec2d0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REI0OjI1RjcwODpEQjNDQ0M6MTIzOEY4NTo2QTUyQ0JDMCIsInZpc2l0b3JfaWQiOiIxMjc4NTg5ODQ4NTg0ODk5NTIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f1bf4035804f8975e6632726904479004b5410bbbfb93761f3bc9a0cf2064111 |
| hovercard-subject-tag | issue:1903152091 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/26827/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2aa4901badef524f64d9761d828410edf28b508f2111b076267b3a3aff9da45f/matplotlib/matplotlib/issues/26827 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2aa4901badef524f64d9761d828410edf28b508f2111b076267b3a3aff9da45f/matplotlib/matplotlib/issues/26827 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jvsguerra |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width