internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: conda/conda

Issue:
conda env update : does not support --prefix
The `conda env update` does not support the `--prefix` / `-p` argument.

```
$ conda info | grep version
          conda version : 4.2.12
      conda-env version : 4.2.12
    conda-build version : 1.20.3
         python version : 2.7.11.final.0
       requests version : 2.10.0

$ conda env update -p ./conda-env
usage: conda-env [-h] {attach,create,export,list,remove,upload,update} ...
conda-env: error: unrecognized arguments: -p
```



Discussion:
I don't know if I've interpreted your issue correctly, but I think all you need to do is drop the `env` so your command becomes `conda update -p ./conda-env`

Here's what I'm trying to achieve:

I have a bootstrap script that always gets run when a project gets checked out or updated. This is to make it easy for users who are not conda-savvy, and for continuous build machines, etc.

I'd like to have a cmd I can run that can create the environment (from environment.yml) the first time it's run, and then update on subsequent runs.
- `conda env update` works really well for this, but doesn't allow custom prefixes. 
- `conda env create --prefix foo` will respect the prefix, but it fails if the env has already been created (I'm working around this at the moment with `--force`, but it's slow as it rebuilds the complete env every time).
- `conda update -prefix foo` does not read environment.yml, so doesn't work for me.

I see, I think the right way to do this is `conda env update -n foo`. This will use the environment.yml file to update an env named foo.

But that doesnt work with --prefix. I always use local prefix based envs to ensure projects are isolated from each other.

I have this issue too.  I would really like `conda env update --prefix` to be supported so I can update an environment which is not in the canonical location.
How is this still an issue?  I need this too.  Please?
I have this issue too as we like to use the conda env update command for CI/CD and sometimes the env might not exist yet and we want env to be created but may not want the prefix defined in yml file as that is typically the developer's prefix and not one we use for rollout in official production envs.

Resolving patch:
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
@@ -79,7 +79,7 @@ def execute(args, parser):
     except exceptions.SpecNotFound:
         raise
 
-    if not args.name:
+    if not (args.name or args.prefix):
         if not env.name:
                     # Note, this is a hack fofr get_prefix that assumes argparse results
             # TODO Refactor common.get_prefix


Test patch:
Repository: conda/conda

Issue:
conda should exec to non-conda subcommands, not subprocess



Discussion:

Resolving patch:
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py
--- a/conda/cli/conda_argparse.py
+++ b/conda/cli/conda_argparse.py
@@ -45,7 +45,6 @@ def _get_action_from_name(self, name):
 
     def error(self, message):
         import re
-        import subprocess
         from .find_commands import find_executable
 
         exc = sys.exc_info()[1]
@@ -57,7 +56,7 @@ def error(self, message):
             else:
                 argument = None
             if argument and argument.dest == "cmd":
-                m = re.compile(r"invalid choice: '([\w\-]+)'").match(exc.message)
+                m = re.compile(r"invalid choice: u?'([\w\-]+)'").match(exc.message)
                 if m:
                     cmd = m.group(1)
                     executable = find_executable('conda-' + cmd)
@@ -67,13 +66,7 @@ def error(self, message):
 
                     args = [find_executable('conda-' + cmd)]
                     args.extend(sys.argv[2:])
-                    p = subprocess.Popen(args)
-                    try:
-                        p.communicate()
-                    except KeyboardInterrupt:
-                        p.wait()
-                    finally:
-                        sys.exit(p.returncode)
+                    os.execv(args[0], args)
 
         super(ArgumentParser, self).error(message)
 


Test patch:
Repository: conda/conda

Issue:
conda info always shows 'unknown' for admin indicator on Windows



Discussion:

Resolving patch:
diff --git a/conda/common/platform.py b/conda/common/platform.py
--- a/conda/common/platform.py
+++ b/conda/common/platform.py
@@ -18,8 +18,8 @@ def is_admin_on_windows():  # pragma: unix no cover
     if not on_win:  # pragma: no cover
         return False
     try:
-        from ctypes.windll.shell32 import IsUserAnAdmin
-        return IsUserAnAdmin() != 0
+        from ctypes import windll
+        return windll.shell32.IsUserAnAdmin()() != 0
     except ImportError as e:
         log.debug('%r', e)
         return 'unknown'


Test patch:
Repository: conda/conda

Issue:
duplicate log messages
Adding code

```python
class DbgViewHandler(logging.Handler):
    def emit(self, record):
        print("DbgViewHandler: %s" % record)

logger = logging.getLogger("logging_test")
logger.setLevel(logging.DEBUG)
logger.propagate = False
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.WARNING)  # all going to stderr
dbgview = DbgViewHandler()  # all going to stdout
dbgview.setLevel(logging.DEBUG)
logger.addHandler(dbgview)
logger.addHandler(stream_handler)

logger.info("Hello there")
logger.warn("Whoa there")
```

To the bottom of conda/gateways/logging.py outputs too many copies of messages.


Discussion:

Resolving patch:
diff --git a/conda/gateways/logging.py b/conda/gateways/logging.py
--- a/conda/gateways/logging.py
+++ b/conda/gateways/logging.py
@@ -91,4 +91,3 @@ def trace(self, message, *args, **kwargs):
 
 logging.addLevelName(TRACE, "TRACE")
 logging.Logger.trace = trace
-initialize_logging()


Test patch:
Repository: conda/conda

Issue:
Conda 4.3.19 (canary) is breaking json output parsing for navigator
```plain
$ conda create -n test-conda python --json
Solving package specifications:    # This line should not be there....!
{
  "actions": {
    "LINK": [
      "defaults::openssl-1.0.2k-2",
      "defaults::readline-6.2-2",
      "defaults::sqlite-3.13.0-0",
      "defaults::tk-8.5.18-0",
      "defaults::xz-5.2.2-1",
      "defaults::zlib-1.2.8-3",
      "defaults::python-3.6.1-2",
      "defaults::setuptools-27.2.0-py36_0",
      "defaults::wheel-0.29.0-py36_0",
      "defaults::pip-9.0.1-py36_1"
    ],
    "PREFIX": "/Users/gpena-castellanos/anaconda/envs/test-conda",
    "SYMLINK_CONDA": [
      "/Users/gpena-castellanos/anaconda"
    ],
    "op_order": [
      "CHECK_FETCH",
      "RM_FETCHED",
      "FETCH",
      "CHECK_EXTRACT",
      "RM_EXTRACTED",
      "EXTRACT",
      "UNLINK",
      "LINK",
      "SYMLINK_CONDA"
    ]
  },
  "success": true
}
```
Conda 4.3.19 (canary) is breaking json output parsing for navigator
```plain
$ conda create -n test-conda python --json
Solving package specifications:    # This line should not be there....!
{
  "actions": {
    "LINK": [
      "defaults::openssl-1.0.2k-2",
      "defaults::readline-6.2-2",
      "defaults::sqlite-3.13.0-0",
      "defaults::tk-8.5.18-0",
      "defaults::xz-5.2.2-1",
      "defaults::zlib-1.2.8-3",
      "defaults::python-3.6.1-2",
      "defaults::setuptools-27.2.0-py36_0",
      "defaults::wheel-0.29.0-py36_0",
      "defaults::pip-9.0.1-py36_1"
    ],
    "PREFIX": "/Users/gpena-castellanos/anaconda/envs/test-conda",
    "SYMLINK_CONDA": [
      "/Users/gpena-castellanos/anaconda"
    ],
    "op_order": [
      "CHECK_FETCH",
      "RM_FETCHED",
      "FETCH",
      "CHECK_EXTRACT",
      "RM_EXTRACTED",
      "EXTRACT",
      "UNLINK",
      "LINK",
      "SYMLINK_CONDA"
    ]
  },
  "success": true
}
```


Discussion:

Resolving patch:
diff --git a/conda/cli/main.py b/conda/cli/main.py
--- a/conda/cli/main.py
+++ b/conda/cli/main.py
@@ -82,7 +82,7 @@ def generate_parser():
 
 def init_loggers(context):
     from ..gateways.logging import set_all_logger_level, set_verbosity
-    if not context.json:
+    if context.json:
         # Silence logging info to avoid interfering with JSON output
         for logger in ('print', 'dotupdate', 'stdoutlog', 'stderrlog'):
             getLogger(logger).setLevel(CRITICAL + 1)


Test patch:
Repository: conda/conda

Issue:
Launching navigator via prompt warnings appear
_From @RidaZubair on May 24, 2017 9:47_

**OS:** Windows
**Anaconda: 4.4.0**

**Actual:**
On launching navigator via prompt following warning appears on prompt
![2](https://cloud.githubusercontent.com/assets/27444898/26396930/175ef622-408e-11e7-8e75-e9c2218e15de.png)



_Copied from original issue: ContinuumIO/navigator#1189_


Discussion:
_From @goanpeca on May 24, 2017 13:52_

@kalefranz whats with the conda.common.platform error there?

@RidaZubair warnings are just to inform that the conda commands that we called might have return something on the stderr, but by themselves they are not errors.

However I am currious about the first Warning on Conda. Is Navigator not working in any way?

In general WARNING messages are not a problem.
_From @goanpeca on May 25, 2017 12:56_

Remove any warnings for output on stderr when parsing conda commands. 
Depending on the conda version, was probably https://github.com/conda/conda/pull/5368, fixed in 4.3.20.
Crud, that error is pretty obvious. https://github.com/conda/conda/pull/5368/files#diff-56d5b142f8053df84f4a4e13d99c3864R22

A second couple-character patch for 4.3.21.

Resolving patch:
diff --git a/conda/common/platform.py b/conda/common/platform.py
--- a/conda/common/platform.py
+++ b/conda/common/platform.py
@@ -19,12 +19,12 @@ def is_admin_on_windows():  # pragma: unix no cover
         return False
     try:
         from ctypes import windll
-        return windll.shell32.IsUserAnAdmin()() != 0
+        return windll.shell32.IsUserAnAdmin() != 0
     except ImportError as e:
         log.debug('%r', e)
         return 'unknown'
     except Exception as e:
-        log.warn('%r', e)
+        log.info('%r', e)
         return 'unknown'
 
 


Test patch:
diff --git a/tests/common/test_platform.py b/tests/common/test_platform.py
new file mode 100644
--- /dev/null
+++ b/tests/common/test_platform.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import, division, print_function, unicode_literals
+
+from conda.common.compat import on_win
+from conda.common.platform import is_admin_on_windows
+
+
+def test_is_admin_on_windows():
+    result = is_admin_on_windows()
+    if not on_win:
+        assert result is False
+    else:
+        assert result is False or result is True
Repository: conda/conda

Issue:
Environment Deactivation - Misleading Message?
When I try to create an environment, I get the following message:

```bash
(root) [xyz@unknown ~]$ conda create -yn anacondacon
Fetching package metadata .........
Solving package specifications:
Package plan for installation in environment /conda/envs/anacondacon:

#
# To activate this environment, use:
# > source activate anacondacon
#
# To deactivate this environment, use:
# > source deactivate anacondacon
#
```
The command displayed to deactivate the environment suggests that the name of the environment is an argument to deactivate. But, is it really? I only have to do `source deactivate`, right?
Environment Deactivation - Misleading Message?
When I try to create an environment, I get the following message:

```bash
(root) [xyz@unknown ~]$ conda create -yn anacondacon
Fetching package metadata .........
Solving package specifications:
Package plan for installation in environment /conda/envs/anacondacon:

#
# To activate this environment, use:
# > source activate anacondacon
#
# To deactivate this environment, use:
# > source deactivate anacondacon
#
```
The command displayed to deactivate the environment suggests that the name of the environment is an argument to deactivate. But, is it really? I only have to do `source deactivate`, right?


Discussion:

Resolving patch:
diff --git a/conda/cli/install.py b/conda/cli/install.py
--- a/conda/cli/install.py
+++ b/conda/cli/install.py
@@ -82,8 +82,8 @@ def print_activate(arg):
         # To activate this environment, use:
         # > activate %s
         #
-        # To deactivate this environment, use:
-        # > deactivate %s
+        # To deactivate an active environment, use:
+        # > deactivate
         #
         # * for power-users using bash, you must source
         #
@@ -96,8 +96,8 @@ def print_activate(arg):
             # To activate this environment, use:
             # > conda activate %s
             #
-            # To deactivate this environment, use:
-            # > conda deactivate %s
+            # To deactivate an active environment, use:
+            # > conda deactivate
             #
             """)
         else:
@@ -106,12 +106,12 @@ def print_activate(arg):
             # To activate this environment, use:
             # > source activate %s
             #
-            # To deactivate this environment, use:
-            # > source deactivate %s
+            # To deactivate an active environment, use:
+            # > source deactivate
             #
             """)
 
-    return message % (arg, arg)
+    return message % arg
 
 
 def get_revision(arg, json=False):


Test patch:
Repository: conda/conda

Issue:
Fix all the `None`s in CondaHTTPError
```
CondaHTTPError: HTTP None None for url https://repo.continuum.io/pkgs/free/win-64/repodata.json.bz2
Elapsed: None
```


Discussion:

Resolving patch:
diff --git a/conda/exceptions.py b/conda/exceptions.py
--- a/conda/exceptions.py
+++ b/conda/exceptions.py
@@ -355,6 +355,10 @@ def __init__(self, message, url, status_code, reason, elapsed_time, response=Non
         _message += "CF-RAY: %s\n\n" % cf_ray if cf_ray else "\n"
         message = _message + message
 
+        status_code = status_code or '000'
+        reason = reason or 'CONNECTION FAILED'
+        elapsed_time = elapsed_time or '-'
+
         from ._vendor.auxlib.logz import stringify
         response_details = (stringify(response) or '') if response else ''
 


Test patch:
Repository: conda/conda

Issue:
conda fails if a user's home directory doesn't exist
In certain applications that we support, it is possible that a user does not have a home directory within which to create `~/.conda`. This is causing a fatal error in the `append_env`  method [here](https://github.com/conda/conda/blob/master/conda/misc.py#L185-L193).

Note that this function is already designed to fail silently if there is an `IOError`. However, if the home directory itself does not exist, the `os.mkdir` command fails with an `OSError` instead. I would suggest that this exception type be included in the `except` line as well.


Discussion:

Resolving patch:
diff --git a/conda/misc.py b/conda/misc.py
--- a/conda/misc.py
+++ b/conda/misc.py
@@ -198,7 +198,7 @@ def append_env(prefix):
             os.mkdir(dir_path)
         with open(join(dir_path, 'environments.txt'), 'a') as f:
             f.write('%s\n' % prefix)
-    except IOError:
+    except (IOError, OSError):
         pass
 
 


Test patch:
Repository: conda/conda

Issue:
`conda list` doesn't have column headers
The `conda list` command outputs 3 columns of data for which there are no column headers. The first appears to be `package name`, the second `version`, the third is possibly `feature+build number`? It would be great to have these headers added and could be done so in the already hash-prefixed lines so as not to upset filters/pipes relying on the package list format. Thanks.



Discussion:
In addition, what would be the fourth column?


Resolving patch:
diff --git a/conda/cli/main_list.py b/conda/cli/main_list.py
--- a/conda/cli/main_list.py
+++ b/conda/cli/main_list.py
@@ -39,6 +39,12 @@ def list_packages(prefix, installed, regex=None, format='human',
                   show_channel_urls=None):
     res = 0
     result = []
+
+    if format == 'human':
+        result.append('# packages in environment at %s:' % prefix)
+        result.append('#')
+        result.append('# %-23s %-15s %15s  Channel' % ("Name", "Version", "Build"))
+
     for dist in get_packages(installed, regex):
         if format == 'canonical':
             result.append(dist)
@@ -73,9 +79,6 @@ def print_packages(prefix, regex=None, format='human', piplist=False,
         raise EnvironmentLocationNotFound(prefix)
 
     if not json:
-        if format == 'human':
-            print('# packages in environment at %s:' % prefix)
-            print('#')
         if format == 'export':
             print_export_header(context.subdir)
 
@@ -88,10 +91,12 @@ def print_packages(prefix, regex=None, format='human', piplist=False,
 
     exitcode, output = list_packages(prefix, installed, regex, format=format,
                                      show_channel_urls=show_channel_urls)
-    if not json:
-        print('\n'.join(map(text_type, output)))
-    else:
+    if context.json:
         stdout_json(output)
+
+    else:
+        print('\n'.join(map(text_type, output)))
+
     return exitcode
 
 


Test patch:
diff --git a/tests/test_create.py b/tests/test_create.py
--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -546,7 +546,7 @@ def test_create_empty_env(self):
             stderr = list_output[1]
             expected_output = """# packages in environment at %s:
 #
-
+# Name                    Version                   Build  Channel
 """ % prefix
             self.assertEqual(stdout, expected_output)
             self.assertEqual(stderr, '')
Repository: conda/conda

Issue:
Change default value for 'allow_softlinks' from True to False
The `allow_softlinks` configuration parameter can be dangerous.  Softlinks into prefixes directly from the package cache will often lead to environment corruption.  It was an oversight that the default value for `allow_softlinks` is set to `True`.  In conda 4.4, we should definitely change the default value to `False`.  We should also consider it even for the next 4.3.x release.


Discussion:

Resolving patch:
diff --git a/conda/base/context.py b/conda/base/context.py
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -87,7 +87,7 @@ def ssl_verify_validation(value):
 class Context(Configuration):
 
     add_pip_as_python_dependency = PrimitiveParameter(True)
-    allow_softlinks = PrimitiveParameter(True)
+    allow_softlinks = PrimitiveParameter(False)
     auto_update_conda = PrimitiveParameter(True, aliases=('self_update',))
     clobber = PrimitiveParameter(False)
     changeps1 = PrimitiveParameter(True)


Test patch:
Repository: conda/conda

Issue:
Change default value for 'allow_softlinks' from True to False
The `allow_softlinks` configuration parameter can be dangerous.  Softlinks into prefixes directly from the package cache will often lead to environment corruption.  It was an oversight that the default value for `allow_softlinks` is set to `True`.  In conda 4.4, we should definitely change the default value to `False`.  We should also consider it even for the next 4.3.x release.
Change default value for 'allow_softlinks' from True to False
The `allow_softlinks` configuration parameter can be dangerous.  Softlinks into prefixes directly from the package cache will often lead to environment corruption.  It was an oversight that the default value for `allow_softlinks` is set to `True`.  In conda 4.4, we should definitely change the default value to `False`.  We should also consider it even for the next 4.3.x release.


Discussion:

Resolving patch:
diff --git a/conda/base/context.py b/conda/base/context.py
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -72,7 +72,7 @@ def ssl_verify_validation(value):
 class Context(Configuration):
 
     add_pip_as_python_dependency = PrimitiveParameter(True)
-    allow_softlinks = PrimitiveParameter(True)
+    allow_softlinks = PrimitiveParameter(False)
     auto_update_conda = PrimitiveParameter(True, aliases=('self_update',))
     clobber = PrimitiveParameter(False)
     changeps1 = PrimitiveParameter(True)


Test patch:
Repository: conda/conda

Issue:
bump repodata pickle version in 4.3.x



Discussion:

Resolving patch:
diff --git a/conda/core/repodata.py b/conda/core/repodata.py
--- a/conda/core/repodata.py
+++ b/conda/core/repodata.py
@@ -54,7 +54,7 @@
 dotlog = getLogger('dotupdate')
 stderrlog = getLogger('stderrlog')
 
-REPODATA_PICKLE_VERSION = 1
+REPODATA_PICKLE_VERSION = 2
 REPODATA_HEADER_RE = b'"(_etag|_mod|_cache_control)":[ ]?"(.*?[^\\\\])"[,\}\s]'
 
 


Test patch:
Repository: conda/conda

Issue:
Fix prefix data cache with rm_rf for conda-build on windows
As reported by @mingwandroid:

conda-build uses rd on Windows to remove the prefix before calling `rm_rf`, so we need conda to forget about the installed packages.
Fix prefix data cache with rm_rf for conda-build on windows
As reported by @mingwandroid:

conda-build uses rd on Windows to remove the prefix before calling `rm_rf`, so we need conda to forget about the installed packages.


Discussion:

Resolving patch:
diff --git a/conda/gateways/disk/delete.py b/conda/gateways/disk/delete.py
--- a/conda/gateways/disk/delete.py
+++ b/conda/gateways/disk/delete.py
@@ -49,6 +49,8 @@ def rm_rf(path, max_retries=5, trash=True):
                 log.info("Failed to remove %s.", path)
         else:
             log.trace("rm_rf failed. Not a link, file, or directory: %s", path)
+            from ...core.linked_data import delete_prefix_from_linked_data
+            delete_prefix_from_linked_data(path)
         return True
     finally:
         from ...core.linked_data import delete_prefix_from_linked_data


Test patch:
diff --git a/tests/test_create.py b/tests/test_create.py
--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -456,6 +456,19 @@ def test_list_with_pip_wheel(self):
             rm_rf(join(prefix, get_python_site_packages_short_path("3.5")), "os.py")
             assert prefix not in linked_data_
 
+        # regression test for #5980, related to #5847
+        with make_temp_env() as prefix:
+            assert isdir(prefix)
+            assert prefix in linked_data_
+
+            rmtree(prefix)
+            assert not isdir(prefix)
+            assert prefix in linked_data_
+
+            rm_rf(prefix)
+            assert not isdir(prefix)
+            assert prefix not in linked_data_
+
     def test_install_tarball_from_local_channel(self):
         # Regression test for #2812
         # install from local channel
Repository: conda/conda

Issue:
CondaError: Cannot link a source that does not exist. C:\Users\...\Anaconda3\Scripts\conda.exe
I get this error when trying to conda install tqdm. Pip install works fine. However, when trying conda install spacy, I still get the same error because the conda installation for spacy attempts to conda install tqdm.   


Discussion:
Do you still get the error after running `conda clean --all --yes`?
If you need additional help, please include more details.  At a minimum, `conda info`, the command that gave the error, and the full stack trace.  Whatever details are necessary to independently reproduce the issue you're seeing.
Thanks @kalefranz. I had tried `Conda clean --all`. The error went away when I updated everything with `conda update anaconda `
Had the same error and @AVSuni thank you so much! Also thanks to @kalefranz  (it occured when installing spacy)

Resolving patch:
diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py
--- a/conda/gateways/disk/create.py
+++ b/conda/gateways/disk/create.py
@@ -238,7 +238,8 @@ def create_link(src, dst, link_type=LinkType.hardlink, force=False):
         return
 
     if not lexists(src):
-        raise CondaError("Cannot link a source that does not exist. %s" % src)
+        raise CondaError("Cannot link a source that does not exist. %s\n"
+                         "Running `conda clean --packages` may resolve your problem." % src)
 
     if lexists(dst):
         if not force:


Test patch: