Reputation: 1016
I'm trying FastAPI but I can't even run the Hello World example.
I've installed both uvicorn
and fastapi
with a venv and requirements.txt
, also I'm running Python 3.5 (maybe that's the issue?)
The issue should be something with uvicorn because I can't run --help
or --version
uvicorn --version
Traceback (most recent call last):
File "/home/...../.venv/bin/uvicorn", line 7, in <module>
from uvicorn.main import main
File "/home/...../.venv/lib/python3.5/site-packages/uvicorn/__init__.py", line 1, in <module>
from uvicorn.config import Config
File "/home/...../.venv/lib/python3.5/site-packages/uvicorn/config.py", line 131
message = f"Uvicorn running on {ip_repr} (Press CTRL+C to quit)"
^
SyntaxError: invalid syntax
I really don't have a clue where to start looking as I cannot seem to find anything on internet.
Upvotes: 2
Views: 3807
Reputation: 21056
Surely with Python 3.5, FastAPI won't work.
FastAPI homepage:
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
uvicorn (from https://github.com/encode/uvicorn):
Requirements: Python 3.6+ (For Python 3.5 support, install version 0.8.6.)
I guess you should update Python to 3.6 at least. pyenv should help.
Upvotes: 4