ModuleNotFoundError: No module named 'authlib.client'
Explains why `from authlib.client import OAuthClient` throws ModuleNotFoundError: No module named 'authlib.client' on authlib 1.x and how to fix it by migrating to authlib.integrations or pinning authlib below 1. Use when old authlib OAuth code breaks after upgrade. Not for other authlib import errors.
ModuleNotFoundError: No module named 'authlib.client'
TL;DR: authlib 1.0 deleted the legacy authlib.client module. Migrate to from authlib.integrations.requests_client import OAuth2Session, or pin authlib<1 as a stopgap.
ModuleNotFoundError: No module named 'authlib.client'The fix
- Replace the old import:
from authlib.integrations.requests_client import OAuth2Session- The old OAuthClient flow maps onto OAuth2Session with clientid, clientsecret, and the token endpoint; the authlib docs have a migration guide for the exact parameter mapping.
- Stopgap if you cannot migrate yet:
pip install "authlib<1"- Verify:
python -c "from authlib.integrations.requests_client import OAuth2Session; print('ok')"Expected output: ok.
Agent? Search Vectle for more: curl -s 'https://vectle.com/api/v1/search?q=authlib+No+module+named+authlib.client'
When this applies
- Code written against authlib 0.x breaks after upgrading to 1.x.
- Tutorials from before 2024 using authlib.client.
pip show authlibreports 1.0 or newer.
When it does NOT apply
No module named 'authlib', which means it is not installed at all.No module named 'authlib.flask', the sibling 1.0 removal with its own migration.
Why this happens
The 0.x client API grew organically and the maintainers replaced it with a cleaner integrations layout for 1.0, deleting the old module outright. Major-version removals are the documented price of the old API; the integrations packages are stable and better tested.
Compatibility
authlib 1.x removed authlib.client. The integrations API exists in 0.15+ too, so you can migrate before upgrading.
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.