skillfed

pipreqs

Pip requirements.txt generator based on imports in project

pipreqs v0.5.0 991.4K downloads/30d#4,560 on PyPI7,463
Permissive license Apache-2.0 Active released

What it is and what it does

pipreqs is a command-line tool that analyzes Python source files in a project directory and generates a requirements.txt file by detecting all imported packages. Unlike pip freeze, which lists everything installed in your environment, pipreqs reads your actual code to identify only the packages you use, making it useful for documenting dependencies in new projects or cleaning up existing requirement files.

The tool walks the abstract syntax tree of your Python files to extract imports, queries PyPI (or a custom server) to find the latest version of each package, and outputs a requirements.txt with pinned versions. It supports optional features like scanning Jupyter notebooks, comparing against existing requirements, cleaning unused entries, and dynamic versioning schemes (e.g., ~= or >=). Runtime dependencies include yarg, docopt, nbconvert, and ipython.

Use it for:

  • Quickly bootstrap a requirements.txt for a new project without manually listing every import.
  • Audit and clean an existing requirements.txt by comparing it to actual imports in the codebase.
  • Generate requirements for a project you've inherited without needing to install all dependencies first.
  • Scan Jupyter notebooks alongside Python files to capture all notebook-based dependencies.
  • Use a custom PyPI server or proxy in restricted network environments.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Scans Python project source code to detect imported packages and automatically generates a requirements.txt file with pinned versions, without needing a full environment installation.

Yes. pipreqs solves a real problem—automating dependency discovery from source code—with low install friction, active maintenance, no security vulnerabilities, and a permissive license. It is most valuable when you need to document or audit dependencies without a full environment setup, or when working with notebooks.

Install

pipreqs on PyPI

pip

pip install pipreqs

uv

uv add pipreqs

poetry

poetry add pipreqs

Installing pipreqs

Before you install

Low friction install with a pure-Python wheel. Maintenance is active with recent commits and a large repository community (7463 stars). Supports Python 3.8 through 3.12 with no known vulnerabilities.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most development workflows.

Quickstart

pip install pipreqs
pipreqs /path/to/project
# or with output to stdout:
pipreqs --print /path/to/project

Jupyter notebook scanning (--scan-notebooks) requires nbconvert and ipython; omit that flag or install pipreqs with --no-deps and manually specify yarg==0.1.9 and docopt==0.6.2 if you want a minimal install.

Verify before relying

  • Whether the package correctly handles all modern import patterns in complex codebases.
  • Accuracy of version pinning when querying PyPI or custom servers under network constraints.
  • How well the tool handles edge cases in projects with conditional or dynamic imports.

Package facts

License Apache-2.0 (permissive)
Python support capped below the current Python release (>=3.8.1,<3.13)
Install friction low — pure-Python wheel
Runtime dependencies 4 — yarg, docopt, nbconvert, ipython
Maintenance actively maintained — 908 days since the last release
Last repo commit
First released
Downloads 991,444/month — #4,560 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pipreqs-0.5.0-py3-none-any.whl

Keywords: pip, requirements, imports

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

generate requirements.txt from importspython dependency scannerauto-detect project dependenciesrequirements file generatoranalyze python importspip requirements automationproject dependency discovery
dependency-managementrequirements-automationjupyter-support

More Build Tools packages