← All errors · ReplitNode & Python runtime errors
ModuleNotFoundError: No module named 'flask'
Exact error
ModuleNotFoundError: No module named 'flask'
What it means
The Python interpreter running your code doesn't have the package installed.
Likely causes
- Package not installed, or installed into a different Python/virtualenv.
- Not listed in requirements.txt / pyproject.toml, so fresh environments miss it.
How to fix it
Install with the same interpreter that runs your code:
python -m pip install flaskRecord it so deploys install it too:
echo "flask" >> requirements.txt
Still stuck after trying this? Get it fixed for $49, or you don't pay.
Prevent this next time
- Commit package-lock.json or requirements.txt so every environment installs the same dependencies.
- Read the port from `process.env.PORT` and bind to 0.0.0.0 in hosted environments.
Guide: catch outages before your users do.
Tools that help:
- Better Stack: Uptime, cron/heartbeat monitoring and log alerts.
Some links on this page are affiliate links: if you sign up or buy through them, FixStack may earn a commission at no extra cost to you. Learn more.
FAQ
What does "ModuleNotFoundError: No module named 'flask'" mean?
The Python interpreter running your code doesn't have the package installed.
What usually causes it?
Package not installed, or installed into a different Python/virtualenv. Not listed in requirements.txt / pyproject.toml, so fresh environments miss it.
How do I fix it?
1. Install with the same interpreter that runs your code: 2. Record it so deploys install it too:
Related errors
More Replit errors and fixes →
Tools that help
- Railway: Deploy backends and databases; new users get $20 credit.
Some links on this page are affiliate links: if you sign up or buy through them, FixStack may earn a commission at no extra cost to you. Learn more.
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy