pipreqs - Generate requirements.txt file for any project based on imports
Installation
pip install pipreqs
Obs.: if you don’t want support for jupyter notebooks, you can install pipreqs without the dependencies that give support to it. To do so, run:
pip install --no-deps pipreqs
pip install yarg==0.1.9 docopt==0.6.2
Usage
Usage:
pipreqs [options] [<path>]
Arguments:
<path> The path to the directory containing the application files for which a requirements file
should be generated (defaults to the current working directory)
Options:
--use-local Use ONLY local package info instead of querying PyPI
--mapping-file <file> Add or override import-to-package mappings from a file
--pypi-server <url> Use custom PyPi server. Both the JSON API (e.g. https://pypi.org/pypi/) and simple index
URLs ending in /simple/ are supported
--proxy <url> Use Proxy, parameter will be passed to requests library. You can also just set the
environments parameter in your terminal:
$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="https://10.10.1.10:1080"
--debug Print debug information
--ignore <dirs>... Ignore extra directories, each separated by a comma
--no-follow-links Do not follow symbolic links in the project
--ignore-errors Ignore errors while scanning files
--encoding <charset> Use encoding parameter for file open
--savepath <file> Save the list of requirements in the given file
--print Output the list of requirements in the standard output
--force Overwrite existing requirements.txt
--diff <file> Compare modules in requirements.txt to project imports
--clean <file> Clean up requirements.txt by removing modules that are not imported in project
--mode <scheme> Enables dynamic versioning with <compat>, <gt> or <non-pin> schemes
<compat> | e.g. Flask~=1.1.2
<gt> | e.g. Flask>=1.1.2
<no-pin> | e.g. Flask
--scan-notebooks Look for imports in jupyter notebook files.
Example
$ pipreqs /home/project/location Successfully saved requirements file in /home/project/location/requirements.txt
Contents of requirements.txt
wheel==0.23.0 Yarg==0.1.9 docopt==0.6.2
Custom package mappings
Use --mapping-file when an import name maps to a different distribution in your project. The UTF-8 file uses one import-name:package-name pair per line. It can add new entries and override individual bundled mappings. Blank lines and lines starting with # are skipped.
$ cat package-mapping.txt acme_widgets:acme-widgets $ pipreqs --mapping-file package-mapping.txt /home/project/location
Why not pip freeze?
pip freeze only saves the packages that are installed with pip install in your environment.
pip freeze saves all packages in the environment including those that you don’t use in your current project (if you don’t have virtualenv).
and sometimes you just need to create requirements.txt for a new project without installing modules.
Maintainers
Metadata
Release files for pipreqs 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pipreqs-0.6.0.tar.gz | 38.2 kB | With provenance | Details for pipreqs-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pipreqs-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for pipreqs-0.6.0-py3-none-any.whl |
Total release size: 76.3 kB
Release files / pipreqs-0.6.0.tar.gz
| Download URL | pipreqs-0.6.0.tar.gz |
|---|---|
| Size | 38.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2dd4096306ff076cc7fa8d4a7bfee7d7e690b9d9c92cb93b261bcbf98e018c6c
|
|
BLAKE2b-256 checksum How to use checksums |
706bf66143e371677cb8b2097064006f74a3e5e4c5e20263d973cf88b5063ced
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / pipreqs-0.6.0-py3-none-any.whl
| Download URL | pipreqs-0.6.0-py3-none-any.whl |
|---|---|
| Size | 38.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e084a5990c81162f3ba14540acb87ff35897c04fbab6667f86223833e9c8b0b
|
|
BLAKE2b-256 checksum How to use checksums |
fb4946f91b613cde0d3b6356b3a7e66e1394dde40266654004242cd40f7f2a80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logSecurity for pipreqs 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pipreqs-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.