Title: [Bug]: removing module does not reliably work anymore in 3.10.5 (regression) · Issue #30392 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: removing module does not reliably work anymore in 3.10.5 (regression) · Issue #30392 · matplotlib/matplotlib
X Title: [Bug]: removing module does not reliably work anymore in 3.10.5 (regression) · Issue #30392 · matplotlib/matplotlib
Description: Bug summary As of matplotlib 3.10.5, deleting the module on the fly and then reimporting it does not work anymore. This used to work in 3.10.3. Code for reproduction #!/usr/bin/env python import sys import matplotlib.pyplot as plt packag...
Open Graph Description: Bug summary As of matplotlib 3.10.5, deleting the module on the fly and then reimporting it does not work anymore. This used to work in 3.10.3. Code for reproduction #!/usr/bin/env python import sy...
X Description: Bug summary As of matplotlib 3.10.5, deleting the module on the fly and then reimporting it does not work anymore. This used to work in 3.10.3. Code for reproduction #!/usr/bin/env python import sy...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30392
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: removing module does not reliably work anymore in 3.10.5 (regression)","articleBody":"### Bug summary\n\nAs of matplotlib 3.10.5, deleting the module on the fly and then reimporting it does not work anymore. This used to work in 3.10.3.\n\n### Code for reproduction\n\n```Python\n#!/usr/bin/env python\n\nimport sys\nimport matplotlib.pyplot as plt\n\npackage_names = [\"matplotlib\"]\nfor package in package_names:\n loaded_package_modules = [key for key, value in sys.modules.items() if package in str(value)]\n for key in loaded_package_modules:\n del sys.modules[key]\n\nimport matplotlib.pyplot as plt\n```\n\n### Actual outcome\n\n```python\nTraceback (most recent call last):\n File \"/home/neutronst4r/3Dplot_test/./mp_import_test2.py\", line 12, in \u003cmodule\u003e\n import matplotlib.pyplot as plt\n File \"/home/neutronst4r/[redacted]/env/lib/python3.13/site-packages/matplotlib/__init__.py\", line 161, in \u003cmodule\u003e\n from . import _api, _version, cbook, _docstring, rcsetup\n File \"/home/neutronst4r/[redacted]/env/lib/python3.13/site-packages/matplotlib/rcsetup.py\", line 28, in \u003cmodule\u003e\n from matplotlib.colors import Colormap, is_color_like\n File \"/home/neutronst4r/[redacted]/env/lib/python3.13/site-packages/matplotlib/colors.py\", line 57, in \u003cmodule\u003e\n from matplotlib import _api, _cm, cbook, scale, _image\nImportError: generic_type: type \"_InterpolationType\" is already registered!\n```\n\n### Expected outcome\n\nimport should work without error\n\n### Additional information\n\nerror is fixed by switching to matplotlib 3.10.3\n\n### Operating system\n\nArch Linux using virtual environment\n\n### Matplotlib Version\n\n3.10.5\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n3.13.5\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/neutronst4r","@type":"Person","name":"neutronst4r"},"datePublished":"2025-08-05T10:17:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/30392/matplotlib/issues/30392"}
| 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:1d1b3682-4be3-b152-0614-e84b6becc49c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8F6:260009:1757452:1F1A4D6:6A52BC05 |
| html-safe-nonce | be90c594c03ded2b6b822c8ac824d771364ddf40ddf90cebaf2d298caaf0507e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEY2OjI2MDAwOToxNzU3NDUyOjFGMUE0RDY6NkE1MkJDMDUiLCJ2aXNpdG9yX2lkIjoiNTM0NjA1ODAwOTcyNTU0OTU3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 222d5be9bb58ce1ee29d7c14bed5653b410c016ad06b4b97d4642a1a99675ecd |
| hovercard-subject-tag | issue:3292495817 |
| 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/30392/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1d2dd4aa6234d958f6af7ecb404aa3f07cc73ac507c2d85fb640e70101ee0e77/matplotlib/matplotlib/issues/30392 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d2dd4aa6234d958f6af7ecb404aa3f07cc73ac507c2d85fb640e70101ee0e77/matplotlib/matplotlib/issues/30392 |
| og:image:alt | Bug summary As of matplotlib 3.10.5, deleting the module on the fly and then reimporting it does not work anymore. This used to work in 3.10.3. Code for reproduction #!/usr/bin/env python import sy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | neutronst4r |
| 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