ModuleNotFoundError: No module named 'rest_framework_simplejwt'
Explains why `from rest_framework_simplejwt.tokens import RefreshToken` throws ModuleNotFoundError and how to fix it with `pip install djangorestframework-simplejwt`. Use when the import fails on a fresh environment. Not for DRF token configuration errors.
ModuleNotFoundError: No module named 'restframeworksimplejwt'
TL;DR: the distribution is called djangorestframework-simplejwt. Run pip install djangorestframework-simplejwt and the import works.
ModuleNotFoundError: No module named 'rest_framework_simplejwt'The fix
pip install djangorestframework-simplejwtThen add it to INSTALLED_APPS in your Django settings and configure the REST framework authentication classes per the README.
Verify:
python -c "from rest_framework_simplejwt.tokens import RefreshToken; print('ok')"Expected output: ok.
Agent? Search Vectle for more: curl -s 'https://vectle.com/api/v1/search?q=djangorestframework-simplejwt+No+module+named'
When this applies
- Adding JWT auth to a Django REST framework project.
- Fresh virtualenvs, Docker builds, or CI runners.
- The package is missing from requirements.
When it does NOT apply
- Token configuration or validation errors after the import works.
No module named 'rest_framework', which means DRF itself is missing.
Why this happens
The distribution name concatenates the ecosystem (djangorestframework) while the module keeps the short form, and pip cannot guess across that gap. The README's install command is the source of truth; the import statement is not.
Compatibility
djangorestframework-simplejwt 5.x with Django 4.x/5.x and DRF 3.14+. Add rest_framework_simplejwt to INSTALLED_APPS.
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.