{"id":4685,"library":"pipreqs","title":"pipreqs","description":"pipreqs is a Python utility that automatically generates a `requirements.txt` file for a project based on the import statements found in its Python files and Jupyter notebooks. It aims to create a clean, minimal list of direct dependencies, avoiding the inclusion of unused packages or the entire environment as `pip freeze` does. The current version is 0.5.0, and releases occur irregularly, with significant updates like Jupyter support recently added.","status":"active","version":"0.5.0","language":"en","source_language":"en","source_url":"https://github.com/bndr/pipreqs","tags":["requirements","dependencies","packaging","cli","jupyter"],"install":[{"cmd":"pip install pipreqs","lang":"bash","label":"Install pipreqs"}],"dependencies":[{"reason":"Command-line argument parser.","package":"docopt","optional":false},{"reason":"Required for Jupyter notebook scanning functionality.","package":"ipython","optional":true},{"reason":"Required for Jupyter notebook scanning functionality.","package":"nbconvert","optional":true},{"reason":"Used for argument parsing.","package":"yarg","optional":false}],"imports":[],"quickstart":{"code":"# Navigate to your project's root directory\n# Generate requirements.txt for Python files:\npipreqs .\n\n# Generate requirements.txt including Jupyter notebooks:\npipreqs . --scan-notebooks\n\n# To print to console without saving to file:\npipreqs . --print","lang":"bash","description":"To generate a `requirements.txt` file, navigate to your project's root directory and run `pipreqs .`. If your project includes Jupyter notebooks, use the `--scan-notebooks` flag. You can also preview the requirements without saving by using `--print`."},"warnings":[{"fix":"Ensure your project runs on Python 3.8.1 or newer when using pipreqs v0.5.0+. For older Python versions, use an older pipreqs release.","message":"Python version compatibility has changed. Older versions of pipreqs supported Python 3.7+, but as of v0.5.0, it requires Python >=3.8.1.","severity":"breaking","affected_versions":"<0.5.0"},{"fix":"Always use the `--ignore` option to exclude virtual environment directories, e.g., `pipreqs . --ignore .venv,env`.","message":"pipreqs may include irrelevant packages if virtual environment folders (`.venv`, `env`, etc.) are not explicitly ignored, as it scans all `.py` files in the specified path.","severity":"gotcha","affected_versions":"All"},{"fix":"Review the generated `requirements.txt` file and manually correct any misidentified packages. Contribute to the `pipreqs` mapping file on GitHub if you find a common error.","message":"Module-to-package mapping issues can lead to incorrect or missing package names (e.g., `kafka` instead of `kafka-python`, or `azure` modules). While mappings are frequently updated, manual intervention may sometimes be necessary.","severity":"gotcha","affected_versions":"All"},{"fix":"After generating the `requirements.txt`, perform a test installation and run your project to identify any missing indirect dependencies or plugins. Add them manually to the `requirements.txt` file.","message":"pipreqs primarily detects direct imports. It may not include indirect dependencies (packages required by your direct imports but not explicitly imported in your code) or specific plugins that are only used implicitly.","severity":"gotcha","affected_versions":"All"},{"fix":"Use the `--force` flag to explicitly overwrite an existing `requirements.txt` file: `pipreqs . --force`.","message":"By default, pipreqs will not overwrite an existing `requirements.txt` file, preventing accidental data loss.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}