pipdeptree
pipdeptree copied to clipboard
List all "root" packages, even ones without dependencies
Hey naiquevin,
In one of my virtual environments I have the cx_Oracle package installed. It requires no dependencies, and isn't a dependency of any other package. However, when running pipdeptree with either the -a or -r flags, this package isn't listed. Wouldn't it be useful for it to be listed?
What I want is a list of all my "root" packages, that is, packages which may or may not have dependencies, but aren't a dependency of any other package themselves. That way, I can simply output this list to my requirements.txt, making it shorter.
I'm willing to submit a PR at some point in the future if you have interest in this feature but lack the time to implement it yourself.
Thanks in advance!
How did you install the cx_oracle
package? Using pip? When I try to install it in a virtualenv, I get the following error -
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/q3/0qxyn5zs3ps7j454_zkmqhd40000gn/T/pip-build-Hn7T2l/cx-oracle/setup.py", line 170, in <module>
raise DistutilsSetupError("cannot locate an Oracle software " \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
Yeah, I installed it using pip. You need to have the Oracle Instant Client installed on your machine, or that exception will be raised. It's available for download through the Oracle website, and it's not available on most distribution's repositories due to licensing issues. After downloading and extracting the client, you need to set the LD_LIBRARY_PATH and ORACLE_HOME environment variables accordingly, pointing to the path where you extracted the Oracle Instant Client to, and then re-execute pip.
However, I don't believe this issue to be specific to cx_Oracle
. Any package which has no dependencies and depends on no other packages should raise this issue, or am I wrong? I tried using bottle
and indeed, it's listed correctly when I run pipdeptree
. I wonder what's going on with cx_Oracle
.
I'll see if any other package, which is simpler to install, also causes this weird behaviour of not being listed.
Yes, pipdeptree will find all packages that can be found by pip since it uses the pip package itself to discover packages and their dependencies.
I suspect there's something else going on with cx_oracle
. Can you try simple pip freeze
and check if cx_oracle
appears in the list?
I can confirm that when I run pip freeze
, cx_Oracle
appears on the list. I have version 5.2.1 installed here.
This should be no longer the case.