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

Issue:
Conda error while creating anaconda with python2.7
I've Anaconda 3 already installed, now I'm trying to create anaconda with python 2.7 version. But I'm getting below error.

Windows 8

`$ C:\Users\Karthick\Anaconda3\Scripts\conda-script.py create -n py27 python=2.7
 anaconda`




    Traceback (most recent call last):
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\exceptions.py",
line 591, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\cli\main.py", li
ne 134, in _main
        exit_code = args.func(args, p)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\cli\main_create.
py", line 68, in execute
        install(args, parser, 'create')
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\cli\install.py",
 line 359, in install
        execute_actions(actions, index, verbose=not context.quiet)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\plan.py", line 8
23, in execute_actions
        execute_instructions(plan, index, verbose)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\instructions.py"
, line 247, in execute_instructions
        cmd(state, arg)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\instructions.py"
, line 107, in UNLINKLINKTRANSACTION_CMD
        txn = UnlinkLinkTransaction.create_from_dists(index, prefix, unlink_dist
s, link_dists)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\core\link.py", l
ine 123, in create_from_dists
        for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link))
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\core\link.py", l
ine 123, in <genexpr>
        for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link))
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\gateways\disk\re
ad.py", line 86, in read_package_info
        index_json_record = read_index_json(extracted_package_directory)
      File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\gateways\disk\re
ad.py", line 105, in read_index_json
        with open(join(extracted_package_directory, 'info', 'index.json')) as fi
:
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Karthick
\\Anaconda3\\pkgs\\babel-2.3.4-py27_0\\info\\index.json'


Discussion:
`conda clean --packages` should fix your issue.  I'm working on a PR to prevent this from happening in general.

Resolving patch:
diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py
--- a/conda/core/package_cache.py
+++ b/conda/core/package_cache.py
@@ -92,7 +92,8 @@ def is_fetched(self):
 
     @property
     def is_extracted(self):
-        return isdir(self.extracted_package_dir)
+        epd = self.extracted_package_dir
+        return isdir(epd) and isfile(join(epd, 'info', 'index.json'))
 
     @property
     def tarball_basename(self):


Test patch:
Repository: conda/conda

Issue:
Error in DirectoryNotFoundError
Commit 1f430607 has broken the class DirectoryNotFoundError. Example to trigger the code path calling DirectoryNotFoundError():

    (root) [root@833f44c1b4d6 ~]# conda create -n starlord --clone /path/to/vanishing/point

Current conda install:

               platform : linux-64
          conda version : 4.3.15
       conda is private : False
      conda-env version : 4.3.15
    conda-build version : not installed
         python version : 3.6.0.final.0
       requests version : 2.12.4
       root environment : /conda  (writable)
    default environment : /conda
       envs directories : /conda/envs
                          /root/.conda/envs
          package cache : /conda/pkgs
                          /root/.conda/pkgs
           channel URLs : 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 file : /root/.condarc
           offline mode : False
             user-agent : conda/4.3.15 requests/2.12.4 CPython/3.6.0 Linux/4.8.6-300.fc25.x86_64 CentOS/6.8 glibc/2.12
                UID:GID : 0:0



`$ /conda/bin/conda create -n starlord --clone /path/to/vanishing/point`




    Traceback (most recent call last):
      File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 591, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/conda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main
        exit_code = args.func(args, p)
      File "/conda/lib/python3.6/site-packages/conda/cli/main_create.py", line 68, in execute
        install(args, parser, 'create')
      File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 212, in install
        clone(args.clone, prefix, json=context.json, quiet=context.quiet, index_args=index_args)
      File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 57, in clone
        raise DirectoryNotFoundError(src_arg, 'no such directory: %s' % src_arg, json)
    TypeError: __init__() takes 2 positional arguments but 4 were given



Discussion:
Thanks Nehal.
@tyler-thetyrant Can you take this one?
@kalefranz Yup. Looking into it. 

Resolving patch:
diff --git a/conda/cli/install.py b/conda/cli/install.py
--- a/conda/cli/install.py
+++ b/conda/cli/install.py
@@ -54,7 +54,7 @@ def clone(src_arg, dst_prefix, json=False, quiet=False, index_args=None):
     if os.sep in src_arg:
         src_prefix = abspath(src_arg)
         if not isdir(src_prefix):
-            raise DirectoryNotFoundError(src_arg, 'no such directory: %s' % src_arg, json)
+            raise DirectoryNotFoundError(src_arg)
     else:
         src_prefix = context.clone_src
 


Test patch:
Repository: conda/conda

Issue:
When lacking permissions to write, clone message should quote prefix.
When trying to install a new package into a location that the user lacks write permissions (read-only root), conda helpfully suggests cloning the environment into a new location:

```
CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda
#
# You don't appear to have the necessary permissions to install packages
# into the install area 'C:\Program Files\Anaconda'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_deathstar --clone=C:\Program Files\Anaconda\envs\deathstar
```
As shown in the example above, this clone path may include spaces. This will be particularly common on Windows, where a global install will result in files written to Program Files, which a non-administrator user will not be able to write to, and contains spaces. Because the command presents a prefix, it should be quoted to guard against this case.




Discussion:

Resolving patch:
diff --git a/conda/cli/help.py b/conda/cli/help.py
--- a/conda/cli/help.py
+++ b/conda/cli/help.py
@@ -35,7 +35,7 @@ def root_read_only(command, prefix, json=False):
 # then make changes to it.
 # This may be done using the command:
 #
-# $ conda create -n my_${name} --clone=${prefix}
+# $ conda create -n my_${name} --clone="${prefix}"
 """
     msg = msg.replace('${root_dir}', context.root_prefix)
     msg = msg.replace('${prefix}', prefix)


Test patch:
Repository: conda/conda

Issue:
add timestamp metadata for tiebreaking conda-build 3 hashed packages



Discussion:

Resolving patch:
diff --git a/conda/models/index_record.py b/conda/models/index_record.py
--- a/conda/models/index_record.py
+++ b/conda/models/index_record.py
@@ -99,6 +99,7 @@ class IndexRecord(DictSafeMixin, Entity):
     requires = ListField(string_types, required=False)
     size = IntegerField(required=False)
     subdir = StringField(required=False)
+    timestamp = IntegerField(required=False)
     track_features = StringField(required=False)
     version = StringField()
 
diff --git a/conda/resolve.py b/conda/resolve.py
--- a/conda/resolve.py
+++ b/conda/resolve.py
@@ -532,8 +532,9 @@ def version_key(self, dist, vtype=None):
         ver = normalized_version(rec.get('version', ''))
         bld = rec.get('build_number', 0)
         bs = rec.get('build_string')
-        return ((valid, -cpri, ver, bld, bs) if context.channel_priority else
-                (valid, ver, -cpri, bld, bs))
+        ts = rec.get('timestamp', 0)
+        return ((valid, -cpri, ver, bld, bs, ts) if context.channel_priority else
+                (valid, ver, -cpri, bld, bs, ts))
 
     def features(self, dist):
         return set(self.index[dist].get('features', '').split())
@@ -654,16 +655,24 @@ def generate_version_metrics(self, C, specs, include0=False):
         for name, targets in iteritems(sdict):
             pkgs = [(self.version_key(p), p) for p in self.groups.get(name, [])]
             pkey = None
+            # keep in mind that pkgs is already sorted according to version_key (a tuple,
+            #    so composite sort key).  Later entries in the list are, by definition,
+            #    greater in some way, so simply comparing with != suffices.
             for version_key, dist in pkgs:
                 if targets and any(dist == t for t in targets):
                     continue
                 if pkey is None:
                     iv = ib = 0
+                # any version number mismatch (each character compared one by one)
                 elif any(pk != vk for pk, vk in zip(pkey[:3], version_key[:3])):
                     iv += 1
                     ib = 0
+                # build number
                 elif pkey[3] != version_key[3]:
                     ib += 1
+                # last field is timestamp. Use it as differentiator when build numbers are similar
+                elif pkey[5] != version_key[5]:
+                    ib += 1
 
                 if iv or include0:
                     eqv[dist.full_name] = iv


Test patch:
Repository: conda/conda

Issue:
typify for str + NoneType is wrong
https://github.com/conda/conda/pull/5107#issuecomment-296356913

It still seems to me as if `typify()` is doing something wrong:
```python
>>> from conda._vendor.auxlib.configuration import typify
>>> typify('false', str)
'false'
>>> typify('false', (str, type(None)))
'False'
```
Why should addition of type `None` introduce such a change? The code flow is:

```python
elif not (type_hint - (STRING_TYPES_SET | {NoneType})):
    value = typify_str_no_hint(text_type(value))
    return None if value is None else text_type(value)
```

I wonder why not just return `text_type(value)`? Why call `typify_str_no_hint`?
typify for str + NoneType is wrong
https://github.com/conda/conda/pull/5107#issuecomment-296356913

It still seems to me as if `typify()` is doing something wrong:
```python
>>> from conda._vendor.auxlib.configuration import typify
>>> typify('false', str)
'false'
>>> typify('false', (str, type(None)))
'False'
```
Why should addition of type `None` introduce such a change? The code flow is:

```python
elif not (type_hint - (STRING_TYPES_SET | {NoneType})):
    value = typify_str_no_hint(text_type(value))
    return None if value is None else text_type(value)
```

I wonder why not just return `text_type(value)`? Why call `typify_str_no_hint`?


Discussion:

Resolving patch:
diff --git a/conda/_vendor/auxlib/type_coercion.py b/conda/_vendor/auxlib/type_coercion.py
--- a/conda/_vendor/auxlib/type_coercion.py
+++ b/conda/_vendor/auxlib/type_coercion.py
@@ -231,8 +231,8 @@ def typify(value, type_hint=None):
         elif not (type_hint - (STRING_TYPES_SET | {bool})):
             return boolify(value, return_string=True)
         elif not (type_hint - (STRING_TYPES_SET | {NoneType})):
-            value = typify_str_no_hint(text_type(value))
-            return None if value is None else text_type(value)
+            value = text_type(value)
+            return None if value.lower() == 'none' else value
         elif not (type_hint - {bool, int}):
             return typify_str_no_hint(text_type(value))
         else:


Test patch:
diff --git a/tests/base/test_context.py b/tests/base/test_context.py
--- a/tests/base/test_context.py
+++ b/tests/base/test_context.py
@@ -170,7 +170,7 @@ def test_proxy_servers(self):
         assert context.proxy_servers['ftp'] is None
         assert context.proxy_servers['sftp'] == ''
         assert context.proxy_servers['ftps'] == 'False'
-        assert context.proxy_servers['rsync'] == 'False'
+        assert context.proxy_servers['rsync'] == 'false'
 
     def test_conda_build_root_dir(self):
         assert context.conda_build['root-dir'] == "/some/test/path"
Repository: conda/conda

Issue:
export toposort for conda-build

export toposort for conda-build



Discussion:

Resolving patch:
diff --git a/conda/exports.py b/conda/exports.py
--- a/conda/exports.py
+++ b/conda/exports.py
@@ -30,6 +30,9 @@
 from .gateways.connection import CondaSession  # NOQA
 CondaSession = CondaSession
 
+from .common.toposort import _toposort
+_toposort = _toposort
+
 from .gateways.disk.link import lchmod  # NOQA
 lchmod = lchmod
 


Test patch:
Repository: conda/conda

Issue:
conda info in 4.3.17 has a spacing offset problem
```
$ ❯ /conda4/bin/conda info
    Current conda install:

                   platform : osx-64
              conda version : 4.3.17
           conda is private : False
          conda-env version : 4.3.17
        conda-build version : 2.1.9
             python version : 2.7.13.final.0
           requests version : 2.12.4
           root environment : /conda4  (writable)
        default environment : /conda4
           envs directories : /conda4/envs
                          /Users/kfranz/.conda/envs
              package cache : /conda4/pkgs
                          /Users/kfranz/.conda/pkgs
               channel URLs : https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
                config file : /Users/kfranz/.condarc
               offline mode : False
                 user-agent : conda/4.3.17 requests/2.12.4 CPython/2.7.13 Darwin/16.5.0 OSX/10.12.4
                    UID:GID : 502:20
```


Discussion:

Resolving patch:
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py
--- a/conda/cli/main_info.py
+++ b/conda/cli/main_info.py
@@ -248,12 +248,14 @@ def get_info_dict(system=False):
 
 
 def get_main_info_str(info_dict):
+    from .._vendor.auxlib.ish import dals
+
     for key in 'pkgs_dirs', 'envs_dirs', 'channels':
         info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
     info_dict['_rtwro'] = ('writable' if info_dict['root_writable'] else 'read only')
 
     builder = []
-    builder.append("""\
+    builder.append(dals("""
     Current conda install:
 
                    platform : %(platform)s
@@ -271,12 +273,10 @@ def get_main_info_str(info_dict):
                 config file : %(rc_path)s
                offline mode : %(offline)s
                  user-agent : %(user_agent)s\
-    """ % info_dict)
+    """) % info_dict)
 
     if not on_win:
-        builder.append("""\
-                    UID:GID : %(UID)s:%(GID)s
-    """ % info_dict)
+        builder.append("                UID:GID : %(UID)s:%(GID)s" % info_dict)
     else:
         builder.append("")
 


Test patch:
Repository: conda/conda

Issue:
Incorrectly detected arch on aarch64
As per the title, conda currently only knows about the usual x86, x86_64 and armv7l architectures. Since aarch64 systems are compatible with armhf binaries, conda just needs to alias 'aarch64' to 'armv7l'.

The only hitch involved in approaching the problem via such an alias is that the armhf linker (ld-linux-armhf) may not be installed - its a rare situation currently, since most ARM systems opt for a 64bit kernel/32 bit userspace due to the rarity of 64 bit ARM binaries. The user (with sudo privileges) would need to install the linker in such a situation.

See [PR 4809](https://github.com/conda/conda/pull/4809) for implementation.


Discussion:

Resolving patch:
diff --git a/conda/base/constants.py b/conda/base/constants.py
--- a/conda/base/constants.py
+++ b/conda/base/constants.py
@@ -52,6 +52,7 @@
                         "linux-ppc64le",
                         "linux-armv6l",
                         "linux-armv7l",
+                        "linux-aarch64",
                         "zos-z",
                         "noarch",
                         )
diff --git a/conda/base/context.py b/conda/base/context.py
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -46,6 +46,7 @@
 non_x86_linux_machines = {
     'armv6l',
     'armv7l',
+    'aarch64',
     'ppc64le',
 }
 _arch_names = {
diff --git a/conda/models/enums.py b/conda/models/enums.py
--- a/conda/models/enums.py
+++ b/conda/models/enums.py
@@ -17,6 +17,7 @@ class Arch(Enum):
     x86_64 = 'x86_64'
     armv6l = 'armv6l'
     armv7l = 'armv7l'
+    aarch64 = 'aarch64'
     ppc64le = 'ppc64le'
     z = 'z'
 


Test patch:
Repository: conda/conda

Issue:
change results from conda update --all 
I run my conda update commands in a script and have to wade through the entire list of installed packages to see results. Is it possible to default the results from the update command to `# All requested packages already installed.` without the list?

Thanks
change results from conda update --all 
I run my conda update commands in a script and have to wade through the entire list of installed packages to see results. Is it possible to default the results from the update command to `# All requested packages already installed.` without the list?

Thanks


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
@@ -10,7 +10,6 @@
 import logging
 import os
 from os.path import abspath, basename, exists, isdir, join
-import re
 
 from . import common
 from .._vendor.auxlib.ish import dals
@@ -321,10 +320,7 @@ def install(args, parser, command='install'):
         if context.json:
             common.stdout_json_success(message='All requested packages already installed.')
         else:
-            from .main_list import print_packages
-            spec_regex = r'^(%s)$' % '|'.join(re.escape(s.split()[0]) for s in ospecs)
-            print('\n# All requested packages already installed.')
-            print_packages(prefix, spec_regex)
+            print('\n# All requested packages already installed.\n')
         return
 
     if not context.json:


Test patch:
Repository: conda/conda

Issue:
conda remove --all behavior changed in 4.2.7
`conda remove --all` used to remove an environment if it existed, and quietly succeed if it was already gone. Now this command fails when the environment does not exist. This makes something formerly easy to do in an automated way now difficult especially in a cross-platform way on Windows.

```
C:\>conda remove --all -n nonenv
CondaEnvironmentNotFoundError: Could not find environment: nonenv .
You can list all discoverable environments with `conda info --envs`.



C:\>echo %ERRORLEVEL%
1
```

Just suppressing the error is not appealing, because there are many error modes different from the environment not existing that should trigger a failure.



Discussion:
Still exists in conda 4.3.x

```
kfranz@0283:~/continuum/conda *4.3.x ❯ python -m conda remove --all -n flub

CondaEnvironmentNotFoundError: Could not find environment: flub .
You can list all discoverable environments with `conda info --envs`.

```

I hate that we didn't get to this sooner.  At this point, I don't know if we should change it in the 4.3.x branch.  I'm happy to revert the behavior in 4.4 though.

Resolving patch:
diff --git a/conda/cli/main_remove.py b/conda/cli/main_remove.py
--- a/conda/cli/main_remove.py
+++ b/conda/cli/main_remove.py
@@ -9,7 +9,7 @@
 from argparse import RawDescriptionHelpFormatter
 from collections import defaultdict
 import logging
-from os.path import abspath, join
+from os.path import abspath, join, isdir
 import sys
 
 from .conda_argparse import (add_parser_channels, add_parser_help, add_parser_json,
@@ -130,6 +130,10 @@ def execute(args, parser):
     if args.all and prefix == context.default_prefix:
         msg = "cannot remove current environment. deactivate and run conda remove again"
         raise CondaEnvironmentError(msg)
+    if args.all and not isdir(prefix):
+        # full environment removal was requested, but environment doesn't exist anyway
+        return 0
+
     ensure_use_local(args)
     ensure_override_channels_requires_channel(args)
     if not args.features and args.all:


Test patch:
diff --git a/tests/test_create.py b/tests/test_create.py
--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -1126,6 +1126,9 @@ def test_force_remove(self):
             stdout, stderr = run_command(Commands.REMOVE, prefix, "flask")
             assert not package_is_installed(prefix, "flask-")
 
+        # regression test for #3489
+        # don't raise for remove --all if environment doesn't exist
+        run_command(Commands.REMOVE, prefix, "--all")
 
     def test_transactional_rollback_simple(self):
         from conda.core.path_actions import CreateLinkedPackageRecordAction
Repository: conda/conda

Issue:
conda config stack trace when can't write config file
This situation should be handled nicer. `conda config` doesn't have permission to write the config file.  

Thanks.

```
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

    https://github.com/conda/conda/issues

Include the output of the command 'conda info' in your report.


Traceback (most recent call last):
  File "/opt/anaconda/bin/conda", line 5, in <module>
    sys.exit(main())
  File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 179, in main
    args.func(args, p)
  File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main_config.py", line 339, in execute
    with open(rc_path, 'w') as rc:
IOError: [Errno 13] Permission denied: '/opt/anaconda/.condarc'
```

<!---
@huboard:{"order":9.781875224740546e-29,"custom_state":""}
-->



Discussion:

Resolving patch:
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py
--- a/conda/cli/main_config.py
+++ b/conda/cli/main_config.py
@@ -423,8 +423,12 @@ def clean_element_type(element_types):
 
     # config.rc_keys
     if not args.get:
-        with open(rc_path, 'w') as rc:
-            rc.write(yaml_dump(rc_config))
+        try:
+            with open(rc_path, 'w') as rc:
+                rc.write(yaml_dump(rc_config))
+        except (IOError, OSError) as e:
+            raise CondaError('Cannot write to condarc file at %s\n'
+                             'Caused by %r' % (rc_path, e))
 
     if context.json:
         stdout_json_success(


Test patch: