Repository: pypa/pip

Issue:
pip3 freeze output still confusing when stray AdjacentTempDirectorys are present
**Environment**

* pip version: 19.3.1
* Python version: 3.7.4
* OS: macOS 10.14.6

<!-- Feel free to add more information about your environment here -->

Like some other people (e.g. [this fellow](https://stackoverflow.com/q/55565760/1709587), [and this guy](https://github.com/pypa/pip/issues/6513)), I have a `site-packages` littered with leftover folders created by `AdjacentTempDirectory`, visible at the bottom of this `ls` output:


<details>
<summary>Output</summary>

```
markamery@Marks-MacBook-Pro-3 site-packages$ ls -l
total 95312
drwxr-xr-x   12 markamery  admin   384B 28 Oct 18:24 Adafruit_GPIO/
drwxr-xr-x    7 markamery  admin   224B 28 Oct 18:24 Adafruit_GPIO-1.0.3.dist-info/
drwxr-xr-x    5 markamery  admin   160B 28 Oct 18:24 Adafruit_MAX31855/
drwxr-xr-x    8 markamery  admin   256B 28 Oct 18:24 Adafruit_MAX31855-1.6.1.dist-info/
drwxr-xr-x    5 markamery  admin   160B 28 Oct 18:24 Adafruit_PureIO/
drwxr-xr-x    7 markamery  admin   224B 28 Oct 18:24 Adafruit_PureIO-0.2.3.dist-info/
drwxr-xr-x    7 markamery  admin   224B 28 Oct 18:26 ArduinoKeywords-1.0.4.dist-info/
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 Babel-2.7.0.dist-info/
drwxr-xr-x   70 root       admin   2.2K 29 Oct 10:35 Bio/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:35 BioSQL/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 CairoSVG-2.4.2.dist-info/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:48 Click-7.0.dist-info/
drwxr-xr-x    7 markamery  admin   224B 28 Oct 18:26 CppHeaderParser/
drwxr-xr-x    7 markamery  admin   224B 28 Oct 18:26 CppHeaderParser-2.7.4.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:35 Flask-1.1.1.dist-info/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:51 Flask_Compress-1.4.0.dist-info/
drwxr-xr-x   25 root       admin   800B 21 Sep 20:28 IPython/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:25 Jinja2-2.10.3.dist-info/
drwxr-xr-x   10 root       admin   320B 24 Oct 16:27 Mako-1.1.0.dist-info/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:49 MarkupSafe-1.1.1.dist-info/
-rw-r--r--    1 root       admin    46B  1 Oct 14:15 NanoSim-H.egg-link
drwxr-xr-x   11 root       admin   352B 24 Oct 16:27 OpenSSL/
drwxr-xr-x  103 root       admin   3.2K 29 Oct 10:29 PIL/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:29 Pillow-6.2.1.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 PyWavelets-1.1.1.dist-info/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 PyYAML-3.13.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 18:11 Pygments-2.4.2.dist-info/
drwxr-xr-x    7 root       admin   224B 24 Oct 16:27 Pyphen-0.9.5.dist-info/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:35 SQLAlchemy-1.3.10.dist-info/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 Send2Trash-1.5.0.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:36 Sphinx-2.2.1.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:35 WeasyPrint-50.dist-info/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:36 Werkzeug-0.16.0.dist-info/
drwxr-xr-x   33 markamery  admin   1.0K 29 Oct 10:29 __pycache__/
-rw-r--r--    1 root       admin   396K 24 Oct 16:25 _cffi_backend.cpython-37m-darwin.so
-rw-r--r--    1 root       admin    23B 21 Sep 20:28 _pyrsistent_version.py
drwxr-xr-x   13 root       admin   416B 21 Sep 18:11 alabaster/
drwxr-xr-x   11 root       admin   352B 21 Sep 18:11 alabaster-0.7.12.dist-info/
drwxr-xr-x   16 root       admin   512B 29 Oct 10:35 alembic/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:35 alembic-1.2.1.dist-info/
drwxr-xr-x    4 root       admin   128B 29 Oct 10:25 apiclient/
drwxr-xr-x    6 root       admin   192B 21 Sep 20:28 appnope/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 appnope-0.1.0.dist-info/
drwxr-xr-x    6 markamery  admin   192B 28 Oct 18:26 arduinokeywords/
drwxr-xr-x   18 root       admin   576B 21 Sep 20:28 attr/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 attrs-19.1.0.dist-info/
drwxr-xr-x   31 root       admin   992B 29 Oct 10:24 awscli/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:24 awscli-1.16.268.dist-info/
drwxr-xr-x   19 root       admin   608B 21 Sep 18:11 babel/
drwxr-xr-x    6 root       admin   192B 21 Sep 20:28 backcall/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 backcall-0.1.0.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:35 biopython-1.74.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 bleach/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 bleach-3.1.0.dist-info/
drwxr-xr-x   15 root       admin   480B 29 Oct 10:28 boto3/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:28 boto3-1.10.4.dist-info/
drwxr-xr-x   42 root       admin   1.3K 29 Oct 10:24 botocore/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:24 botocore-1.13.4.dist-info/
drwxr-xr-x    7 root       admin   224B 24 Oct 16:26 cached_property-1.5.1.dist-info/
-rw-r--r--    1 root       admin   4.2K 24 Oct 16:21 cached_property.py
drwxr-xr-x   12 root       admin   384B 24 Oct 16:26 cachetools/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:26 cachetools-3.1.1.dist-info/
drwxr-xr-x   18 root       admin   576B 24 Oct 16:27 cairocffi/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 cairocffi-1.1.0.dist-info/
drwxr-xr-x   21 root       admin   672B 24 Oct 16:27 cairosvg/
drwxr-xr-x    7 root       admin   224B 21 Sep 18:11 certifi/
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 certifi-2019.9.11.dist-info/
drwxr-xr-x   23 root       admin   736B 24 Oct 16:27 cffi/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 cffi-1.13.1.dist-info/
drwxr-xr-x   43 root       admin   1.3K 21 Sep 18:11 chardet/
drwxr-xr-x   10 root       admin   320B 21 Sep 18:11 chardet-3.0.4.dist-info/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:46 cigar-0.1.3.dist-info/
-rw-r--r--    1 root       admin   4.5K 16 Sep 15:45 cigar.py
drwxr-xr-x    4 root       admin   128B 29 Oct 10:25 ciso8601/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:25 ciso8601-2.1.2.dist-info/
-rwxr-xr-x    1 root       admin    18K 29 Oct 10:25 ciso8601.cpython-37m-darwin.so*
drwxr-xr-x   20 root       admin   640B 16 Sep 15:48 click/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 colorama/
drwxr-xr-x   10 root       admin   320B 24 Oct 16:27 colorama-0.3.9.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 cpplint-1.4.4.dist-info/
-rw-r--r--    1 root       admin   247K 24 Oct 16:18 cpplint.py
drwxr-xr-x   10 root       admin   320B 24 Oct 16:27 cryptography/
drwxr-xr-x   12 root       admin   384B 24 Oct 16:27 cryptography-2.8.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 cssselect2/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 cssselect2-0.2.2.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:34 cv2/
drwxr-xr-x    9 root       admin   288B 16 Sep 15:45 cycler-0.10.0.dist-info/
-rw-r--r--    1 root       admin    16K 16 Sep 15:43 cycler.py
drwxr-xr-x   14 root       admin   448B 16 Sep 15:45 dateutil/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 decorator-4.4.0.dist-info/
-rw-r--r--    1 root       admin    17K 21 Sep 20:28 decorator.py
drwxr-xr-x   14 root       admin   448B 21 Sep 20:28 defusedxml/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 defusedxml-0.6.0.dist-info/
drwxr-xr-x   17 root       admin   544B 20 Sep 17:38 docutils/
drwxr-xr-x    8 root       admin   256B 20 Sep 17:38 docutils-0.15.2.dist-info/
-rw-r--r--    1 root       admin    15K 24 Oct 16:25 dot_parser.py
-rw-r--r--    1 root       admin    67B  3 Oct 14:43 easy-install.pth
-rw-r--r--    1 markamery  admin   126B  8 Jul 19:31 easy_install.py
-rwxr-xr-x    1 root       admin   2.9K 24 Oct 16:25 editor.py*
drwxr-xr-x    7 root       admin   224B 16 Sep 15:45 entrypoints-0.3.dist-info/
-rw-r--r--    1 root       admin   8.1K 16 Sep 15:43 entrypoints.py
drwxr-xr-x   17 root       admin   544B 29 Oct 10:24 flake8/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:24 flake8-3.7.9.dist-info/
drwxr-xr-x   22 root       admin   704B 29 Oct 10:35 flask/
-rw-r--r--    1 root       admin   3.8K 16 Sep 15:51 flask_compress.py
drwxr-xr-x  121 root       admin   3.8K 24 Oct 16:26 gevent/
drwxr-xr-x   11 root       admin   352B 24 Oct 16:26 gevent-1.4.0.dist-info/
drwxr-xr-x    4 root       admin   128B 24 Oct 16:26 google/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:25 google_api_python_client-1.7.11.dist-info/
-rw-r--r--    1 root       admin   539B 24 Oct 16:25 google_auth-1.6.3-py3.5-nspkg.pth
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 google_auth-1.6.3.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 google_auth_httplib2-0.0.3.dist-info/
-rw-r--r--    1 root       admin   8.2K 24 Oct 16:25 google_auth_httplib2.py
drwxr-xr-x   15 root       admin   480B 29 Oct 10:25 googleapiclient/
drwxr-xr-x   10 root       admin   320B 24 Oct 16:26 greenlet-0.4.15.dist-info/
-rwxr-xr-x    1 root       admin    30K 24 Oct 16:26 greenlet.cpython-37m-darwin.so*
drwxr-xr-x   22 root       admin   704B 20 Sep 17:38 gunicorn/
drwxr-xr-x    9 root       admin   288B 20 Sep 17:38 gunicorn-19.9.0.dist-info/
drwxr-xr-x   16 root       admin   512B 24 Oct 16:27 html5lib/
drwxr-xr-x   10 root       admin   320B 24 Oct 16:27 html5lib-1.0.1.dist-info/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:26 httplib2/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:26 httplib2-0.14.0.dist-info/
drwxr-xr-x   11 root       admin   352B 21 Sep 18:11 idna/
drwxr-xr-x    8 root       admin   256B 21 Sep 18:11 idna-2.8.dist-info/
drwxr-xr-x   10 root       admin   320B 24 Oct 16:27 imageio/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 imageio-2.6.1.dist-info/
drwxr-xr-x    8 root       admin   256B 21 Sep 18:11 imagesize-1.1.0.dist-info/
-rw-r--r--    1 root       admin   9.9K 21 Sep 18:11 imagesize.py
drwxr-xr-x   14 root       admin   448B 29 Oct 10:35 influxdb/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:35 influxdb-5.2.3.dist-info/
drwxr-xr-x   31 root       admin   992B 21 Sep 20:28 ipykernel/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 ipykernel-5.1.2.dist-info/
-rw-r--r--    1 root       admin   451B 21 Sep 20:27 ipykernel_launcher.py
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 ipython-7.8.0.dist-info/
drwxr-xr-x   14 root       admin   448B 21 Sep 20:28 ipython_genutils/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 ipython_genutils-0.2.0.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 ipywidgets/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 ipywidgets-7.5.1.dist-info/
drwxr-xr-x   14 root       admin   448B 24 Sep 11:13 isodate/
drwxr-xr-x    9 root       admin   288B 24 Sep 11:13 isodate-0.6.0.dist-info/
drwxr-xr-x   13 root       admin   416B 16 Sep 15:49 itsdangerous/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:49 itsdangerous-1.1.0.dist-info/
drwxr-xr-x   18 root       admin   576B 21 Sep 20:28 jedi/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 jedi-0.15.1.dist-info/
drwxr-xr-x   30 root       admin   960B 29 Oct 10:25 jinja2/
drwxr-xr-x   11 root       admin   352B 20 Sep 17:38 jmespath/
drwxr-xr-x   10 root       admin   320B 20 Sep 17:38 jmespath-0.9.4.dist-info/
drwxr-xr-x   29 root       admin   928B 16 Sep 15:46 joblib/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:46 joblib-0.13.2.dist-info/
drwxr-xr-x   18 root       admin   576B 21 Sep 20:28 jsonschema/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 jsonschema-3.0.2.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 jupyter-1.0.0.dist-info/
-rw-r--r--    1 root       admin   177B 21 Sep 20:27 jupyter.py
drwxr-xr-x   29 root       admin   928B 21 Sep 20:28 jupyter_client/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 jupyter_client-5.3.3.dist-info/
drwxr-xr-x   11 root       admin   352B 21 Sep 20:28 jupyter_console/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 jupyter_console-6.0.0.dist-info/
drwxr-xr-x   13 root       admin   416B 21 Sep 20:28 jupyter_core/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 jupyter_core-4.5.0.dist-info/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:45 kiwisolver-1.1.0.dist-info/
-rw-r--r--    1 root       admin   361K 16 Sep 15:43 kiwisolver.cpython-37m-darwin.so
drwxr-xr-x   21 root       admin   672B 24 Oct 16:27 mako/
drwxr-xr-x    9 root       admin   288B 16 Sep 15:49 markupsafe/
drwxr-xr-x   88 root       admin   2.8K 29 Oct 10:29 matplotlib/
-rw-r--r--    1 root       admin   569B 29 Oct 10:29 matplotlib-3.1.1-py3.7-nspkg.pth
drwxr-xr-x    8 root       admin   256B 29 Oct 10:29 matplotlib-3.1.1.dist-info/
drwxr-xr-x   10 root       admin   320B 16 Sep 15:45 mccabe-0.6.1.dist-info/
-rw-r--r--    1 root       admin    10K 16 Sep 15:43 mccabe.py
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 mistune-0.8.4.dist-info/
-rw-r--r--    1 root       admin    36K 21 Sep 20:27 mistune.py
drwxr-xr-x    9 root       admin   288B 24 Sep 11:12 mmtf/
drwxr-xr-x    7 root       admin   224B 24 Sep 11:12 mmtf_python-1.1.2.dist-info/
drwxr-xr-x    7 root       admin   224B 29 Oct 10:29 mpl_toolkits/
drwxr-xr-x    8 root       admin   256B 24 Sep 11:12 msgpack/
drwxr-xr-x    8 root       admin   256B 24 Sep 11:12 msgpack-0.6.2.dist-info/
drwxr-xr-x  196 root       admin   6.1K 29 Oct 10:24 mypy/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:24 mypy-0.740.dist-info/
drwxr-xr-x    7 root       admin   224B 16 Sep 15:45 mypy_extensions-0.4.1.dist-info/
-rw-r--r--    1 root       admin   4.9K 16 Sep 15:43 mypy_extensions.py
drwxr-xr-x   69 root       admin   2.2K 29 Oct 10:24 mypyc/
-rwxr-xr-x    1 root       admin    45M 29 Oct 10:24 mypyc_73ace4c88000b89b158a.cpython-37m-darwin.so*
drwxr-xr-x   16 root       admin   512B 21 Sep 20:28 nbconvert/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 nbconvert-5.6.0.dist-info/
drwxr-xr-x   17 root       admin   544B 21 Sep 20:28 nbformat/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 nbformat-4.4.0.dist-info/
drwxr-xr-x   19 root       admin   608B 24 Oct 16:27 networkx/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 networkx-2.4.dist-info/
drwxr-xr-x   35 root       admin   1.1K 21 Sep 20:28 notebook/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 notebook-6.0.1.dist-info/
drwxr-xr-x   30 root       admin   960B 29 Oct 10:26 numpy/
drwxr-xr-x   10 root       admin   320B 29 Oct 10:26 numpy-1.17.3.dist-info/
drwxr-xr-x   11 root       admin   352B 21 Sep 18:11 numpydoc/
drwxr-xr-x    8 root       admin   256B 21 Sep 18:11 numpydoc-0.9.1.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:34 opencv_contrib_python-4.1.1.26.dist-info/
drwxr-xr-x   13 root       admin   416B 21 Sep 18:11 packaging/
drwxr-xr-x   10 root       admin   320B 21 Sep 18:11 packaging-19.2.dist-info/
drwxr-xr-x   20 root       admin   640B 29 Oct 10:31 pandas/
drwxr-xr-x   10 root       admin   320B 29 Oct 10:31 pandas-0.25.2.dist-info/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 pandocfilters-1.4.2.dist-info/
-rw-r--r--    1 root       admin   8.1K 21 Sep 20:28 pandocfilters.py
drwxr-xr-x    7 root       admin   224B 16 Sep 15:48 parasail/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:48 parasail-1.1.17.dist-info/
drwxr-xr-x   14 root       admin   448B 21 Sep 20:28 parso/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 parso-0.5.1.dist-info/
drwxr-xr-x   19 root       admin   608B 21 Sep 20:28 pexpect/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 pexpect-4.7.0.dist-info/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 pickleshare-0.7.5.dist-info/
-rw-r--r--    1 root       admin   9.7K 21 Sep 20:28 pickleshare.py
drwxr-xr-x    7 root       admin   224B 29 Oct 10:45 pip/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:45 pip-19.3.1.dist-info/
drwxr-xr-x    7 markamery  admin   224B 13 Sep 20:12 pkg_resources/
drwxr-xr-x   15 markamery  admin   480B 28 Oct 18:27 pkginfo/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:27 pkginfo-1.5.0.1.dist-info/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:26 ply/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:26 ply-3.11.dist-info/
drwxr-xr-x   11 root       admin   352B 25 Sep 15:48 primer3/
drwxr-xr-x    9 root       admin   288B 25 Sep 15:48 primer3_py-0.6.0.dist-info/
drwxr-xr-x   10 root       admin   320B  1 Oct 14:15 progressbar/
drwxr-xr-x    8 root       admin   256B  1 Oct 14:15 progressbar2-3.47.0.dist-info/
drwxr-xr-x   23 root       admin   736B 21 Sep 20:28 prometheus_client/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 prometheus_client-0.7.1.dist-info/
drwxr-xr-x   36 root       admin   1.1K 21 Sep 20:28 prompt_toolkit/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 prompt_toolkit-2.0.9.dist-info/
drwxr-xr-x   16 root       admin   512B 29 Oct 10:25 psutil/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:25 psutil-5.6.3.dist-info/
drwxr-xr-x   17 root       admin   544B 29 Oct 10:26 psycopg2/
drwxr-xr-x    7 root       admin   224B 29 Oct 10:26 psycopg2-2.8.4-py3.7.egg-info/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 ptyprocess/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 ptyprocess-0.6.0.dist-info/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 pyOpenSSL-19.0.0.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 pyasn1/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 pyasn1-0.4.7.dist-info/
drwxr-xr-x   85 root       admin   2.7K 24 Oct 16:26 pyasn1_modules/
drwxr-xr-x   11 root       admin   352B 24 Oct 16:26 pyasn1_modules-0.2.7.dist-info/
drwxr-xr-x   12 root       admin   384B 16 Sep 15:45 pycodestyle-2.5.0.dist-info/
-rw-r--r--    1 root       admin    98K 16 Sep 15:43 pycodestyle.py
drwxr-xr-x   16 root       admin   512B 24 Oct 16:27 pycparser/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 pycparser-2.19.dist-info/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:26 pydot-1.4.1.dist-info/
-rw-r--r--    1 root       admin    53K 24 Oct 16:25 pydot.py
drwxr-xr-x   11 root       admin   352B 16 Sep 15:45 pyflakes/
drwxr-xr-x    9 root       admin   288B 16 Sep 15:45 pyflakes-2.1.1.dist-info/
drwxr-xr-x   22 root       admin   704B 21 Sep 18:11 pygments/
-rw-r--r--    1 root       admin    90B 29 Oct 10:29 pylab.py
drwxr-xr-x   10 root       admin   320B 16 Sep 15:45 pyparsing-2.4.2.dist-info/
-rw-r--r--    1 root       admin   257K 16 Sep 15:43 pyparsing.py
drwxr-xr-x    5 root       admin   160B 24 Oct 16:27 pyphen/
-rw-r--r--    1 root       admin    11K 24 Oct 16:25 pyphen.py
drwxr-xr-x   23 root       admin   736B 21 Sep 20:28 pyrsistent/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 pyrsistent-0.15.4.dist-info/
drwxr-xr-x   41 root       admin   1.3K 16 Sep 15:45 pysam/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:45 pysam-0.15.3.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 pyserial-3.4.dist-info/
drwxr-xr-x    9 root       admin   288B 16 Sep 15:45 python_dateutil-2.8.0.dist-info/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:27 python_editor-1.0.4.dist-info/
drwxr-xr-x   12 root       admin   384B  1 Oct 14:15 python_utils/
drwxr-xr-x   10 root       admin   320B  1 Oct 14:15 python_utils-2.3.0.dist-info/
drwxr-xr-x   10 root       admin   320B 29 Oct 10:25 pytz/
drwxr-xr-x   11 root       admin   352B 29 Oct 10:25 pytz-2019.3.dist-info/
drwxr-xr-x   22 root       admin   704B 24 Oct 16:27 pywt/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 pyzmq-18.1.0.dist-info/
-rw-r--r--    1 root       admin    23B 16 Sep 15:48 qcat.egg-link
drwxr-xr-x   39 root       admin   1.2K 21 Sep 20:28 qtconsole/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 qtconsole-4.5.5.dist-info/
drwxr-xr-x   25 root       admin   800B 24 Sep 11:13 rdflib/
drwxr-xr-x   11 root       admin   352B 24 Sep 11:13 rdflib-4.2.2.dist-info/
drwxr-xr-x   11 markamery  admin   352B 28 Oct 18:27 readme_renderer/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:27 readme_renderer-24.0.dist-info/
drwxr-xr-x    8 root       admin   256B  4 Oct 15:28 regex/
drwxr-xr-x    7 root       admin   224B  4 Oct 15:28 regex-2019.8.19.dist-info/
drwxr-xr-x   13 root       admin   416B 24 Sep 11:13 reportlab/
drwxr-xr-x    8 root       admin   256B 24 Sep 11:13 reportlab-3.5.26.dist-info/
drwxr-xr-x   21 root       admin   672B 21 Sep 18:11 requests/
drwxr-xr-x    8 root       admin   256B 21 Sep 18:11 requests-2.22.0.dist-info/
drwxr-xr-x   15 markamery  admin   480B 28 Oct 18:27 requests_toolbelt/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:27 requests_toolbelt-0.9.1.dist-info/
drwxr-xr-x   21 root       admin   672B 24 Oct 16:26 rsa/
drwxr-xr-x   10 root       admin   320B 24 Oct 16:26 rsa-3.4.2.dist-info/
drwxr-xr-x   18 root       admin   576B 24 Oct 16:26 s3transfer/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 s3transfer-0.2.1.dist-info/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:28 scikit_image-0.16.2.dist-info/
drwxr-xr-x    8 root       admin   256B 16 Sep 15:46 scikit_learn-0.21.3.dist-info/
drwxr-xr-x   35 root       admin   1.1K 29 Oct 10:27 scipy/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:27 scipy-1.3.1.dist-info/
drwxr-xr-x    6 root       admin   192B 24 Oct 16:27 selenium/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 selenium-3.141.0.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 send2trash/
drwxr-xr-x   26 root       admin   832B 24 Oct 16:27 serial/
drwxr-xr-x   42 markamery  admin   1.3K 13 Sep 20:12 setuptools/
drwxr-xr-x    9 markamery  admin   288B 13 Sep 20:12 setuptools-41.0.1-py3.7.egg-info/
-rw-r--r--    1 markamery  admin   2.0K 13 Sep 20:12 sitecustomize.py
drwxr-xr-x    8 root       admin   256B 16 Sep 15:45 six-1.12.0.dist-info/
-rw-r--r--    1 root       admin    32K 16 Sep 15:43 six.py
drwxr-xr-x   28 root       admin   896B 29 Oct 10:28 skimage/
drwxr-xr-x   51 root       admin   1.6K 16 Sep 15:46 sklearn/
drwxr-xr-x    7 root       admin   224B 16 Sep 15:46 sklearn-0.0.dist-info/
drwxr-xr-x   32 root       admin   1.0K 21 Sep 18:11 snowballstemmer/
drwxr-xr-x    8 root       admin   256B 21 Sep 18:11 snowballstemmer-1.9.1.dist-info/
drwxr-xr-x   42 root       admin   1.3K 29 Oct 10:36 sphinx/
drwxr-xr-x    8 markamery  admin   256B 28 Oct 18:26 sphinx_autodoc_typehints-1.9.0.dist-info/
-rw-r--r--    1 markamery  admin    15K 28 Oct 18:26 sphinx_autodoc_typehints.py
drwxr-xr-x   13 root       admin   416B 21 Sep 18:12 sphinx_rtd_theme/
drwxr-xr-x    9 root       admin   288B 21 Sep 18:12 sphinx_rtd_theme-0.4.3.dist-info/
drwxr-xr-x    8 root       admin   256B 21 Sep 18:11 sphinxcontrib/
-rw-r--r--    1 root       admin   574B 21 Sep 18:11 sphinxcontrib_applehelp-1.0.1-py3.7-nspkg.pth
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 sphinxcontrib_applehelp-1.0.1.dist-info/
-rw-r--r--    1 root       admin   574B 21 Sep 18:11 sphinxcontrib_devhelp-1.0.1-py3.7-nspkg.pth
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 sphinxcontrib_devhelp-1.0.1.dist-info/
-rw-r--r--    1 root       admin   574B 21 Sep 18:11 sphinxcontrib_htmlhelp-1.0.2-py3.7-nspkg.pth
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 sphinxcontrib_htmlhelp-1.0.2.dist-info/
-rw-r--r--    1 root       admin   574B 21 Sep 18:11 sphinxcontrib_jsmath-1.0.1-py3.7-nspkg.pth
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 sphinxcontrib_jsmath-1.0.1.dist-info/
-rw-r--r--    1 root       admin   574B 21 Sep 18:11 sphinxcontrib_qthelp-1.0.2-py3.7-nspkg.pth
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 sphinxcontrib_qthelp-1.0.2.dist-info/
-rw-r--r--    1 root       admin   574B 21 Sep 18:11 sphinxcontrib_serializinghtml-1.1.3-py3.7-nspkg.pth
drwxr-xr-x    9 root       admin   288B 21 Sep 18:11 sphinxcontrib_serializinghtml-1.1.3.dist-info/
drwxr-xr-x   26 root       admin   832B 29 Oct 10:35 sqlalchemy/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 sqlalchemy_schemadisplay-1.3.dist-info/
-rw-r--r--    1 root       admin   8.7K 24 Oct 16:26 sqlalchemy_schemadisplay.py
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 terminado/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 terminado-0.8.2.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 testpath/
drwxr-xr-x    7 root       admin   224B 21 Sep 20:28 testpath-0.4.2.dist-info/
drwxr-xr-x   10 markamery  admin   320B 28 Oct 18:24 tests/
drwxr-xr-x   14 root       admin   448B 24 Oct 16:27 tinycss2/
drwxr-xr-x    8 root       admin   256B 24 Oct 16:27 tinycss2-1.0.2.dist-info/
drwxr-xr-x    7 root       admin   224B 24 Oct 16:27 tls_syslog-0.2.0.dist-info/
drwxr-xr-x    7 root       admin   224B 24 Oct 16:27 tlssyslog/
drwxr-xr-x   37 root       admin   1.2K 21 Sep 20:28 tornado/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 tornado-6.0.3.dist-info/
drwxr-xr-x   21 markamery  admin   672B 28 Oct 18:27 tqdm/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:27 tqdm-4.36.1.dist-info/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 traitlets/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 traitlets-4.3.2.dist-info/
drwxr-xr-x   15 markamery  admin   480B 28 Oct 18:27 twine/
drwxr-xr-x    9 markamery  admin   288B 28 Oct 18:27 twine-2.0.0.dist-info/
drwxr-xr-x   10 root       admin   320B 29 Oct 10:24 typed_ast/
drwxr-xr-x    7 root       admin   224B 29 Oct 10:24 typed_ast-1.4.0.dist-info/
drwxr-xr-x    8 markamery  admin   256B 28 Oct 18:23 typing_extensions-3.7.4.1.dist-info/
-rw-r--r--    1 markamery  admin    74K 28 Oct 18:23 typing_extensions.py
drwxr-xr-x    8 root       admin   256B 24 Oct 16:26 uWSGI-2.0.18.dist-info/
drwxr-xr-x    7 root       admin   224B 24 Oct 16:26 uritemplate/
drwxr-xr-x    9 root       admin   288B 24 Oct 16:26 uritemplate-3.0.0.dist-info/
drwxr-xr-x   16 root       admin   512B 20 Sep 17:38 urllib3/
drwxr-xr-x   10 root       admin   320B 20 Sep 17:38 urllib3-1.23.dist-info/
-rw-r--r--    1 root       admin    10K 24 Oct 16:26 uwsgidecorators.py
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 wcwidth/
drwxr-xr-x   10 root       admin   320B 21 Sep 20:28 wcwidth-0.1.7.dist-info/
drwxr-xr-x   21 root       admin   672B 29 Oct 10:35 weasyprint/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 webencodings/
drwxr-xr-x    9 root       admin   288B 21 Sep 20:28 webencodings-0.5.1.dist-info/
drwxr-xr-x   27 root       admin   864B 29 Oct 10:36 werkzeug/
drwxr-xr-x   19 markamery  admin   608B 13 Sep 20:12 wheel/
drwxr-xr-x    9 markamery  admin   288B 15 Sep  2018 wheel-0.31.1-py3.7.egg-info/
drwxr-xr-x    9 markamery  admin   288B 13 Sep 20:12 wheel-0.33.4-py3.7.egg-info/
drwxr-xr-x    6 root       admin   192B 21 Sep 20:28 widgetsnbextension/
drwxr-xr-x    8 root       admin   256B 21 Sep 20:28 widgetsnbextension-3.5.1.dist-info/
drwxr-xr-x   77 root       admin   2.4K 29 Oct 10:30 wx/
drwxr-xr-x    9 root       admin   288B 29 Oct 10:30 wxPython-4.0.7.dist-info/
drwxr-xr-x   20 root       admin   640B 24 Oct 16:27 yaml/
drwxr-xr-x   75 root       admin   2.3K 29 Oct 10:25 yoctopuce/
drwxr-xr-x    8 root       admin   256B 29 Oct 10:25 yoctopuce-1.10.37304.dist-info/
drwxr-xr-x   20 root       admin   640B 21 Sep 20:28 zmq/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~%tocore-1.12.253.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~-2/
drwxr-xr-x  102 markamery  admin   3.2K 24 Oct 16:26 ~-L/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~-LAlchemy-1.3.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 16 Sep 15:45 ~-ake8-3.7.7.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~-ask-1.0.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~-asyPrint-47.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~-ctopuce-1.10.35153.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~-embic-1.0.10.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~-fluxdb-5.2.2.dist-info/
drwxr-xr-x    9 markamery  admin   288B 21 Sep 18:11 ~-hinx-2.2.0.dist-info/
drwxr-xr-x    4 markamery  admin   128B 24 Oct 16:26 ~-iclient/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~-ikit_image-0.15.0.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~-ipy-1.3.0.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~-mpy-1.16.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~-ndas-0.24.2.dist-info/
drwxr-xr-x    9 markamery  admin   288B 16 Sep 15:49 ~-nja2-2.10.1.dist-info/
drwxr-xr-x   70 markamery  admin   2.2K 24 Oct 16:26 ~-o/
drwxr-xr-x    7 markamery  admin   224B 16 Sep 15:45 ~-ped_ast-1.3.5.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~-rkzeug-0.15.4.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~-so8601-2.1.1.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~-tocore-1.12.253.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~-tplotlib-3.0.3.dist-info/
drwxr-xr-x   11 markamery  admin   352B 24 Oct 16:26 ~-tz-2019.1.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~-util-5.6.2.dist-info/
drwxr-xr-x   77 markamery  admin   2.4K 24 Oct 16:27 ~-wx/
drwxr-xr-x    7 markamery  admin   224B 24 Oct 16:27 ~-ycopg2-2.8.2-py3.7.egg-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~.tocore-1.12.253.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~=tocore-1.12.253.dist-info/
drwxr-xr-x  102 markamery  admin   3.2K 24 Oct 16:26 ~IL/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~QLAlchemy-1.3.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~andas-0.24.2.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~atplotlib-3.0.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~cikit_image-0.15.0.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~cipy-1.3.0.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~easyPrint-47.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~erkzeug-0.15.4.dist-info/
drwxr-xr-x    9 markamery  admin   288B 16 Sep 15:49 ~inja2-2.10.1.dist-info/
drwxr-xr-x   70 markamery  admin   2.2K 24 Oct 16:26 ~io/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~iso8601-2.1.1.dist-info/
drwxr-xr-x    9 markamery  admin   288B 16 Sep 15:45 ~lake8-3.7.7.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~lask-1.0.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~lembic-1.0.10.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~nfluxdb-5.2.2.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~octopuce-1.10.35153.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~otocore-1.12.253.dist-info/
drwxr-xr-x    9 markamery  admin   288B 21 Sep 18:11 ~phinx-2.2.0.dist-info/
drwxr-xr-x    4 markamery  admin   128B 24 Oct 16:26 ~piclient/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~sutil-5.6.2.dist-info/
drwxr-xr-x    7 markamery  admin   224B 24 Oct 16:27 ~sycopg2-2.8.2-py3.7.egg-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~umpy-1.16.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~v2/
drwxr-xr-x   77 markamery  admin   2.4K 24 Oct 16:27 ~wx/
drwxr-xr-x   77 markamery  admin   2.4K 24 Oct 16:27 ~x/
drwxr-xr-x    7 markamery  admin   224B 16 Sep 15:45 ~yped_ast-1.3.5.dist-info/
drwxr-xr-x   11 markamery  admin   352B 24 Oct 16:26 ~ytz-2019.1.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~~2/
drwxr-xr-x  102 markamery  admin   3.2K 24 Oct 16:26 ~~L/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~~LAlchemy-1.3.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 16 Sep 15:45 ~~ake8-3.7.7.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~~ask-1.0.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~~asyPrint-47.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~~ctopuce-1.10.35153.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~~embic-1.0.10.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~~fluxdb-5.2.2.dist-info/
drwxr-xr-x    9 markamery  admin   288B 21 Sep 18:11 ~~hinx-2.2.0.dist-info/
drwxr-xr-x    4 markamery  admin   128B 24 Oct 16:26 ~~iclient/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~~ikit_image-0.15.0.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~~ipy-1.3.0.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~~mpy-1.16.3.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:27 ~~ndas-0.24.2.dist-info/
drwxr-xr-x    9 markamery  admin   288B 16 Sep 15:49 ~~nja2-2.10.1.dist-info/
drwxr-xr-x   70 markamery  admin   2.2K 24 Oct 16:26 ~~o/
drwxr-xr-x    7 markamery  admin   224B 16 Sep 15:45 ~~ped_ast-1.3.5.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~~rkzeug-0.15.4.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~~so8601-2.1.1.dist-info/
drwxr-xr-x    9 markamery  admin   288B 24 Oct 16:26 ~~tocore-1.12.253.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:26 ~~tplotlib-3.0.3.dist-info/
drwxr-xr-x   11 markamery  admin   352B 24 Oct 16:26 ~~tz-2019.1.dist-info/
drwxr-xr-x    8 markamery  admin   256B 24 Oct 16:27 ~~util-5.6.2.dist-info/
drwxr-xr-x    7 markamery  admin   224B 24 Oct 16:27 ~~ycopg2-2.8.2-py3.7.egg-info/
```

</details>

**Description**
As a consequence of the above, when I run `pip3 freeze`, I get a whole load of seemingly nonsensical warnings:

<details>
<summary>Warnings output</summary>

```
WARNING: Could not generate requirement for distribution -ycopg2 2.8.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ycopg2='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -util 5.6.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-util==5'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -tz 2019.1 (/usr/local/lib/python3.7/site-packages): Parse error at "'-tz==201'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -tplotlib 3.0.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-tplotli'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -tocore 1.12.253 (/usr/local/lib/python3.7/site-packages): Parse error at "'-tocore='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -so8601 2.1.1 (/usr/local/lib/python3.7/site-packages): Parse error at "'-so8601='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -rkzeug 0.15.4 (/usr/local/lib/python3.7/site-packages): Parse error at "'-rkzeug='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ped-ast 1.3.5 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ped-ast'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -nja2 2.10.1 (/usr/local/lib/python3.7/site-packages): Parse error at "'-nja2==2'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ndas 0.24.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ndas==0'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -mpy 1.16.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-mpy==1.'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -LAlchemy 1.3.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-LAlchem'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ipy 1.3.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ipy==1.'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ikit-image 0.15.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ikit-im'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -hinx 2.2.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-hinx==2'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -fluxdb 5.2.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-fluxdb='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -embic 1.0.10 (/usr/local/lib/python3.7/site-packages): Parse error at "'-embic=='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ctopuce 1.10.35153 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ctopuce'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -asyPrint 47 (/usr/local/lib/python3.7/site-packages): Parse error at "'-asyPrin'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ask 1.0.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ask==1.'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ake8 3.7.7 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ake8==3'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -ytz 2019.1 (/usr/local/lib/python3.7/site-packages): Parse error at "'-ytz==20'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -yped-ast 1.3.5 (/usr/local/lib/python3.7/site-packages): Parse error at "'-yped-as'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -umpy 1.16.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-umpy==1'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -.tocore 1.12.253 (/usr/local/lib/python3.7/site-packages): Parse error at "'-.tocore'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -sycopg2 2.8.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-sycopg2'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -sutil 5.6.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-sutil=='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -QLAlchemy 1.3.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-QLAlche'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -phinx 2.2.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-phinx=='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -otocore 1.12.253 (/usr/local/lib/python3.7/site-packages): Parse error at "'-otocore'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -octopuce 1.10.35153 (/usr/local/lib/python3.7/site-packages): Parse error at "'-octopuc'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -nfluxdb 5.2.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-nfluxdb'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -lembic 1.0.10 (/usr/local/lib/python3.7/site-packages): Parse error at "'-lembic='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -lask 1.0.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-lask==1'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -lake8 3.7.7 (/usr/local/lib/python3.7/site-packages): Parse error at "'-lake8=='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -iso8601 2.1.1 (/usr/local/lib/python3.7/site-packages): Parse error at "'-iso8601'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -inja2 2.10.1 (/usr/local/lib/python3.7/site-packages): Parse error at "'-inja2=='": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution - 2.8.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-==2.8.2'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -erkzeug 0.15.4 (/usr/local/lib/python3.7/site-packages): Parse error at "'-erkzeug'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -easyPrint 47 (/usr/local/lib/python3.7/site-packages): Parse error at "'-easyPri'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -cipy 1.3.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-cipy==1'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -cikit-image 0.15.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-cikit-i'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -atplotlib 3.0.3 (/usr/local/lib/python3.7/site-packages): Parse error at "'-atplotl'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution -andas 0.24.2 (/usr/local/lib/python3.7/site-packages): Parse error at "'-andas=='": Expected W:(abcd...)
```

</details>

@cjerdonek's change at https://github.com/pypa/pip/pull/6538 improves this slightly (previously there was no clue that these weird names referred to anything in the `site-packages` directory), but as a naive user this I'm still left unsure what I'm being told or what to do about it. When encountering this message, I'm left adrift in a couple of ways:

1. The new message falls short of explicitly stating that the warning was triggered by a folder with a weird name in the `site-packages` directory. It *mentions* the directory, and *mentions* the weird name, and then leaves me to guess.
2. The name given isn't even a perfect match for anything in the `site-packages` directory! The subdirectories triggering the errors start with a `~`, but in the error message that `~` has somehow shapeshifted into a `-`.
3. Even if I correctly infer that the weird subfolders in my `site-packages` directory somehow relate to this error message despite the above hurdles, I'm still left confused and guessing about what that implies. Why are they there at all? Should I delete them or is that going to break my Python installation somehow? Is something horribly corrupted and do I need to reinstall Python? The error message gives me no guidance; it suggests that *something* is wrong with the fact that these folders exist, but that's all the help I get.

(The answer to my rhetorical questions in point 3 is that they're temporary folders created by Pip, possibly left behind when I killed a Pip process previously before it could clean up, and that deleting them is safe. But I'm not sure how I could've found this out without stumbling across [this Stack Overflow answer](https://stackoverflow.com/a/57488427/1709587).)

It's got to be possible to avoid confusing and worrying the user in this way.

**A possible easy fix**

Make `pip freeze` ignore `~`-prefixed folders without logging a warning. From what I understand from https://stackoverflow.com/a/57488427/1709587, `~`-prefixed directories are guaranteed to be temporary directories. So just treat them like they don't exist in `freeze`.

**A possible harder fix**

Attack the root cause by ensuring that these temporary directories eventually get cleaned up properly, even if a `pip` process gets uncleanly killed. I see two strategies for this:

* Check for their presence and attempt cleanup on every `pip` invocation, even if the command is to do something unrelated (similarly to how `git`, by default, sometimes decides to run garbage collection on the objects in your local repo).
* Use the OS's temp directory (e.g. via Python's builtin `tempfile` module) instead

(I'm throwing both these ideas out naively, without much understanding of Pip's internals; I apologise if either of them is stupid for a reason I'm not seeing.)


Discussion:
I'm having the same issue.
I think the right approach is to not pollute the `site-packages` directory. This is not good from the perspective of interoperability, we don't want to mandate that every tool skip `~`-prefixed directories.

The `AdjacentTempDirectory` was originally introduced in #6029 to fix #3055 in order to overcome the issue of the temp directory + nested file path exceeding `MAX_PATH` on Windows. So an approach using `tempfile` would need a companion strategy to preserve the path information without getting into the same situation as before.
> The `AdjacentTempDirectory` was originally introduced in #6029 

Hmm - sounds like we should ping @zooba, then, since he wrote #6029 and may have some wisdom to offer.
I have #9393 ready if we want to skip directories prefaced with non-alphanumeric characters (the `safe_name()` function in https://setuptools.readthedocs.io/en/latest/pkg_resources.html replaces non-alphanumeric char sequences with a dash, hence the `~` shapeshifting into `-`)

I really think ignoring temp directories (folders prefixed with `~` / `-`) is the right move here. This `pip freeze` warning is encountered by every user who's tried `pip upgrade` on a package installed with `sudo pip install`, due to a bug that #9393 fixes.
As well as avoiding the long paths, it also makes uninstall/rollback _significantly_ faster and more reliable. The fact that it still occasionally fails means that it would be failing anyway, but instead of junk in the directory you'd have a totally failed update/remove.

Ignoring the directories in freeze seems fine to me, but the should probably be skipped by whichever function/library thinks that they are importable when they are clearly not. (Maybe also replacing ".dist-info" in the temporary name will help avoid it showing up in the scan?)

Having pip attempt cleanup again on future runs would help keep things tidy, but really, I think that's a level of complexity that isn't necessary. "Do not show invalid packages in pip freeze" seems like a good generic name for this issue, as presumably there are other ways to get into this state besides having an uninstall fail.
Hmm. I don't know the history of why these folders got introduced, so maybe I'm missing something, but I have some questions:

> instead of junk in the directory you'd have a totally failed update/remove.

Okay - but why is the junk preferable to that? Given the choice between:

A. some operation fails

and

B. the operation fails in exactly the same way, but also leaves a folder of undocumented junk behind

why would I want option B? Even if the junk didn't confuse tools, it'd still be confusing to a user trying to make sense of the content of their `site-packages` directory.

> it also makes uninstall/rollback _significantly_ faster and more reliable

Relative to what alternative, and how so?
You get option C, which is "the operation succeeds, but also leaves a folder with undocumented name containing the files that weren't able to be deleted".

The alternative was to copy all the files from their original location to a backup location (possibly on a different drive, hopefully a local one, but no guarantees), copy all the metadata and permissions to the backup location (assuming it supports them), then attempt to delete all the original files. Rollback would do the same thing in reverse. Renaming the directory in-place is a trivial _and equivalent_ operation by comparison.
There is a middleground here: leave undocumented folders that can’t be automatically cleaned up, but avoid treating them like installed distributions. The root issue is actually in `pkg_resources`, where `dist-info` directory names are consumed without validation. But pip can probably do some lateral cleanup to avoid them from being shown to the user. Would this be good enough?
> The root issue is actually in `pkg_resources`, where `dist-info` directory names are consumed without validation. But pip can probably do some lateral cleanup to avoid them from being shown to the user.

Good enough for me - this is what I meant by "skipped by whichever function/library thinks that they are importable".
I'm not sure if it would do anything to fix `pip freeze` or whether it's orthogonal, but one way to make the meaning of these folders clearer to a human inspecting the directory might be to shove them inside a `.cache` or `.tmp` directory within the `dist-info` directory, rather than having them all at the same level as the actual packages. This would still let you just do a `mv` that's basically guaranteed to be on the same drive, while creating less confusing output.

I'm not familiar with `pkg_resources` or the other internals you guys are discussing but *if* by some happy coincidence the extra layer of nesting would also stop `pip-freeze` from seeing these as packages then perhaps this would be a preferable solution, making this stuff less confusing to both humans and machines in a single stroke.
Making the directory path longer is risky, so you'd have to account for that and add a fallback to regenerate the name if the move fails.
Actually, the move will probably succeed, but trying to delete it later will fail (and some users won't be able to delete it themselves either because of the long path).
Thanks for chiming in @zooba - your temp directory function is a clever approach to addressing failures. But the problems with options B and C are not with the status of the operation, but with its state. The fact that these temp directories are (1) non-deterministically named, (2) aren't differentiated from production packages, and (3) are not accounted for after their creation; result in a state where pip can't acknowledge these temp directories properly.

The quick fix to this particular issue would be addressing dist-info directory consumption (with @uranusjr 's suggestion and/or PR #9393). This solves (2).

For longer-term improvements:
- For (1), I'm +1 to OP's suggestion of using the tempfile module or simply changing the naming convention. We wouldn't need non-deterministic names if:
- pip acknowledges temp directories, which addresses (3). In `vim`, there's only one "temp directory," which is the swap file. `vim` addresses issues mentioned here with auto-cleaning and file permissions by offering options to the user:

```
E325: ATTENTION
Found a swap file by the name ".foo.txt.swp"
          owned by: wluk   dated: Mon Jan 04 14:53:06 2021
         [cannot be read]
While opening file "foo.txt"
             dated: Mon Jan 04 14:53:03 2021

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r foo.txt"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".foo.txt.swp"
    to avoid this message.

Swap file ".foo.txt.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
``` 

Can we implement a similar functionality for pip? e.g., if a temp directory is found, warn user to delete it or abort. If the user doesn't have permission to delete, tell the user to run `chown` and try deleting again.
Making another directory is a non-starter - you end up back in the unreliable starting point.

What's probably best is to detect the ".dist-info" suffix and corrupt that part of the name as well. A directory starting with "~" is not a valid module, but it apparently can be a valid package.

Alternatively, the corrupted name could simply be a counter with no information about where it was originally, provided the name is no longer than it started (more precisely, the full path of any file in the directory does not become any longer). That way it should trivially be made to be ignored by pkg_resources.
Can we try to preserve the package name when naming its temp directory? When a user sees `~-ndas-0.24.2.dist-info/` in the packages folder or a warning output, it might be a bit confusing. Some consistent, deterministic naming convention would help with code quality and simplifying testing too.

If the name can't be longer than it started...what about just replacing `.dist-info` with `.swp`? e.g., `pandas-0.24.2.swp`. Making it hidden (`.pandas-0.24.2.swp`) wouldn't hurt either. Then implementing a similar procedure to `vim` to handle `.swp` files (abort/delete/force delete)
I think that's less obvious that it can safely be deleted. And there was some reason we decided not to put a dot at the start, but I forget now. Would have to find the original PR I'm guessing.

You also have to avoid collisions, since there's no (easy) way to know whether you can overwrite the temporary directory or not (maybe it's from an old operation, but it could be from the current one).

At pip startup, you could offer to delete anything lingering, but I wouldn't hold up an uninstall or update operation if there are lingering rollback files. That just hurts the user experience for something that they really don't care about (and once pip freeze is fixed, totally won't care about).
Maybe `.tmp`? With `.tmp.2`, `.tmp.3`, etc. for collisions. I'm guessing the dot was dropped for the filename limit, but that wouldn't be an issue anymore if we replaced `.dist-info` with `.tmp.i`.

Good point on not holding up the flow for temp directories. Auto-deleting `*.tmp.i` seems like it would be the best solution then (as suggested by OP). And a warning if auto-deletion fails (prompting the user to `rm`/`chown` the tmp directory so the deletion succeeds).
Current flow:
```
$ pip freeze
Could not parse requirement: ~-ndas-0.24.2.dist-info
[pip freeze output]
```

Proposed flow
```
$ pip freeze
Cleaning pandas-0.24.2.tmp, pandas-0.24.2.tmp.2
WARNING: Could not clean pandas-0.24.2.tmp.2. Please delete this folder manually.
[pip freeze output]
```
Can we just ignore it during pip freeze and warn when the removal process fails during install/uninstall?

People _should_ ignore stderr output during pip freeze, but I know that many don't, so we will break people by adding more output to that task.
> warn when the removal process fails during install/uninstall

What would these be, and when would them be shown? It’s easy to simply ignore these invalid directories, but showing warnings in the right places (while keeping those directories hidden) is more difficult.
At the end of a pip install/uninstall process, there's a step that cleans up rollback files that weren't used. At a guess, it's a shutil.rmtree with fairly liberal error handling.

The warning would be "WARNING: could not remove rollback files in $directory_name. These may be deleted manually" whenever an exception in rmtree is swallowed.
Should be doable! This can be done by adding a try-except block in `TempDirectory.cleanup()` to log and reraise. And name filtering can be done by adding an additional filter in `get_installed_distributions()` to exclude invalid distribution names.

I’ll mark this as awaiting PR. Anyone interested, please feel free to send a PR!
> Should be doable! This can be done by adding a try-except block in `TempDirectory.cleanup()` to log and reraise. And name filtering can be done by adding an additional filter in `get_installed_distributions()` to exclude invalid distribution names.
> 
> I’ll mark this as awaiting PR. Anyone interested, please feel free to send a PR!

Thanks! It would be great if we could change the invalid distribution naming convention too with this PR (see comments above...replacing random letters with dashes is just a bit confusing).
Also, I'd appreciate a review on the linked PR (#9393). It doesn't fully address the issues mentioned here, but it can be a short-term fix.

cc @uranusjr @zooba 
> replacing random letters with dashes is just a bit confusing

What do you propose as an alternative? There aren’t much choices if we must keep the directory where it is, and cannot change the directory name’s length.
I think the suggestion was to replace the `.dist-info` suffix, which gives us 10 chars to work with.

Resolving patch:
diff --git a/src/pip/_internal/metadata/base.py b/src/pip/_internal/metadata/base.py
--- a/src/pip/_internal/metadata/base.py
+++ b/src/pip/_internal/metadata/base.py
@@ -1,11 +1,26 @@
+import logging
+import re
 from typing import Container, Iterator, List, Optional
 
 from pip._vendor.packaging.version import _BaseVersion
 
 from pip._internal.utils.misc import stdlib_pkgs  # TODO: Move definition here.
 
+logger = logging.getLogger(__name__)
+
 
 class BaseDistribution:
+    @property
+    def location(self):
+        # type: () -> Optional[str]
+        """Where the distribution is loaded from.
+
+        A string value is not necessarily a filesystem path, since distributions
+        can be loaded from other sources, e.g. arbitrary zip archives. ``None``
+        means the distribution is created in-memory.
+        """
+        raise NotImplementedError()
+
     @property
     def metadata_version(self):
         # type: () -> Optional[str]
@@ -61,10 +76,37 @@ def get_distribution(self, name):
         """Given a requirement name, return the installed distributions."""
         raise NotImplementedError()
 
+    def _iter_distributions(self):
+        # type: () -> Iterator[BaseDistribution]
+        """Iterate through installed distributions.
+
+        This function should be implemented by subclass, but never called
+        directly. Use the public ``iter_distribution()`` instead, which
+        implements additional logic to make sure the distributions are valid.
+        """
+        raise NotImplementedError()
+
     def iter_distributions(self):
         # type: () -> Iterator[BaseDistribution]
         """Iterate through installed distributions."""
-        raise NotImplementedError()
+        for dist in self._iter_distributions():
+            # Make sure the distribution actually comes from a valid Python
+            # packaging distribution. Pip's AdjacentTempDirectory leaves folders
+            # e.g. ``~atplotlib.dist-info`` if cleanup was interrupted. The
+            # valid project name pattern is taken from PEP 508.
+            project_name_valid = re.match(
+                r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$",
+                dist.canonical_name,
+                flags=re.IGNORECASE,
+            )
+            if not project_name_valid:
+                logger.warning(
+                    "Ignoring invalid distribution %s (%s)",
+                    dist.canonical_name,
+                    dist.location,
+                )
+                continue
+            yield dist
 
     def iter_installed_distributions(
         self,
diff --git a/src/pip/_internal/metadata/pkg_resources.py b/src/pip/_internal/metadata/pkg_resources.py
--- a/src/pip/_internal/metadata/pkg_resources.py
+++ b/src/pip/_internal/metadata/pkg_resources.py
@@ -24,6 +24,11 @@ def from_wheel(cls, path, name):
             dist = pkg_resources_distribution_for_wheel(zf, name, path)
         return cls(dist)
 
+    @property
+    def location(self):
+        # type: () -> Optional[str]
+        return self._dist.location
+
     @property
     def metadata_version(self):
         # type: () -> Optional[str]
@@ -115,7 +120,7 @@ def get_distribution(self, name):
             return None
         return self._search_distribution(name)
 
-    def iter_distributions(self):
+    def _iter_distributions(self):
         # type: () -> Iterator[BaseDistribution]
         for dist in self._ws:
             yield Distribution(dist)


Test patch:
diff --git a/tests/functional/test_freeze.py b/tests/functional/test_freeze.py
--- a/tests/functional/test_freeze.py
+++ b/tests/functional/test_freeze.py
@@ -5,6 +5,8 @@
 from doctest import ELLIPSIS, OutputChecker
 
 import pytest
+from pip._vendor.packaging.utils import canonicalize_name
+from pip._vendor.pkg_resources import safe_name
 
 from tests.lib import (
     _create_test_package,
@@ -128,26 +130,23 @@ def fake_install(pkgname, dest):
     )
     for pkgname in valid_pkgnames + invalid_pkgnames:
         fake_install(pkgname, script.site_packages_path)
+
     result = script.pip('freeze', expect_stderr=True)
-    for pkgname in valid_pkgnames:
-        _check_output(
-            result.stdout,
-            '...{}==1.0...'.format(pkgname.replace('_', '-'))
-        )
-    for pkgname in invalid_pkgnames:
-        # Check that the full distribution repr is present.
-        dist_repr = '{} 1.0 ('.format(pkgname.replace('_', '-'))
-        expected = (
-            '...Could not generate requirement for '
-            'distribution {}...'.format(dist_repr)
-        )
-        _check_output(result.stderr, expected)
 
-    # Also check that the parse error details occur at least once.
-    # We only need to find one occurrence to know that exception details
-    # are logged.
-    expected = '...site-packages): Parse error at "...'
-    _check_output(result.stderr, expected)
+    # Check all valid names are in the output.
+    output_lines = {line.strip() for line in result.stdout.splitlines()}
+    for name in valid_pkgnames:
+        assert f"{safe_name(name)}==1.0" in output_lines
+
+    # Check all invalid names are excluded from the output.
+    canonical_invalid_names = {canonicalize_name(n) for n in invalid_pkgnames}
+    for line in output_lines:
+        output_name, _, _ = line.partition("=")
+        assert canonicalize_name(output_name) not in canonical_invalid_names
+
+    # The invalid names should be logged.
+    for name in canonical_invalid_names:
+        assert f"Ignoring invalid distribution {name} (" in result.stderr
 
 
 @pytest.mark.git