Python Forum
Is it possible to see dependencies before installing a package?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is it possible to see dependencies before installing a package?
#1
I want to see the list of dependencies(packages) a given package depends on before installing the package.

For example, pandas depend on numpy. Is there a pip command that takes pandas as input and shows me the dependencies that will be installed alongside pandas? It would be best if the dependency tree is recursive - meaning dependencies also show their dependencies.

Thank you!
Reply
#2
I found this SO answer that points to some workarounds: https://stackoverflow.com/questions/2975...pendencies

It appears this was not a high-priority feature for pip developers.
Reply
#3
Can use Johnnydep
Example Pandas.
C:\code
λ johnnydep pandas
2022-12-06 11:26:22 [info     ] init johnnydist                [johnnydep.lib] dist=pandas parent=None
2022-12-06 11:26:25 [info     ] init johnnydist                [johnnydep.lib] dist=numpy>=1.21.0 parent=pandas
2022-12-06 11:26:28 [info     ] init johnnydist                [johnnydep.lib] dist=python-dateutil>=2.8.1 parent=pandas
2022-12-06 11:26:30 [info     ] init johnnydist                [johnnydep.lib] dist=pytz>=2020.1 parent=pandas
2022-12-06 11:26:32 [info     ] init johnnydist                [johnnydep.lib] dist=six>=1.5 parent=python-dateutil>=2.8.1
name                        summary
--------------------------  -----------------------------------------------------------------------
pandas                      Powerful data structures for data analysis, time series, and statistics
├── numpy>=1.21.0           NumPy is the fundamental package for array computing with Python.
├── python-dateutil>=2.8.1  Extensions to the standard Python datetime module
│   └── six>=1.5            Python 2 and 3 compatibility utilities
└── pytz>=2020.1            World timezone definitions, modern and historical
Example scikit-learn
C:\code
λ johnnydep scikit-learn
2022-12-06 11:30:23 [info     ] init johnnydist                [johnnydep.lib] dist=scikit-learn parent=None
2022-12-06 11:30:26 [info     ] init johnnydist                [johnnydep.lib] dist=joblib>=1.0.0 parent=scikit-learn
2022-12-06 11:30:27 [info     ] init johnnydist                [johnnydep.lib] dist=numpy>=1.17.3 parent=scikit-learn
2022-12-06 11:30:31 [info     ] init johnnydist                [johnnydep.lib] dist=scipy>=1.3.2 parent=scikit-learn
2022-12-06 11:31:15 [info     ] init johnnydist                [johnnydep.lib] dist=threadpoolctl>=2.0.0 parent=scikit-learn
2022-12-06 11:31:17 [info     ] init johnnydist                [johnnydep.lib] dist=numpy<1.26.0,>=1.18.5 parent=scipy>=1.3.2
name                           summary
-----------------------------  -----------------------------------------------------------------
scikit-learn                   A set of python modules for machine learning and data mining
├── joblib>=1.0.0              Lightweight pipelining with Python functions
├── numpy>=1.17.3              NumPy is the fundamental package for array computing with Python.
├── scipy>=1.3.2               Fundamental algorithms for scientific computing in Python
│   └── numpy<1.26.0,>=1.18.5  NumPy is the fundamental package for array computing with Python.
└── threadpoolctl>=2.0.0       threadpoolctl
Gribouillis likes this post
Reply
#4
Thanks. It was mentioned in the original SO answer, but Johneydep has its dependencies. I was looking for a pip command because I wanted to add packages carefully to my environment.
Reply
#5
(Dec-06-2022, 02:26 PM)quazirfan Wrote: I was looking for a pip command because I wanted to add packages carefully to my environment
The way to solve this that is to use virtual environment.
Example i would not at install eg some these AI libraries eg in this post whisper without using virtual environment.
Don't need it anymore if just delete whisper_env folder,then all is gone.
I did help someone at one time the libraries did install 100 packages.

I have of course a lot install to the root Python,but to test larger libraries to avoid conflicts should use virtual environment.
Also if i make a package/libraries myself the this is done in a virtual environment.
There are ok 3-party like Poetry it work fine,my only complain that it need a lot dependencies itself.

Here a packages in Whisper,dos not matter what i have installed before this is now isolated.
(whisper_env) G:\div_code\whisper_env
λ pip list
Package            Version
------------------ ----------
certifi            2022.9.24
charset-normalizer 2.1.1
colorama           0.4.6
ffmpeg-python      0.2.0
filelock           3.8.0
future             0.18.2
huggingface-hub    0.11.1
idna               3.4
more-itertools     9.0.0
numpy              1.23.5
packaging          21.3
pip                22.0.4
pyparsing          3.0.9
PyYAML             6.0
regex              2022.10.31
requests           2.28.1
setuptools         58.1.0
tokenizers         0.13.2
torch              1.13.0
tqdm               4.64.1
transformers       4.25.1
typing_extensions  4.4.0
urllib3            1.26.13
whisper            1.0
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to import sklearn after installing any package ilango 0 1,179 Oct-25-2021, 07:03 AM
Last Post: ilango
  Managing dependencies with pipenv t4keheart 6 2,915 Aug-05-2020, 12:39 AM
Last Post: t4keheart
  Installing a python package using pip anthonymoss78 0 1,795 Jul-14-2020, 01:52 PM
Last Post: anthonymoss78
  Easier way to manage dependencies? Tylersuard 2 2,350 Jan-01-2020, 09:19 PM
Last Post: Tylersuard
  Installing a new package using pip in conda environment firebolt7 1 2,512 Nov-18-2019, 12:31 PM
Last Post: snippsat
  Missing required dependencies when using pyinstaller Ghonim 15 23,270 Jul-15-2019, 08:47 AM
Last Post: shubhthkr
  pip not installing any package on windows royhimo855 0 3,117 Dec-10-2018, 07:58 AM
Last Post: royhimo855
  How to find the list of dependencies not present in the remote artifactory repository csplrj 6 4,672 Mar-30-2018, 03:43 PM
Last Post: csplrj
  pip installing package using c++ boost in windows 6hearts 2 4,371 Feb-16-2018, 06:09 PM
Last Post: 6hearts
  How to import dependencies from a different directory? ayunus 3 2,752 Feb-11-2018, 04:22 AM
Last Post: ayunus

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020