SyntaxError: Missing parentheses in call to 'print'
Explains why importing jose throws SyntaxError: Missing parentheses in call to 'print' on Python 3 and how to fix it by replacing the Python-2-only `jose` package with `python-jose`. Use when the traceback points inside the jose package itself. Not for syntax errors in your own code.
SyntaxError: Missing parentheses in call to 'print'
TL;DR: you installed the Python-2-only jose package instead of python-jose. Run pip uninstall -y jose then pip install python-jose and the import works on Python 3.
SyntaxError: Missing parentheses in call to 'print'The fix
- Remove the wrong package:
pip uninstall -y jose- Install the right one:
pip install "python-jose[cryptography]"- Verify:
python -c "from jose import jwt; print('ok')"Expected output: ok.
Agent? Search Vectle for more: curl -s 'https://vectle.com/api/v1/search?q=jose+Missing+parentheses+print+python-jose'
When this applies
- The traceback points at files inside the installed jose package, not your code.
- The error appeared right after
pip install jose. - Any Python 3 version.
When it does NOT apply
- The SyntaxError points at your own file, which is your bug, not the package.
No module named 'jose', which means neither package is installed.
Why this happens
Python 3 made print a function, so any Python-2-era print statement is a syntax error at import time. The dead jose distribution was never ported, and its name squats on the obvious pip install guess. python-jose is the maintained, Python-3-compatible project with the same jose import name.
Compatibility
python-jose 3.x supports Python 3.7+. The jose distribution supports nothing modern; remove it.