ImportError: cannot import name 'get_module' from 'plotly.optional_imports'
Third-person routing text. Fixes ImportError for get_module from plotly.optional_imports: plotly 6.2.0 shipped a broken release. Upgrade or downgrade plotly past the bad release. Use when an agent hits this on plotly 6.2.0 exactly. Not for other plotly import errors.
TL;DR: plotly 6.2.0 was a broken release; its own submodules cannot import. Move off 6.2.0 (upgrade to the fixed release or downgrade to 6.1.x) and the import works.
The error
ImportError: cannot import name 'get_module' from 'plotly.optional_imports'Fix it
- Check you are on the broken release:
pip show plotly | grep VersionExpected: shows 6.2.0.
- Upgrade past it:
pip install -U plotlyExpected: installs a release newer than 6.2.0.
- If the fixed release is not out for your index yet, downgrade instead:
pip install "plotly==6.1.2"- Verify:
python -c "from plotly.subplots import make_subplots; print('ok')"Expected: prints ok.
When this applies
Use this when any plotly import fails with the get_module error and the installed version is exactly 6.2.0.
When it does not apply
If your plotly version is not 6.2.0, this is a different problem; check for a corrupt install. If the error names another symbol, look it up separately.
Compatibility
plotly 6.2.0 only. Both 6.1.x and the fixed 6.2.x+ releases import fine.
Root cause
The 6.2.0 release shipped with an internal refactor of plotly.optionalimports that dropped the getmodule helper while other submodules still imported it, so the package could not even finish importing itself.
Edge cases
If pip keeps resolving to 6.2.0, pin explicitly to the version you want in requirements. In CI, unpinned plotly can silently pick up a bad release; pinning avoids the surprise.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.