We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid requirement while trying to use pip options
Hi!

I have in my pip section inside envrionment.yaml file this line
```- rep --install-option='--no-deps'```

while I am trying to update my environment I am getting this error

```Invalid requirement: 'rep --install-option='--no-deps''```

if I do pip -r requirements.txt and I have that line as it is in requirements.txt it works.


--- 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_env/installers/pip.py`
Content:
```
1 from __future__ import absolute_import
2 import subprocess
3 from conda_env.pip_util import pip_args
4 from conda.exceptions import CondaValueError
5 
6 
7 def install(prefix, specs, args, env, prune=False):
8     pip_cmd = pip_args(prefix) + ['install', ] + specs
9     process = subprocess.Popen(pip_cmd, universal_newlines=True)
10     process.communicate()
11 
12     if process.returncode != 0:
13         raise CondaValueError("pip returned an error.")
14
```

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 not fn.endswith(('.egg', '.egg-info', '.dist-info')):
34             continue
35         path = join(sp_dir, fn)
36         if isfile(path):
37             yield path
38         elif isdir(path):
39             for path2 in [join(path, 'PKG-INFO'),
40                           join(path, 'EGG-INFO', 'PKG-INFO'),
41                           join(path, 'METADATA')]:
42                 if isfile(path2):
43                     yield path2
44 
45 
46 pat = re.compile(r'(\w+):\s*(\S+)', re.I)
47 def parse_egg_info(path):
48     """
49     Parse an .egg-info file and return its canonical distribution name
50     """
51     info = {}
52     for line in open(path, encoding='utf-8'):
53         line = line.strip()
54         m = pat.match(line)
55         if m:
56             key = m.group(1).lower()
57             info[key] = m.group(2)
58         try:
59             return '%(name)s-%(version)s-<pip>' % info
60         except KeyError:
61             pass
62     return None
63 
64 
65 def get_egg_info(prefix, all_pkgs=False):
66     """
67     Return a set of canonical names of all Python packages (in `prefix`),
68     by inspecting the .egg-info files inside site-packages.
69     By default, only untracked (not conda installed) .egg-info files are
70     considered.  Setting `all_pkgs` to True changes this.
71     """
72     installed_pkgs = linked_data(prefix)
73     sp_dir = get_site_packages_dir(installed_pkgs)
74     if sp_dir is None:
75         return set()
76 
77     conda_files = set()
78     for info in itervalues(installed_pkgs):
79         conda_files.update(info.get('files', []))
80 
81     res = set()
82     for path in get_egg_info_files(join(prefix, sp_dir)):
83         f = rel_path(prefix, path)
84         if all_pkgs or f not in conda_files:
85             try:
86                 dist = parse_egg_info(path)
87             except UnicodeDecodeError:
88                 dist = None
89             if dist:
90                 res.add(Dist(dist))
91     return res
92 
93 
94 if __name__ == '__main__':
95     from pprint import pprint
96     pprint(get_egg_info(sys.prefix))
97
```
--- 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
@@ -30,6 +30,10 @@
 
 def get_egg_info_files(sp_dir):
     for fn in os.listdir(sp_dir):
+        if fn.endswith('.egg-link'):
+            with open(join(sp_dir, fn), 'r') as reader:
+                for egg in get_egg_info_files(reader.readline().strip()):
+                    yield egg
         if not fn.endswith(('.egg', '.egg-info', '.dist-info')):
             continue
         path = join(sp_dir, fn)
diff --git a/conda_env/installers/pip.py b/conda_env/installers/pip.py
--- a/conda_env/installers/pip.py
+++ b/conda_env/installers/pip.py
@@ -1,13 +1,56 @@
 from __future__ import absolute_import
+
+import os
+import os.path as op
 import subprocess
+import tempfile
 from conda_env.pip_util import pip_args
 from conda.exceptions import CondaValueError
 
 
-def install(prefix, specs, args, env, prune=False):
-    pip_cmd = pip_args(prefix) + ['install', ] + specs
-    process = subprocess.Popen(pip_cmd, universal_newlines=True)
-    process.communicate()
+def _pip_install_via_requirements(prefix, specs, args, *_):
+    """
+    Installs the pip dependencies in specs using a temporary pip requirements file.
+
+    Args
+    ----
+    prefix: string
+      The path to the python and pip executables.
+
+    specs: iterable of strings
+      Each element should be a valid pip dependency.
+      See: https://pip.pypa.io/en/stable/user_guide/#requirements-files
+           https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
+    """
+    try:
+        pip_workdir = op.dirname(op.abspath(args.file))
+    except AttributeError:
+        pip_workdir = None
+    requirements = None
+    try:
+        # Generate the temporary requirements file
+        requirements = tempfile.NamedTemporaryFile(mode='w',
+                                                   prefix='condaenv.',
+                                                   suffix='.requirements.txt',
+                                                   dir=pip_workdir,
+                                                   delete=False)
+        requirements.write('\n'.join(specs))
+        requirements.close()
+        # pip command line...
+        pip_cmd = pip_args(prefix) + ['install', '-r', requirements.name]
+        # ...run it
+        process = subprocess.Popen(pip_cmd,
+                                   cwd=pip_workdir,
+                                   universal_newlines=True)
+        process.communicate()
+        if process.returncode != 0:
+            raise CondaValueError("pip returned an error")
+    finally:
+        # Win/Appveyor does not like it if we use context manager + delete=True.
+        # So we delete the temporary file in a finally block.
+        if requirements is not None and op.isfile(requirements.name):
+            os.remove(requirements.name)
+
 
-    if process.returncode != 0:
-        raise CondaValueError("pip returned an error.")
+# Conform to Installers API
+install = _pip_install_via_requirements

{"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@@ -30,6 +30,10 @@\n \n def 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)\ndiff --git a/conda_env/installers/pip.py b/conda_env/installers/pip.py\n--- a/conda_env/installers/pip.py\n+++ b/conda_env/installers/pip.py\n@@ -1,13 +1,56 @@\n from __future__ import absolute_import\n+\n+import os\n+import os.path as op\n import subprocess\n+import tempfile\n from conda_env.pip_util import pip_args\n from conda.exceptions import CondaValueError\n \n \n-def install(prefix, specs, args, env, prune=False):\n-    pip_cmd = pip_args(prefix) + ['install', ] + specs\n-    process = subprocess.Popen(pip_cmd, universal_newlines=True)\n-    process.communicate()\n+def _pip_install_via_requirements(prefix, specs, args, *_):\n+    \"\"\"\n+    Installs the pip dependencies in specs using a temporary pip requirements file.\n+\n+    Args\n+    ----\n+    prefix: string\n+      The path to the python and pip executables.\n+\n+    specs: iterable of strings\n+      Each element should be a valid pip dependency.\n+      See: https://pip.pypa.io/en/stable/user_guide/#requirements-files\n+           https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format\n+    \"\"\"\n+    try:\n+        pip_workdir = op.dirname(op.abspath(args.file))\n+    except AttributeError:\n+        pip_workdir = None\n+    requirements = None\n+    try:\n+        # Generate the temporary requirements file\n+        requirements = tempfile.NamedTemporaryFile(mode='w',\n+                                                   prefix='condaenv.',\n+                                                   suffix='.requirements.txt',\n+                                                   dir=pip_workdir,\n+                                                   delete=False)\n+        requirements.write('\\n'.join(specs))\n+        requirements.close()\n+        # pip command line...\n+        pip_cmd = pip_args(prefix) + ['install', '-r', requirements.name]\n+        # ...run it\n+        process = subprocess.Popen(pip_cmd,\n+                                   cwd=pip_workdir,\n+                                   universal_newlines=True)\n+        process.communicate()\n+        if process.returncode != 0:\n+            raise CondaValueError(\"pip returned an error\")\n+    finally:\n+        # Win/Appveyor does not like it if we use context manager + delete=True.\n+        # So we delete the temporary file in a finally block.\n+        if requirements is not None and op.isfile(requirements.name):\n+            os.remove(requirements.name)\n+\n \n-    if process.returncode != 0:\n-        raise CondaValueError(\"pip returned an error.\")\n+# Conform to Installers API\n+install = _pip_install_via_requirements\n", "issue": "Invalid requirement while trying to use pip options\nHi!\r\n\r\nI have in my pip section inside envrionment.yaml file this line\r\n```- rep --install-option='--no-deps'```\r\n\r\nwhile I am trying to update my environment I am getting this error\r\n\r\n```Invalid requirement: 'rep --install-option='--no-deps''```\r\n\r\nif I do pip -r requirements.txt and I have that line as it is in requirements.txt it works.\r\n\n", "before_files": [{"content": "from __future__ import absolute_import\nimport subprocess\nfrom conda_env.pip_util import pip_args\nfrom conda.exceptions import CondaValueError\n\n\ndef install(prefix, specs, args, env, prune=False):\n    pip_cmd = pip_args(prefix) + ['install', ] + specs\n    process = subprocess.Popen(pip_cmd, universal_newlines=True)\n    process.communicate()\n\n    if process.returncode != 0:\n        raise CondaValueError(\"pip returned an error.\")\n", "path": "conda_env/installers/pip.py"}, {"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 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": "from __future__ import absolute_import\n\nimport os\nimport os.path as op\nimport subprocess\nimport tempfile\nfrom conda_env.pip_util import pip_args\nfrom conda.exceptions import CondaValueError\n\n\ndef _pip_install_via_requirements(prefix, specs, args, *_):\n    \"\"\"\n    Installs the pip dependencies in specs using a temporary pip requirements file.\n\n    Args\n    ----\n    prefix: string\n      The path to the python and pip executables.\n\n    specs: iterable of strings\n      Each element should be a valid pip dependency.\n      See: https://pip.pypa.io/en/stable/user_guide/#requirements-files\n           https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format\n    \"\"\"\n    try:\n        pip_workdir = op.dirname(op.abspath(args.file))\n    except AttributeError:\n        pip_workdir = None\n    requirements = None\n    try:\n        # Generate the temporary requirements file\n        requirements = tempfile.NamedTemporaryFile(mode='w',\n                                                   prefix='condaenv.',\n                                                   suffix='.requirements.txt',\n                                                   dir=pip_workdir,\n                                                   delete=False)\n        requirements.write('\\n'.join(specs))\n        requirements.close()\n        # pip command line...\n        pip_cmd = pip_args(prefix) + ['install', '-r', requirements.name]\n        # ...run it\n        process = subprocess.Popen(pip_cmd,\n                                   cwd=pip_workdir,\n                                   universal_newlines=True)\n        process.communicate()\n        if process.returncode != 0:\n            raise CondaValueError(\"pip returned an error\")\n    finally:\n        # Win/Appveyor does not like it if we use context manager + delete=True.\n        # So we delete the temporary file in a finally block.\n        if requirements is not None and op.isfile(requirements.name):\n            os.remove(requirements.name)\n\n\n# Conform to Installers API\ninstall = _pip_install_via_requirements\n", "path": "conda_env/installers/pip.py"}, {"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"}]}