pipdeptree icon indicating copy to clipboard operation
pipdeptree copied to clipboard

Allow to run without installing into virtualenv

Open schinckel opened this issue 10 years ago • 7 comments
trafficstars

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?

schinckel avatar Nov 14 '15 09:11 schinckel

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.

nikolas avatar Mar 24 '16 15:03 nikolas

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.

Pike avatar Jan 09 '17 15:01 Pike

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?

iqbalansari avatar Apr 23 '17 16:04 iqbalansari

Sure, always interested in PRs :-) Go ahead.

naiquevin avatar Apr 29 '17 05:04 naiquevin

@iqbalansari any updates?

E3V3A avatar Jan 24 '18 20:01 E3V3A

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

iqbalansari avatar Jan 28 '18 12:01 iqbalansari

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)

merwok avatar May 02 '20 03:05 merwok

The --python flag has been added.

gaborbernat avatar Sep 06 '22 07:09 gaborbernat