pipdeptree icon indicating copy to clipboard operation
pipdeptree copied to clipboard

List all "root" packages, even ones without dependencies

Open martinjungblut opened this issue 7 years ago • 4 comments

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!

martinjungblut avatar Dec 05 '16 18:12 martinjungblut

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

naiquevin avatar Dec 08 '16 09:12 naiquevin

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.

martinjungblut avatar Dec 09 '16 02:12 martinjungblut

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?

naiquevin avatar Dec 09 '16 05:12 naiquevin

I can confirm that when I run pip freeze, cx_Oracle appears on the list. I have version 5.2.1 installed here.

martinjungblut avatar Dec 09 '16 17:12 martinjungblut

This should be no longer the case.

gaborbernat avatar Sep 06 '22 07:09 gaborbernat