We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
_pip_install_via_requirements got an unexpected keyword argument 'prune'
```
{
  "command":"/home/travis/miniconda/bin/conda-env update",
  "conda_info":{
    "GID":2000,
    "UID":2000,
    "_channels":"https://conda.anaconda.org/conda-canary/linux-64
                          https://conda.anaconda.org/conda-canary/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch",
    "_config_files":"/home/travis/.condarc",
    "_envs_dirs":"/home/travis/miniconda/envs
                          /home/travis/.conda/envs",
    "_pkgs_dirs":"/home/travis/miniconda/pkgs
                          /home/travis/.conda/pkgs",
    "_rtwro":"writable",
    "active_prefix":null,
    "active_prefix_name":null,
    "channels":[
      "https://conda.anaconda.org/conda-canary/linux-64",
      "https://conda.anaconda.org/conda-canary/noarch",
      "https://repo.continuum.io/pkgs/free/linux-64",
      "https://repo.continuum.io/pkgs/free/noarch",
      "https://repo.continuum.io/pkgs/r/linux-64",
      "https://repo.continuum.io/pkgs/r/noarch",
      "https://repo.continuum.io/pkgs/pro/linux-64",
      "https://repo.continuum.io/pkgs/pro/noarch"
    ],
    "conda_build_version":"not installed",
    "conda_env_version":"4.4.0rc0",
    "conda_location":"/home/travis/miniconda/lib/python3.6/site-packages/conda",
    "conda_prefix":"/home/travis/miniconda",
    "conda_private":false,
    "conda_shlvl":-1,
    "conda_version":"4.4.0rc0",
    "config_files":[
      "/home/travis/.condarc"
    ],
    "default_prefix":"/home/travis/miniconda",
    "envs":[

    ],
    "envs_dirs":[
      "/home/travis/miniconda/envs",
      "/home/travis/.conda/envs"
    ],
    "netrc_file":null,
    "offline":false,
    "pkgs_dirs":[
      "/home/travis/miniconda/pkgs",
      "/home/travis/.conda/pkgs"
    ],
    "platform":"linux-64",
    "python_version":"3.6.1.final.0",
    "rc_path":"/home/travis/.condarc",
    "requests_version":"2.14.2",
    "root_prefix":"/home/travis/miniconda",
    "root_writable":true,
    "sys_rc_path":"/home/travis/miniconda/.condarc",
    "user_agent":"conda/4.4.0rc0 requests/2.14.2 CPython/3.6.1 Linux/4.4.0-83-generic ubuntu/14.04 glibc/2.19",
    "user_rc_path":"/home/travis/.condarc"
  },
  "error":"TypeError(\"_pip_install_via_requirements() got an unexpected keyword argument 'prune'\",)",
  "exception_name":"TypeError",
  "exception_type":"<class 'TypeError'>",
  "traceback":"Traceback (most recent call last):
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda/exceptions.py\", line 653, in __call__
    return func(*args, **kwargs)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda_env/cli/main_update.py\", line 107, in execute
    installer.install(prefix, specs, args, env, prune=args.prune)
TypeError: _pip_install_via_requirements() got an unexpected keyword argument 'prune'
"
}
```

--- 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/cli/main_update.py`
Content:
```
1 from argparse import RawDescriptionHelpFormatter
2 import os
3 import sys
4 import textwrap
5 
6 from conda._vendor.auxlib.path import expand
7 from conda.cli import install as cli_install
8 from conda.cli.conda_argparse import add_parser_json, add_parser_prefix
9 from conda.misc import touch_nonadmin
10 from .common import get_prefix
11 from .. import exceptions, specs as install_specs
12 from ..exceptions import CondaEnvException
13 from ..installers.base import InvalidInstaller, get_installer
14 
15 description = """
16 Update the current environment based on environment file
17 """
18 
19 example = """
20 examples:
21     conda env update
22     conda env update -n=foo
23     conda env update -f=/path/to/environment.yml
24     conda env update --name=foo --file=environment.yml
25     conda env update vader/deathstar
26 """
27 
28 
29 def configure_parser(sub_parsers):
30     p = sub_parsers.add_parser(
31         'update',
32         formatter_class=RawDescriptionHelpFormatter,
33         description=description,
34         help=description,
35         epilog=example,
36     )
37     add_parser_prefix(p)
38     p.add_argument(
39         '-f', '--file',
40         action='store',
41         help='environment definition (default: environment.yml)',
42         default='environment.yml',
43     )
44     p.add_argument(
45         '--prune',
46         action='store_true',
47         default=False,
48         help='remove installed packages not defined in environment.yml',
49     )
50     p.add_argument(
51         '-q', '--quiet',
52         action='store_true',
53         default=False,
54     )
55     p.add_argument(
56         'remote_definition',
57         help='remote environment definition / IPython notebook',
58         action='store',
59         default=None,
60         nargs='?'
61     )
62     add_parser_json(p)
63     p.set_defaults(func=execute)
64 
65 
66 def execute(args, parser):
67     name = args.remote_definition or args.name
68 
69     try:
70         spec = install_specs.detect(name=name, filename=expand(args.file),
71                                     directory=os.getcwd())
72         env = spec.environment
73     except exceptions.SpecNotFound:
74         raise
75 
76     if not (args.name or args.prefix):
77         if not env.name:
78                     # Note, this is a hack fofr get_prefix that assumes argparse results
79             # TODO Refactor common.get_prefix
80             name = os.environ.get('CONDA_DEFAULT_ENV', False)
81             if not name:
82                 msg = "Unable to determine environment\n\n"
83                 msg += textwrap.dedent("""
84                     Please re-run this command with one of the following options:
85 
86                     * Provide an environment name via --name or -n
87                     * Re-run this command inside an activated conda environment.""").lstrip()
88                 # TODO Add json support
89                 raise CondaEnvException(msg)
90 
91         # Note: stubbing out the args object as all of the
92         # conda.cli.common code thinks that name will always
93         # be specified.
94         args.name = env.name
95 
96     prefix = get_prefix(args, search=False)
97     # CAN'T Check with this function since it assumes we will create prefix.
98     # cli_install.check_prefix(prefix, json=args.json)
99 
100     # TODO, add capability
101     # common.ensure_override_channels_requires_channel(args)
102     # channel_urls = args.channel or ()
103 
104     for installer_type, specs in env.dependencies.items():
105         try:
106             installer = get_installer(installer_type)
107             installer.install(prefix, specs, args, env, prune=args.prune)
108         except InvalidInstaller:
109             sys.stderr.write(textwrap.dedent("""
110                 Unable to install package for {0}.
111 
112                 Please double check and ensure you dependencies file has
113                 the correct spelling.  You might also try installing the
114                 conda-env-{0} package to see if provides the required
115                 installer.
116                 """).lstrip().format(installer_type)
117             )
118             return -1
119 
120     touch_nonadmin(prefix)
121     cli_install.print_activate(args.name if args.name else prefix)
122
```

Path: `conda_env/installers/conda.py`
Content:
```
1 from __future__ import absolute_import
2 
3 from os.path import basename
4 
5 from conda._vendor.boltons.setutils import IndexedSet
6 from conda.base.context import context
7 from conda.core.solve import Solver
8 from conda.models.channel import Channel, prioritize_channels
9 
10 
11 def install(prefix, specs, args, env, prune=False):
12     # TODO: support all various ways this happens
13     # Including 'nodefaults' in the channels list disables the defaults
14     new_specs = []
15     channel_urls = set()
16     for elem in specs:
17         if "::" in elem:
18             channel_urls.add(elem.split("::")[0])
19             new_specs.append(elem.split("::")[-1])
20         else:
21             new_specs.append(elem)
22     specs = new_specs
23     channel_urls = list(channel_urls)
24     # TODO: support all various ways this happens
25     # Including 'nodefaults' in the channels list disables the defaults
26     channel_urls = channel_urls + [chan for chan in env.channels if chan != 'nodefaults']
27     if 'nodefaults' not in env.channels:
28         channel_urls.extend(context.channels)
29     _channel_priority_map = prioritize_channels(channel_urls)
30 
31     channel_names = IndexedSet(Channel(url).canonical_name for url in _channel_priority_map)
32     channels = IndexedSet(Channel(cn) for cn in channel_names)
33     subdirs = IndexedSet(basename(url) for url in _channel_priority_map)
34 
35     solver = Solver(prefix, channels, subdirs, specs_to_add=specs)
36     unlink_link_transaction = solver.solve_for_transaction(prune=prune)
37 
38     pfe = unlink_link_transaction.get_pfe()
39     pfe.execute()
40     unlink_link_transaction.execute()
41
```

Path: `conda_env/installers/pip.py`
Content:
```
1 from __future__ import absolute_import
2 
3 import os
4 import os.path as op
5 import subprocess
6 import tempfile
7 from conda_env.pip_util import pip_args
8 from conda.exceptions import CondaValueError
9 
10 
11 def _pip_install_via_requirements(prefix, specs, args, *_):
12     """
13     Installs the pip dependencies in specs using a temporary pip requirements file.
14 
15     Args
16     ----
17     prefix: string
18       The path to the python and pip executables.
19 
20     specs: iterable of strings
21       Each element should be a valid pip dependency.
22       See: https://pip.pypa.io/en/stable/user_guide/#requirements-files
23            https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
24     """
25     try:
26         pip_workdir = op.dirname(op.abspath(args.file))
27     except AttributeError:
28         pip_workdir = None
29     requirements = None
30     try:
31         # Generate the temporary requirements file
32         requirements = tempfile.NamedTemporaryFile(mode='w',
33                                                    prefix='condaenv.',
34                                                    suffix='.requirements.txt',
35                                                    dir=pip_workdir,
36                                                    delete=False)
37         requirements.write('\n'.join(specs))
38         requirements.close()
39         # pip command line...
40         pip_cmd = pip_args(prefix) + ['install', '-r', requirements.name]
41         # ...run it
42         process = subprocess.Popen(pip_cmd,
43                                    cwd=pip_workdir,
44                                    universal_newlines=True)
45         process.communicate()
46         if process.returncode != 0:
47             raise CondaValueError("pip returned an error")
48     finally:
49         # Win/Appveyor does not like it if we use context manager + delete=True.
50         # So we delete the temporary file in a finally block.
51         if requirements is not None and op.isfile(requirements.name):
52             os.remove(requirements.name)
53 
54 
55 # Conform to Installers API
56 install = _pip_install_via_requirements
57
```
--- 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_env/cli/main_update.py b/conda_env/cli/main_update.py
--- a/conda_env/cli/main_update.py
+++ b/conda_env/cli/main_update.py
@@ -104,7 +104,7 @@
     for installer_type, specs in env.dependencies.items():
         try:
             installer = get_installer(installer_type)
-            installer.install(prefix, specs, args, env, prune=args.prune)
+            installer.install(prefix, specs, args, env)
         except InvalidInstaller:
             sys.stderr.write(textwrap.dedent("""
                 Unable to install package for {0}.
diff --git a/conda_env/installers/conda.py b/conda_env/installers/conda.py
--- a/conda_env/installers/conda.py
+++ b/conda_env/installers/conda.py
@@ -8,7 +8,7 @@
 from conda.models.channel import Channel, prioritize_channels
 
 
-def install(prefix, specs, args, env, prune=False):
+def install(prefix, specs, args, env, *_, **kwargs):
     # TODO: support all various ways this happens
     # Including 'nodefaults' in the channels list disables the defaults
     new_specs = []
@@ -33,7 +33,7 @@
     subdirs = IndexedSet(basename(url) for url in _channel_priority_map)
 
     solver = Solver(prefix, channels, subdirs, specs_to_add=specs)
-    unlink_link_transaction = solver.solve_for_transaction(prune=prune)
+    unlink_link_transaction = solver.solve_for_transaction(prune=getattr(args, 'prune', False))
 
     pfe = unlink_link_transaction.get_pfe()
     pfe.execute()
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
@@ -8,7 +8,7 @@
 from conda.exceptions import CondaValueError
 
 
-def _pip_install_via_requirements(prefix, specs, args, *_):
+def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs):
     """
     Installs the pip dependencies in specs using a temporary pip requirements file.

{"golden_diff": "diff --git a/conda_env/cli/main_update.py b/conda_env/cli/main_update.py\n--- a/conda_env/cli/main_update.py\n+++ b/conda_env/cli/main_update.py\n@@ -104,7 +104,7 @@\n     for installer_type, specs in env.dependencies.items():\n         try:\n             installer = get_installer(installer_type)\n-            installer.install(prefix, specs, args, env, prune=args.prune)\n+            installer.install(prefix, specs, args, env)\n         except InvalidInstaller:\n             sys.stderr.write(textwrap.dedent(\"\"\"\n                 Unable to install package for {0}.\ndiff --git a/conda_env/installers/conda.py b/conda_env/installers/conda.py\n--- a/conda_env/installers/conda.py\n+++ b/conda_env/installers/conda.py\n@@ -8,7 +8,7 @@\n from conda.models.channel import Channel, prioritize_channels\n \n \n-def install(prefix, specs, args, env, prune=False):\n+def install(prefix, specs, args, env, *_, **kwargs):\n     # TODO: support all various ways this happens\n     # Including 'nodefaults' in the channels list disables the defaults\n     new_specs = []\n@@ -33,7 +33,7 @@\n     subdirs = IndexedSet(basename(url) for url in _channel_priority_map)\n \n     solver = Solver(prefix, channels, subdirs, specs_to_add=specs)\n-    unlink_link_transaction = solver.solve_for_transaction(prune=prune)\n+    unlink_link_transaction = solver.solve_for_transaction(prune=getattr(args, 'prune', False))\n \n     pfe = unlink_link_transaction.get_pfe()\n     pfe.execute()\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@@ -8,7 +8,7 @@\n from conda.exceptions import CondaValueError\n \n \n-def _pip_install_via_requirements(prefix, specs, args, *_):\n+def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs):\n     \"\"\"\n     Installs the pip dependencies in specs using a temporary pip requirements file.\n", "issue": "_pip_install_via_requirements got an unexpected keyword argument 'prune'\n```\r\n{\r\n  \"command\":\"/home/travis/miniconda/bin/conda-env update\",\r\n  \"conda_info\":{\r\n    \"GID\":2000,\r\n    \"UID\":2000,\r\n    \"_channels\":\"https://conda.anaconda.org/conda-canary/linux-64\r\n                          https://conda.anaconda.org/conda-canary/noarch\r\n                          https://repo.continuum.io/pkgs/free/linux-64\r\n                          https://repo.continuum.io/pkgs/free/noarch\r\n                          https://repo.continuum.io/pkgs/r/linux-64\r\n                          https://repo.continuum.io/pkgs/r/noarch\r\n                          https://repo.continuum.io/pkgs/pro/linux-64\r\n                          https://repo.continuum.io/pkgs/pro/noarch\",\r\n    \"_config_files\":\"/home/travis/.condarc\",\r\n    \"_envs_dirs\":\"/home/travis/miniconda/envs\r\n                          /home/travis/.conda/envs\",\r\n    \"_pkgs_dirs\":\"/home/travis/miniconda/pkgs\r\n                          /home/travis/.conda/pkgs\",\r\n    \"_rtwro\":\"writable\",\r\n    \"active_prefix\":null,\r\n    \"active_prefix_name\":null,\r\n    \"channels\":[\r\n      \"https://conda.anaconda.org/conda-canary/linux-64\",\r\n      \"https://conda.anaconda.org/conda-canary/noarch\",\r\n      \"https://repo.continuum.io/pkgs/free/linux-64\",\r\n      \"https://repo.continuum.io/pkgs/free/noarch\",\r\n      \"https://repo.continuum.io/pkgs/r/linux-64\",\r\n      \"https://repo.continuum.io/pkgs/r/noarch\",\r\n      \"https://repo.continuum.io/pkgs/pro/linux-64\",\r\n      \"https://repo.continuum.io/pkgs/pro/noarch\"\r\n    ],\r\n    \"conda_build_version\":\"not installed\",\r\n    \"conda_env_version\":\"4.4.0rc0\",\r\n    \"conda_location\":\"/home/travis/miniconda/lib/python3.6/site-packages/conda\",\r\n    \"conda_prefix\":\"/home/travis/miniconda\",\r\n    \"conda_private\":false,\r\n    \"conda_shlvl\":-1,\r\n    \"conda_version\":\"4.4.0rc0\",\r\n    \"config_files\":[\r\n      \"/home/travis/.condarc\"\r\n    ],\r\n    \"default_prefix\":\"/home/travis/miniconda\",\r\n    \"envs\":[\r\n\r\n    ],\r\n    \"envs_dirs\":[\r\n      \"/home/travis/miniconda/envs\",\r\n      \"/home/travis/.conda/envs\"\r\n    ],\r\n    \"netrc_file\":null,\r\n    \"offline\":false,\r\n    \"pkgs_dirs\":[\r\n      \"/home/travis/miniconda/pkgs\",\r\n      \"/home/travis/.conda/pkgs\"\r\n    ],\r\n    \"platform\":\"linux-64\",\r\n    \"python_version\":\"3.6.1.final.0\",\r\n    \"rc_path\":\"/home/travis/.condarc\",\r\n    \"requests_version\":\"2.14.2\",\r\n    \"root_prefix\":\"/home/travis/miniconda\",\r\n    \"root_writable\":true,\r\n    \"sys_rc_path\":\"/home/travis/miniconda/.condarc\",\r\n    \"user_agent\":\"conda/4.4.0rc0 requests/2.14.2 CPython/3.6.1 Linux/4.4.0-83-generic ubuntu/14.04 glibc/2.19\",\r\n    \"user_rc_path\":\"/home/travis/.condarc\"\r\n  },\r\n  \"error\":\"TypeError(\\\"_pip_install_via_requirements() got an unexpected keyword argument 'prune'\\\",)\",\r\n  \"exception_name\":\"TypeError\",\r\n  \"exception_type\":\"<class 'TypeError'>\",\r\n  \"traceback\":\"Traceback (most recent call last):\r\n  File \\\"/home/travis/miniconda/lib/python3.6/site-packages/conda/exceptions.py\\\", line 653, in __call__\r\n    return func(*args, **kwargs)\r\n  File \\\"/home/travis/miniconda/lib/python3.6/site-packages/conda_env/cli/main_update.py\\\", line 107, in execute\r\n    installer.install(prefix, specs, args, env, prune=args.prune)\r\nTypeError: _pip_install_via_requirements() got an unexpected keyword argument 'prune'\r\n\"\r\n}\r\n```\n", "before_files": [{"content": "from argparse import RawDescriptionHelpFormatter\nimport os\nimport sys\nimport textwrap\n\nfrom conda._vendor.auxlib.path import expand\nfrom conda.cli import install as cli_install\nfrom conda.cli.conda_argparse import add_parser_json, add_parser_prefix\nfrom conda.misc import touch_nonadmin\nfrom .common import get_prefix\nfrom .. import exceptions, specs as install_specs\nfrom ..exceptions import CondaEnvException\nfrom ..installers.base import InvalidInstaller, get_installer\n\ndescription = \"\"\"\nUpdate the current environment based on environment file\n\"\"\"\n\nexample = \"\"\"\nexamples:\n    conda env update\n    conda env update -n=foo\n    conda env update -f=/path/to/environment.yml\n    conda env update --name=foo --file=environment.yml\n    conda env update vader/deathstar\n\"\"\"\n\n\ndef configure_parser(sub_parsers):\n    p = sub_parsers.add_parser(\n        'update',\n        formatter_class=RawDescriptionHelpFormatter,\n        description=description,\n        help=description,\n        epilog=example,\n    )\n    add_parser_prefix(p)\n    p.add_argument(\n        '-f', '--file',\n        action='store',\n        help='environment definition (default: environment.yml)',\n        default='environment.yml',\n    )\n    p.add_argument(\n        '--prune',\n        action='store_true',\n        default=False,\n        help='remove installed packages not defined in environment.yml',\n    )\n    p.add_argument(\n        '-q', '--quiet',\n        action='store_true',\n        default=False,\n    )\n    p.add_argument(\n        'remote_definition',\n        help='remote environment definition / IPython notebook',\n        action='store',\n        default=None,\n        nargs='?'\n    )\n    add_parser_json(p)\n    p.set_defaults(func=execute)\n\n\ndef execute(args, parser):\n    name = args.remote_definition or args.name\n\n    try:\n        spec = install_specs.detect(name=name, filename=expand(args.file),\n                                    directory=os.getcwd())\n        env = spec.environment\n    except exceptions.SpecNotFound:\n        raise\n\n    if not (args.name or args.prefix):\n        if not env.name:\n                    # Note, this is a hack fofr get_prefix that assumes argparse results\n            # TODO Refactor common.get_prefix\n            name = os.environ.get('CONDA_DEFAULT_ENV', False)\n            if not name:\n                msg = \"Unable to determine environment\\n\\n\"\n                msg += textwrap.dedent(\"\"\"\n                    Please re-run this command with one of the following options:\n\n                    * Provide an environment name via --name or -n\n                    * Re-run this command inside an activated conda environment.\"\"\").lstrip()\n                # TODO Add json support\n                raise CondaEnvException(msg)\n\n        # Note: stubbing out the args object as all of the\n        # conda.cli.common code thinks that name will always\n        # be specified.\n        args.name = env.name\n\n    prefix = get_prefix(args, search=False)\n    # CAN'T Check with this function since it assumes we will create prefix.\n    # cli_install.check_prefix(prefix, json=args.json)\n\n    # TODO, add capability\n    # common.ensure_override_channels_requires_channel(args)\n    # channel_urls = args.channel or ()\n\n    for installer_type, specs in env.dependencies.items():\n        try:\n            installer = get_installer(installer_type)\n            installer.install(prefix, specs, args, env, prune=args.prune)\n        except InvalidInstaller:\n            sys.stderr.write(textwrap.dedent(\"\"\"\n                Unable to install package for {0}.\n\n                Please double check and ensure you dependencies file has\n                the correct spelling.  You might also try installing the\n                conda-env-{0} package to see if provides the required\n                installer.\n                \"\"\").lstrip().format(installer_type)\n            )\n            return -1\n\n    touch_nonadmin(prefix)\n    cli_install.print_activate(args.name if args.name else prefix)\n", "path": "conda_env/cli/main_update.py"}, {"content": "from __future__ import absolute_import\n\nfrom os.path import basename\n\nfrom conda._vendor.boltons.setutils import IndexedSet\nfrom conda.base.context import context\nfrom conda.core.solve import Solver\nfrom conda.models.channel import Channel, prioritize_channels\n\n\ndef install(prefix, specs, args, env, prune=False):\n    # TODO: support all various ways this happens\n    # Including 'nodefaults' in the channels list disables the defaults\n    new_specs = []\n    channel_urls = set()\n    for elem in specs:\n        if \"::\" in elem:\n            channel_urls.add(elem.split(\"::\")[0])\n            new_specs.append(elem.split(\"::\")[-1])\n        else:\n            new_specs.append(elem)\n    specs = new_specs\n    channel_urls = list(channel_urls)\n    # TODO: support all various ways this happens\n    # Including 'nodefaults' in the channels list disables the defaults\n    channel_urls = channel_urls + [chan for chan in env.channels if chan != 'nodefaults']\n    if 'nodefaults' not in env.channels:\n        channel_urls.extend(context.channels)\n    _channel_priority_map = prioritize_channels(channel_urls)\n\n    channel_names = IndexedSet(Channel(url).canonical_name for url in _channel_priority_map)\n    channels = IndexedSet(Channel(cn) for cn in channel_names)\n    subdirs = IndexedSet(basename(url) for url in _channel_priority_map)\n\n    solver = Solver(prefix, channels, subdirs, specs_to_add=specs)\n    unlink_link_transaction = solver.solve_for_transaction(prune=prune)\n\n    pfe = unlink_link_transaction.get_pfe()\n    pfe.execute()\n    unlink_link_transaction.execute()\n", "path": "conda_env/installers/conda.py"}, {"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"}], "after_files": [{"content": "from argparse import RawDescriptionHelpFormatter\nimport os\nimport sys\nimport textwrap\n\nfrom conda._vendor.auxlib.path import expand\nfrom conda.cli import install as cli_install\nfrom conda.cli.conda_argparse import add_parser_json, add_parser_prefix\nfrom conda.misc import touch_nonadmin\nfrom .common import get_prefix\nfrom .. import exceptions, specs as install_specs\nfrom ..exceptions import CondaEnvException\nfrom ..installers.base import InvalidInstaller, get_installer\n\ndescription = \"\"\"\nUpdate the current environment based on environment file\n\"\"\"\n\nexample = \"\"\"\nexamples:\n    conda env update\n    conda env update -n=foo\n    conda env update -f=/path/to/environment.yml\n    conda env update --name=foo --file=environment.yml\n    conda env update vader/deathstar\n\"\"\"\n\n\ndef configure_parser(sub_parsers):\n    p = sub_parsers.add_parser(\n        'update',\n        formatter_class=RawDescriptionHelpFormatter,\n        description=description,\n        help=description,\n        epilog=example,\n    )\n    add_parser_prefix(p)\n    p.add_argument(\n        '-f', '--file',\n        action='store',\n        help='environment definition (default: environment.yml)',\n        default='environment.yml',\n    )\n    p.add_argument(\n        '--prune',\n        action='store_true',\n        default=False,\n        help='remove installed packages not defined in environment.yml',\n    )\n    p.add_argument(\n        '-q', '--quiet',\n        action='store_true',\n        default=False,\n    )\n    p.add_argument(\n        'remote_definition',\n        help='remote environment definition / IPython notebook',\n        action='store',\n        default=None,\n        nargs='?'\n    )\n    add_parser_json(p)\n    p.set_defaults(func=execute)\n\n\ndef execute(args, parser):\n    name = args.remote_definition or args.name\n\n    try:\n        spec = install_specs.detect(name=name, filename=expand(args.file),\n                                    directory=os.getcwd())\n        env = spec.environment\n    except exceptions.SpecNotFound:\n        raise\n\n    if not (args.name or args.prefix):\n        if not env.name:\n                    # Note, this is a hack fofr get_prefix that assumes argparse results\n            # TODO Refactor common.get_prefix\n            name = os.environ.get('CONDA_DEFAULT_ENV', False)\n            if not name:\n                msg = \"Unable to determine environment\\n\\n\"\n                msg += textwrap.dedent(\"\"\"\n                    Please re-run this command with one of the following options:\n\n                    * Provide an environment name via --name or -n\n                    * Re-run this command inside an activated conda environment.\"\"\").lstrip()\n                # TODO Add json support\n                raise CondaEnvException(msg)\n\n        # Note: stubbing out the args object as all of the\n        # conda.cli.common code thinks that name will always\n        # be specified.\n        args.name = env.name\n\n    prefix = get_prefix(args, search=False)\n    # CAN'T Check with this function since it assumes we will create prefix.\n    # cli_install.check_prefix(prefix, json=args.json)\n\n    # TODO, add capability\n    # common.ensure_override_channels_requires_channel(args)\n    # channel_urls = args.channel or ()\n\n    for installer_type, specs in env.dependencies.items():\n        try:\n            installer = get_installer(installer_type)\n            installer.install(prefix, specs, args, env)\n        except InvalidInstaller:\n            sys.stderr.write(textwrap.dedent(\"\"\"\n                Unable to install package for {0}.\n\n                Please double check and ensure you dependencies file has\n                the correct spelling.  You might also try installing the\n                conda-env-{0} package to see if provides the required\n                installer.\n                \"\"\").lstrip().format(installer_type)\n            )\n            return -1\n\n    touch_nonadmin(prefix)\n    cli_install.print_activate(args.name if args.name else prefix)\n", "path": "conda_env/cli/main_update.py"}, {"content": "from __future__ import absolute_import\n\nfrom os.path import basename\n\nfrom conda._vendor.boltons.setutils import IndexedSet\nfrom conda.base.context import context\nfrom conda.core.solve import Solver\nfrom conda.models.channel import Channel, prioritize_channels\n\n\ndef install(prefix, specs, args, env, *_, **kwargs):\n    # TODO: support all various ways this happens\n    # Including 'nodefaults' in the channels list disables the defaults\n    new_specs = []\n    channel_urls = set()\n    for elem in specs:\n        if \"::\" in elem:\n            channel_urls.add(elem.split(\"::\")[0])\n            new_specs.append(elem.split(\"::\")[-1])\n        else:\n            new_specs.append(elem)\n    specs = new_specs\n    channel_urls = list(channel_urls)\n    # TODO: support all various ways this happens\n    # Including 'nodefaults' in the channels list disables the defaults\n    channel_urls = channel_urls + [chan for chan in env.channels if chan != 'nodefaults']\n    if 'nodefaults' not in env.channels:\n        channel_urls.extend(context.channels)\n    _channel_priority_map = prioritize_channels(channel_urls)\n\n    channel_names = IndexedSet(Channel(url).canonical_name for url in _channel_priority_map)\n    channels = IndexedSet(Channel(cn) for cn in channel_names)\n    subdirs = IndexedSet(basename(url) for url in _channel_priority_map)\n\n    solver = Solver(prefix, channels, subdirs, specs_to_add=specs)\n    unlink_link_transaction = solver.solve_for_transaction(prune=getattr(args, 'prune', False))\n\n    pfe = unlink_link_transaction.get_pfe()\n    pfe.execute()\n    unlink_link_transaction.execute()\n", "path": "conda_env/installers/conda.py"}, {"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, *_, **kwargs):\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"}]}