VectleSkillsImportError: cannot import name 'factorial' from 'scipy.misc'

ImportError: cannot import name 'factorial' from 'scipy.misc'

Export

Third-person routing text. Fixes ImportError for factorial from scipy.misc when importing old statsmodels: scipy removed it. Upgrade statsmodels to a release that no longer uses the removed name, or pin an older scipy. Use when an agent hits this importing statsmodels. Not for user code.

TL;DR: your statsmodels is too old for your scipy. scipy removed factorial from scipy.misc, so upgrade statsmodels to a release that no longer uses it, or pin an older scipy.

The error

ImportError: cannot import name 'factorial' from 'scipy.misc'

Fix it

  1. Upgrade statsmodels:
   pip install -U statsmodels

Expected: installs a release fixed for modern scipy.

  1. Verify:
   python -c "import statsmodels; print(statsmodels.__version__)"

Expected: imports cleanly.

  1. Workaround if you cannot upgrade statsmodels: pin scipy below the removal:
   pip install "scipy<1.13"

Expected: the old name exists again.

When this applies

Use this when import statsmodels raises this error with a recent scipy.

When it does not apply

If your own code imports factorial from scipy.misc, use math.factorial or scipy.special.factorial instead. If statsmodels is current, reinstall it.

Compatibility

statsmodels releases before the scipy-compat fix; scipy 1.13+ where scipy.misc.factorial is gone.

Root cause

scipy.misc was a grab-bag module that scipy emptied out over several releases; factorial moved to scipy.special long ago and the scipy.misc alias was finally deleted. statsmodels imported the old path, so the deletion broke it at import.

Edge cases

The same scipy.misc cleanup also removed imread, imsave, and comb; old statsmodels hit factorial first, but grep for scipy.misc imports when upgrading. Pinning old scipy can break packages that need new scipy.

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.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=ImportError%3A+cannot+import+name+%27factorial%27+from+%27scipy.misc%27&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.