I have a project with multiple package dependencies, the main requirements being listed in
requirements.txt. When I call
pip freeze it prints the currently installed packages as plain list. I would prefer to also get their dependency relationships, something like this:
Flask==0.9 Jinja2==2.7 Werkzeug==0.8.3 Jinja2==2.7 Werkzeug==0.8.3 Flask-Admin==1.0.6 Flask==0.9 Jinja2==2.7 Werkzeug==0.8.3
The goal is to detect the dependencies of each specific package:
Werkzeug==0.8.3 Flask==0.9 Flask-Admin==1.0.6
And insert these into my current
requirements.txt. For example, for this input:
Flask==0.9 Flask-Admin==1.0.6 Werkzeug==0.8.3
I would like to get:
Flask==0.9 Jinja2==2.7 Flask-Admin==1.0.6 Werkzeug==0.8.3
Is there any way show the dependencies of installed pip packages?
You should take a look at
$ pip install pipdeptree $ pipdeptree -fl Warning!!! Cyclic dependencies found: ------------------------------------------------------------------------ xlwt==0.7.5 ruamel.ext.rtf==0.1.1 xlrd==0.9.3 openpyxl==2.0.4 - jdcal==1.0 pymongo==2.7.1 reportlab==3.1.8 - Pillow==2.5.1 - pip - setuptools
It doesn"t generate a
requirements.txt file as you indicated directly. However the source (255 lines of python code) should be relatively easy to modify to your needs, or alternatively you can (as @MERose indicated is in the pipdeptree 0.3 README ) out use:
pipdeptree --freeze --warn silence | grep -P "^[w0-9-=.]+" > requirements.txt
The 0.5 version of
pipdeptree also allows JSON output with the
--json option, that is more easily machine parseble, at the expense of being less readable.
Target knows. Apple Computer knows, too. So do LinkedIn, Netflix, Facebook, Twitter, Expedia, national and local political campaigns, and dozens of other organizations that all generate enormous eco...
This book is an indispensable guide focuses on Machine Learning and R Programming, in an instructive and conversational tone which helps them who want to make their career in Big Data Analytics/ Data ...
This encyclopedia will be an indispensable resource for our time as it reflects the fact that we are currently living in an expanding data-driven world. ...
Roger Jennings is an author and consultant specializing in Microsoft .NET n-tier database applications and data-intensive Windows Communication Foundation (WCF) Web services with SQL Server. He’s be...