python -m venv venv
venv\Scripts\activate
python -m pip install fastapi "uvicorn[standard]"
python -m uvicorn myapp:app --reloadsafe steps you can run now — first to confirm your venv is working, then to remove the WindowsApps alias if you want it gone.
1) Quick checks (while venv is active)
Run these inside your (venv) prompt:
python --version
where python
python -m pip --version
python -m pip show fastapi
python -m pip show uvicorn
python --versionshould show3.12.x.where pythonshould list the venv first — that’s correct.python -m pip show fastapishould display metadata if FastAPI is installed in this venv. If not, install it next.
If FastAPI/uvicorn are missing, install them into the venv:
python -m pip install --upgrade pip
python -m pip install fastapi "uvicorn[standard]"
Then run your app:
python -m uvicorn myapp:app --reload
If that starts, you’re done — the WindowsApps entry is harmless while your venv is active.
2) If you want to remove/disable the WindowsApps alias (recommended cleanup)
Option A — Turn off App Execution Aliases (easy, safe GUI)
- Open Settings → Apps → Advanced app settings → App execution aliases.
- Find
python.exe,python3.exe, andpip.exeand toggle them OFF.
This immediately removes the WindowsApps stub from being invoked when you type python/pip.
Option B — Disable aliases with PowerShell (one-liners)
Open PowerShell as Administrator and run:
# turn off the app execution alias for python and pip
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AppKey" /f
(Windows provides no single guaranteed PowerShell command that works reliably across all versions for these aliases; the GUI toggle is simplest and recommended.)
Option C — Remove leftover WindowsApps files (not usually needed / advanced)
There may be files under C:\Users\<you>\AppData\Local\Microsoft\WindowsApps. Deleting those directly can be blocked by Windows. I don’t recommend manual deletion unless you’re comfortable with Windows permissions and know what you’re doing.
3) If you still see problems after cleanup
Paste the output of these (from a normal terminal, without venv activated and also with venv activated):
where python
where pip
python --version
pip --version
…and if uvicorn gives an error, paste the exact error text. I’ll tell you exactly what’s happening and the one-line fix.
1) Open the URL manually
Open a browser and go to:
http://127.0.0.1:8000
Also try the FastAPI docs:
- Swagger UI: http://127.0.0.1:8000/docs
- Redoc: http://127.0.0.1:8000/redoc
If any of those show your app, you’re done.
2) Quick CLI checks (run while server is running)
Check that the server receives requests (look at the uvicorn console for request logs). In a new terminal run:
Windows (Command Prompt):
curl http://127.0.0.1:8000/
(or PowerShell Invoke-WebRequest http://127.0.0.1:8000)
If you see a JSON response (e.g. {"hello":"world"}) the server is working.
If curl fails, check port/process:
netstat -a -n -o | findstr :8000
This shows if something is listening on 8000 and the PID.
3) Confirm you ran the correct module/file name
I noticed you used myapl:app in the command. That looks like a typo (maybe you meant myapp:app). If your file is myapp.py and the FastAPI instance variable is named app, run:
python -m uvicorn myapp:app --reload
If the filename is different (for example server.py) use python -m uvicorn server:app --reload.
If uvicorn started successfully with myapl:app, it means a module named myapl was importable — double-check that it is the file you intended.
4) Firewall / Windows prompt
When you run a server bound to 127.0.0.1 (localhost) Windows firewall usually doesn’t block it. If you bind to 0.0.0.0 to expose it to LAN, Windows may prompt to allow access. For local dev stick with 127.0.0.1.
5) Auto-open browser (optional)
Uvicorn doesn’t auto-open the browser. To start it and open a browser in one command:
Windows cmd:
start http://127.0.0.1:8000 && python -m uvicorn myapp:app --reload
PowerShell (run in separate shell so both run):
Start-Process "http://127.0.0.1:8000"
python -m uvicorn myapp:app --reload
Or use python to open the browser after starting uvicorn in another terminal:
import webbrowser
webbrowser.open("http://127.0.0.1:8000")
6) If nothing in browser and curl fails — capture the exact error
Paste here the outputs of:
curl http://127.0.0.1:8000
python -m uvicorn myapp:app --reload
netstat -a -n -o | findstr :8000
and the content of your myapp.py (or the file you started). I’ll diagnose the exact cause.
Very likely you only need to open http://127.0.0.1:8000 manually (or fix the filename typo). Try that first and tell me what you see.
Leave a Reply