pipdeptree
pipdeptree copied to clipboard
Output redirection raise BrokenPipeError
On macOS 10.13 and Python 3.7.1, the code in the README does not work.
~/Documents $ mkdir pipdeptree
~/Documents $ cd pipdeptree/
~/Documents/pipdeptree $ python3 -m venv venv
~/Documents/pipdeptree $ source venv/bin/activate
(venv) ~/Documents/pipdeptree $ pip install pipdeptree
Collecting pipdeptree
Using cached https://files.pythonhosted.org/packages/<hash omitted>/pipdeptree-0.13.1-py3-none-any.whl
Requirement already satisfied: pip>=6.0.0 in ./venv/lib/python3.7/site-packages (from pipdeptree) (10.0.1)
Installing collected packages: pipdeptree
Successfully installed pipdeptree-0.13.1
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) ~/Documents/pipdeptree $ pipdeptree -f --warn silence | grep -P '^[\w0-9\-=.]+'
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
I think the problem here is that grep
on OSX (BSD) doesn't support the --perl-regexp
or -P
flag. You might be able to get it working with the --extended-regexp
or -E
. Otherwise you can install GNU grep on Mac.
On a Mac this works instead: pipdeptree -f --warn silence | grep -v '[[:space:]]'
Maybe this can be added to the docs for convenience?
I think this is no longer the case.