pipdeptree
pipdeptree copied to clipboard
Allow to run without installing into virtualenv
I'd like to have pipdeptree installed once (using pipsi), and then be able to use it in a different virtualenv.
Is this a use case you'd consider supporting?
I agree it's annoying to have to install pipdeptree inside the same virtualenv as the project you're looking up. I wrote a blog post about it here: http://www.columbia.edu/~njn2118/journal/2016/3/24.html
In addition, when I do install into the same virtualenv, the pipdeptree command fails:
$ ./ve/bin/pipdeptree
Traceback (most recent call last):
File "./ve/bin/pipdeptree", line 7, in <module>
from pipdeptree import main
ImportError: No module named pipdeptree
I get around this by doing ./ve/bin/python -m pipdeptree, which works.
I'm pretty happy with activating my virtualenv, and just running
python /usr/local/lib/python2.7/site-packages/pipdeptree.py
As pipdeptree doesn't have any internal dependencies, that works like charm.
I think this can be achieved by checking if pipdeptree is running a virtualenv and then re-execing with virtualenv's python binary. @naiquevin I can try implementing this, would you be interested in a PR for this?
Sure, always interested in PRs :-) Go ahead.
@iqbalansari any updates?
Sorry just forgot about this, I had it working but there was some problem with bytecode versions or something (at which point I got busy with other things). Let me try and fix that issue
Another way of achieving this would be an option to read the package list from a file rather than the environment (similar to how safety check accepts a requirements file as input)
The --python flag has been added.