pipdeptree
pipdeptree copied to clipboard
graphviz is not available, but necessary for the output option. Please install it.
When I try to run pipdeptree with output of png, svg or pdf, it tells me that Graphviz is not installed, but it appears to be already installed.
root@8bf322acc378:/edx/app/edxapp/edx-platform# pipdeptree --graph-output png > pipdeps.png
graphviz is not available, but necessary for the output option. Please install it.
root@8bf322acc378:/edx/app/edxapp/edx-platform# apt-get install graphviz
Reading package lists... Done
Building dependency tree
Reading state information... Done
graphviz is already the newest version (2.38.0-12ubuntu2.1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
root@8bf322acc378:/edx/app/edxapp/edx-platform# pipdeptree --graph-output png > pipdeps.png
graphviz is not available, but necessary for the output option. Please install it.
Is the Python interface for graphviz installed? - https://pypi.python.org/pypi/graphviz
pip install graphviz
fixed this for me. Perhaps you should add this information to the error message.
Have you thought about adding it as an extra dependency (extras_require
) in your setup.py
?
I have thought about this and I think it would be better to keep it optional. Firstly, the functionality to output the dependency tree as a graph is optional. And even if the python lib is added as a dependency, it will not work unless the Graphviz package is also installed on the machine which is something that's outside the scope of pip.
So perhaps the error message should tell you to install both graphviz and the python package?
It does fail with the following,
graphviz is not available, but necessary for the output option. Please install it.
I don't think this tool should should tell the users how to install it. Graphviz's docs should take care of that.
I do agree that it would be a good idea to mention in the README that installation of both graphviz and the python interface will be needed if someone wants to use the --graph-output
option.
@beruic Fair point actually. The error just says install graphviz
so one is more likely to think about the graphviz executable and not the python interface. Don't mind rewording the error message, just want to make sure it's short and concise. Will do this change in the next release.
Unfortunately the python interface does not complain about the binaries missing when it is installed. Otherwise it would be enough to complain about the missing interface.
Can you easily detect whether the binaries are missing without the interface? Otherwise, perhaps you should just complain about the missing interface first, and then about the binaries when it is detected that they are missing through the interface.
First improvement, don't eat the diagnostics, and be explicit…
--- a/pipdeptree.py
+++ b/pipdeptree.py
@@ -405,9 +405,9 @@ def dump_graphviz(tree, output_format='dot'):
"""
try:
from graphviz import backend, Digraph
- except ImportError:
+ except ImportError as cause:
print('graphviz is not available, but necessary for the output '
- 'option. Please install it.', file=sys.stderr)
+ 'option. Please call `pip install "pipdeptree[graphviz]"`. [{}]'.format(cause), file=sys.stderr)
sys.exit(1)
if output_format not in backend.FORMATS:
Hey,
whats the status of this enhancement? I took me today a bit of searching and headscratching, because graphviz itself was already installed, before finding this thread.
Planning to specify graphviz
as an extra dependency in setup.py in the next release.
This was done.