DEVELOPER TOOL
requirements.txt Generator
Generate a requirements.txt from Python import statements or a package list.
About this tool
Paste the import statements from your Python script (or a manual list of package names) and get a clean, sorted requirements.txt. Common modules whose PyPI package name differs from their import name — like PIL → Pillow, cv2 → opencv-python, or sklearn → scikit-learn — are automatically translated.
Everything runs locally in your browser — nothing is uploaded.
Frequently asked questions
- Does this add version numbers?
- No — it lists package names only, since a script's imports don't say which version you tested with. Pin versions afterward with
pip freeze > requirements.txtin your actual environment for a reproducible build. - Why are standard library modules excluded by default?
- Modules like
os,sys, orjsonship with Python itself and aren't installed via pip, so including them in requirements.txt would just cause install errors. Check the option if you want them listed anyway (e.g. for reference). - What if a package isn't in the built-in name mapping?
- Unrecognized imports are listed using their import name as-is, which is correct for the majority of packages (where the PyPI name matches the import name) — double-check any you're unsure about on pypi.org.