We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
conda 4.4 rc2: failure in conda list when editable install has been moved
`conda list` for my root environment is working nicely using conda 4.3, but when upgrading with canary to conda 4.4.0 rc2, the `conda list` command fails with the following error:

```
joris@joris-XPS-13-9350:~/scipy$ conda list
# packages in environment at /home/joris/miniconda3:
#

`$ /home/joris/miniconda3/bin/conda list`

    Traceback (most recent call last):
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/exceptions.py", line 683, in __call__
        return func(*args, **kwargs)
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main.py", line 78, in _main
        exit_code = do_call(args, p)
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/conda_argparse.py", line 75, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main_list.py", line 150, in execute
        show_channel_urls=context.show_channel_urls)
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main_list.py", line 85, in print_packages
        other_python = get_egg_info(prefix)
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py", line 86, in get_egg_info
        for path in get_egg_info_files(join(prefix, sp_dir)):
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py", line 35, in get_egg_info_files
        for egg in get_egg_info_files(reader.readline().strip()):
      File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py", line 32, in get_egg_info_files
        for fn in os.listdir(sp_dir):
    FileNotFoundError: [Errno 2] No such file or directory: '/home/joris/scipy/dateutil'
```

The reason for this is that I once did `pip install -e .` in the  '/home/joris/scipy/dateutil' directory to test out a dev install of dateutil. But later I removed it. Until now it was not a problem, but so now it is starting to give problems with conda 4.4. 
I know I can fix this by removing it manually from easy-install.pth, but IMO it could be handles more gracefully by conda.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conda/egg_info.py`
Content:
```
1 """
2 Functions related to core conda functionality that relates to manually
3 installed Python packages, e.g. using "python setup.py install", or "pip".
4 """
5 from __future__ import absolute_import, division, print_function, unicode_literals
6 
7 from io import open
8 import os
9 from os.path import isdir, isfile, join
10 import re
11 import sys
12 
13 from .common.compat import itervalues, on_win
14 from .core.linked_data import linked_data
15 from .misc import rel_path
16 from .models.dist import Dist
17 
18 
19 def get_site_packages_dir(installed_pkgs):
20     for info in itervalues(installed_pkgs):
21         if info['name'] == 'python':
22             if on_win:
23                 stdlib_dir = 'Lib'
24             else:
25                 py_ver = info['version'][:3]
26                 stdlib_dir = 'lib/python%s' % py_ver
27             return join(stdlib_dir, 'site-packages')
28     return None
29 
30 
31 def get_egg_info_files(sp_dir):
32     for fn in os.listdir(sp_dir):
33         if fn.endswith('.egg-link'):
34             with open(join(sp_dir, fn), 'r') as reader:
35                 for egg in get_egg_info_files(reader.readline().strip()):
36                     yield egg
37         if not fn.endswith(('.egg', '.egg-info', '.dist-info')):
38             continue
39         path = join(sp_dir, fn)
40         if isfile(path):
41             yield path
42         elif isdir(path):
43             for path2 in [join(path, 'PKG-INFO'),
44                           join(path, 'EGG-INFO', 'PKG-INFO'),
45                           join(path, 'METADATA')]:
46                 if isfile(path2):
47                     yield path2
48 
49 
50 pat = re.compile(r'(\w+):\s*(\S+)', re.I)
51 def parse_egg_info(path):
52     """
53     Parse an .egg-info file and return its canonical distribution name
54     """
55     info = {}
56     for line in open(path, encoding='utf-8'):
57         line = line.strip()
58         m = pat.match(line)
59         if m:
60             key = m.group(1).lower()
61             info[key] = m.group(2)
62         try:
63             return '%(name)s-%(version)s-<pip>' % info
64         except KeyError:
65             pass
66     return None
67 
68 
69 def get_egg_info(prefix, all_pkgs=False):
70     """
71     Return a set of canonical names of all Python packages (in `prefix`),
72     by inspecting the .egg-info files inside site-packages.
73     By default, only untracked (not conda installed) .egg-info files are
74     considered.  Setting `all_pkgs` to True changes this.
75     """
76     installed_pkgs = linked_data(prefix)
77     sp_dir = get_site_packages_dir(installed_pkgs)
78     if sp_dir is None:
79         return set()
80 
81     conda_files = set()
82     for info in itervalues(installed_pkgs):
83         conda_files.update(info.get('files', []))
84 
85     res = set()
86     for path in get_egg_info_files(join(prefix, sp_dir)):
87         f = rel_path(prefix, path)
88         if all_pkgs or f not in conda_files:
89             try:
90                 dist = parse_egg_info(path)
91             except UnicodeDecodeError:
92                 dist = None
93             if dist:
94                 res.add(Dist(dist))
95     return res
96 
97 
98 if __name__ == '__main__':
99     from pprint import pprint
100     pprint(get_egg_info(sys.prefix))
101
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conda/egg_info.py b/conda/egg_info.py
--- a/conda/egg_info.py
+++ b/conda/egg_info.py
@@ -75,7 +75,7 @@
     """
     installed_pkgs = linked_data(prefix)
     sp_dir = get_site_packages_dir(installed_pkgs)
-    if sp_dir is None:
+    if sp_dir is None or not isdir(join(prefix, sp_dir)):
         return set()
 
     conda_files = set()

{"golden_diff": "diff --git a/conda/egg_info.py b/conda/egg_info.py\n--- a/conda/egg_info.py\n+++ b/conda/egg_info.py\n@@ -75,7 +75,7 @@\n     \"\"\"\n     installed_pkgs = linked_data(prefix)\n     sp_dir = get_site_packages_dir(installed_pkgs)\n-    if sp_dir is None:\n+    if sp_dir is None or not isdir(join(prefix, sp_dir)):\n         return set()\n \n     conda_files = set()\n", "issue": "conda 4.4 rc2: failure in conda list when editable install has been moved\n`conda list` for my root environment is working nicely using conda 4.3, but when upgrading with canary to conda 4.4.0 rc2, the `conda list` command fails with the following error:\r\n\r\n```\r\njoris@joris-XPS-13-9350:~/scipy$ conda list\r\n# packages in environment at /home/joris/miniconda3:\r\n#\r\n\r\n`$ /home/joris/miniconda3/bin/conda list`\r\n\r\n    Traceback (most recent call last):\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/exceptions.py\", line 683, in __call__\r\n        return func(*args, **kwargs)\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main\r\n        exit_code = do_call(args, p)\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call\r\n        exit_code = getattr(module, func_name)(args, parser)\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main_list.py\", line 150, in execute\r\n        show_channel_urls=context.show_channel_urls)\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main_list.py\", line 85, in print_packages\r\n        other_python = get_egg_info(prefix)\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py\", line 86, in get_egg_info\r\n        for path in get_egg_info_files(join(prefix, sp_dir)):\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py\", line 35, in get_egg_info_files\r\n        for egg in get_egg_info_files(reader.readline().strip()):\r\n      File \"/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py\", line 32, in get_egg_info_files\r\n        for fn in os.listdir(sp_dir):\r\n    FileNotFoundError: [Errno 2] No such file or directory: '/home/joris/scipy/dateutil'\r\n```\r\n\r\nThe reason for this is that I once did `pip install -e .` in the  '/home/joris/scipy/dateutil' directory to test out a dev install of dateutil. But later I removed it. Until now it was not a problem, but so now it is starting to give problems with conda 4.4. \r\nI know I can fix this by removing it manually from easy-install.pth, but IMO it could be handles more gracefully by conda.\n", "before_files": [{"content": "\"\"\"\nFunctions related to core conda functionality that relates to manually\ninstalled Python packages, e.g. using \"python setup.py install\", or \"pip\".\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom io import open\nimport os\nfrom os.path import isdir, isfile, join\nimport re\nimport sys\n\nfrom .common.compat import itervalues, on_win\nfrom .core.linked_data import linked_data\nfrom .misc import rel_path\nfrom .models.dist import Dist\n\n\ndef get_site_packages_dir(installed_pkgs):\n    for info in itervalues(installed_pkgs):\n        if info['name'] == 'python':\n            if on_win:\n                stdlib_dir = 'Lib'\n            else:\n                py_ver = info['version'][:3]\n                stdlib_dir = 'lib/python%s' % py_ver\n            return join(stdlib_dir, 'site-packages')\n    return None\n\n\ndef get_egg_info_files(sp_dir):\n    for fn in os.listdir(sp_dir):\n        if fn.endswith('.egg-link'):\n            with open(join(sp_dir, fn), 'r') as reader:\n                for egg in get_egg_info_files(reader.readline().strip()):\n                    yield egg\n        if not fn.endswith(('.egg', '.egg-info', '.dist-info')):\n            continue\n        path = join(sp_dir, fn)\n        if isfile(path):\n            yield path\n        elif isdir(path):\n            for path2 in [join(path, 'PKG-INFO'),\n                          join(path, 'EGG-INFO', 'PKG-INFO'),\n                          join(path, 'METADATA')]:\n                if isfile(path2):\n                    yield path2\n\n\npat = re.compile(r'(\\w+):\\s*(\\S+)', re.I)\ndef parse_egg_info(path):\n    \"\"\"\n    Parse an .egg-info file and return its canonical distribution name\n    \"\"\"\n    info = {}\n    for line in open(path, encoding='utf-8'):\n        line = line.strip()\n        m = pat.match(line)\n        if m:\n            key = m.group(1).lower()\n            info[key] = m.group(2)\n        try:\n            return '%(name)s-%(version)s-<pip>' % info\n        except KeyError:\n            pass\n    return None\n\n\ndef get_egg_info(prefix, all_pkgs=False):\n    \"\"\"\n    Return a set of canonical names of all Python packages (in `prefix`),\n    by inspecting the .egg-info files inside site-packages.\n    By default, only untracked (not conda installed) .egg-info files are\n    considered.  Setting `all_pkgs` to True changes this.\n    \"\"\"\n    installed_pkgs = linked_data(prefix)\n    sp_dir = get_site_packages_dir(installed_pkgs)\n    if sp_dir is None:\n        return set()\n\n    conda_files = set()\n    for info in itervalues(installed_pkgs):\n        conda_files.update(info.get('files', []))\n\n    res = set()\n    for path in get_egg_info_files(join(prefix, sp_dir)):\n        f = rel_path(prefix, path)\n        if all_pkgs or f not in conda_files:\n            try:\n                dist = parse_egg_info(path)\n            except UnicodeDecodeError:\n                dist = None\n            if dist:\n                res.add(Dist(dist))\n    return res\n\n\nif __name__ == '__main__':\n    from pprint import pprint\n    pprint(get_egg_info(sys.prefix))\n", "path": "conda/egg_info.py"}], "after_files": [{"content": "\"\"\"\nFunctions related to core conda functionality that relates to manually\ninstalled Python packages, e.g. using \"python setup.py install\", or \"pip\".\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom io import open\nimport os\nfrom os.path import isdir, isfile, join\nimport re\nimport sys\n\nfrom .common.compat import itervalues, on_win\nfrom .core.linked_data import linked_data\nfrom .misc import rel_path\nfrom .models.dist import Dist\n\n\ndef get_site_packages_dir(installed_pkgs):\n    for info in itervalues(installed_pkgs):\n        if info['name'] == 'python':\n            if on_win:\n                stdlib_dir = 'Lib'\n            else:\n                py_ver = info['version'][:3]\n                stdlib_dir = 'lib/python%s' % py_ver\n            return join(stdlib_dir, 'site-packages')\n    return None\n\n\ndef get_egg_info_files(sp_dir):\n    for fn in os.listdir(sp_dir):\n        if fn.endswith('.egg-link'):\n            with open(join(sp_dir, fn), 'r') as reader:\n                for egg in get_egg_info_files(reader.readline().strip()):\n                    yield egg\n        if not fn.endswith(('.egg', '.egg-info', '.dist-info')):\n            continue\n        path = join(sp_dir, fn)\n        if isfile(path):\n            yield path\n        elif isdir(path):\n            for path2 in [join(path, 'PKG-INFO'),\n                          join(path, 'EGG-INFO', 'PKG-INFO'),\n                          join(path, 'METADATA')]:\n                if isfile(path2):\n                    yield path2\n\n\npat = re.compile(r'(\\w+):\\s*(\\S+)', re.I)\ndef parse_egg_info(path):\n    \"\"\"\n    Parse an .egg-info file and return its canonical distribution name\n    \"\"\"\n    info = {}\n    for line in open(path, encoding='utf-8'):\n        line = line.strip()\n        m = pat.match(line)\n        if m:\n            key = m.group(1).lower()\n            info[key] = m.group(2)\n        try:\n            return '%(name)s-%(version)s-<pip>' % info\n        except KeyError:\n            pass\n    return None\n\n\ndef get_egg_info(prefix, all_pkgs=False):\n    \"\"\"\n    Return a set of canonical names of all Python packages (in `prefix`),\n    by inspecting the .egg-info files inside site-packages.\n    By default, only untracked (not conda installed) .egg-info files are\n    considered.  Setting `all_pkgs` to True changes this.\n    \"\"\"\n    installed_pkgs = linked_data(prefix)\n    sp_dir = get_site_packages_dir(installed_pkgs)\n    if sp_dir is None or not isdir(join(prefix, sp_dir)):\n        return set()\n\n    conda_files = set()\n    for info in itervalues(installed_pkgs):\n        conda_files.update(info.get('files', []))\n\n    res = set()\n    for path in get_egg_info_files(join(prefix, sp_dir)):\n        f = rel_path(prefix, path)\n        if all_pkgs or f not in conda_files:\n            try:\n                dist = parse_egg_info(path)\n            except UnicodeDecodeError:\n                dist = None\n            if dist:\n                res.add(Dist(dist))\n    return res\n\n\nif __name__ == '__main__':\n    from pprint import pprint\n    pprint(get_egg_info(sys.prefix))\n", "path": "conda/egg_info.py"}]}