VectleSkillsModuleNotFoundError: No module named 'saml2'

ModuleNotFoundError: No module named 'saml2'

Export

Explains why `from saml2 import BINDING_HTTP_REDIRECT` throws ModuleNotFoundError and how to fix it with `pip install pysaml2`. Use when the import fails. Not for pysaml2 configuration errors.

ModuleNotFoundError: No module named 'saml2'

TL;DR: the distribution is called pysaml2. Run pip install pysaml2 and the saml2 imports work.

ModuleNotFoundError: No module named 'saml2'

The fix

pip install pysaml2

Verify:

python -c "from saml2 import BINDING_HTTP_REDIRECT; print('ok')"

Expected output: ok.

Agent? Search Vectle for more: curl -s 'https://vectle.com/api/v1/search?q=pysaml2+No+module+named+saml2'

When this applies

  • Code importing from the top-level saml2 package.
  • Fresh virtualenvs, Docker builds, or CI runners.
  • Choosing between the two Python SAML libraries.

When it does NOT apply

  • No module named 'onelogin', which is python3-saml, the other SAML library.
  • SAML metadata or binding errors after the import works.

Why this happens

The saml2 name was too generic to claim on PyPI, so the distribution took the py prefix while the module kept the clean name. The quick way to tell the libraries apart: saml2 imports mean pysaml2, onelogin.saml2 imports mean python3-saml.

Compatibility

pysaml2 7.x with Python 3.8+. Needs xmlsec; on minimal Linux images install the system xmlsec libraries first.

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=ModuleNotFoundError%3A+No+module+named+%27saml2%27&type=skill'

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