Repository: conda/conda

Issue:
Cannot open Anaconda Navigator
I have an issue when I try to open the Navigator.  It throws an unexpected error occurred.

`An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

    https://github.com/conda/conda/issues



Current conda install:

               platform : win-64
          conda version : 4.3.21
       conda is private : False
      conda-env version : 4.3.21
    conda-build version : not installed
         python version : 3.6.1.final.0
       requests version : 2.14.2
       root environment : C:\Anaconda3  (writable)
    default environment : C:\Anaconda3
       envs directories : C:\Anaconda3\envs
                          C:\Users\John\AppData\Local\conda\conda\envs
                          C:\Users\John\.conda\envs
          package cache : C:\Anaconda3\pkgs
                          C:\Users\John\AppData\Local\conda\conda\pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/win-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/win-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://repo.continuum.io/pkgs/msys2/win-64
                          https://repo.continuum.io/pkgs/msys2/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.21 requests/2.14.2 CPython/3.6.1 Windows/10 Windows/10.0.15063
          administrator : False

`$ C:\Anaconda3\Scripts\conda-script.py ..checkenv cmd.exe C:\Anaconda3`




    Traceback (most recent call last):
      File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 167, in main
        import conda.cli.activate as activate
      File "C:\Anaconda3\lib\site-packages\conda\cli\activate.py", line 12, in <module>
        from ..utils import shells
      File "C:\Anaconda3\lib\site-packages\conda\utils.py", line 13, in <module>
        from .gateways.disk.read import compute_md5sum
      File "C:\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 22, in <module>
        from ...models.channel import Channel
      File "C:\Anaconda3\lib\site-packages\conda\models\channel.py", line 9, in <module>
        from ..base.context import context
      File "C:\Anaconda3\lib\site-packages\conda\base\context.py", line 18, in <module>
        from .._vendor.auxlib.path import expand
      File "C:\Anaconda3\lib\site-packages\conda\_vendor\auxlib\path.py", line 8, in <module>
        import pkg_resources
      File "<frozen importlib._bootstrap>", line 961, in _find_and_load
      File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2985, in <module>
        @_call_aside
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2971, in _call_aside
        f(*args, **kwargs)
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 3013, in _initialize_master_working_set
        dist.activate(replace=False)
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2544, in activate
        declare_namespace(pkg)
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2118, in declare_namespace
        _handle_ns(packageName, path_item)
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2058, in _handle_ns
        _rebuild_mod_path(path, packageName, module)
      File "C:\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2087, in _rebuild_mod_path
        orig_path.sort(key=position_in_sys_path)
    AttributeError: '_NamespacePath' object has no attribute 'sort'`


Discussion:
Related to #5500.

Resolving patch:
diff --git a/conda/core/repodata.py b/conda/core/repodata.py
--- a/conda/core/repodata.py
+++ b/conda/core/repodata.py
@@ -51,7 +51,7 @@
 log = getLogger(__name__)
 stderrlog = getLogger('conda.stderrlog')
 
-REPODATA_PICKLE_VERSION = 6
+REPODATA_PICKLE_VERSION = 16
 REPODATA_HEADER_RE = b'"(_etag|_mod|_cache_control)":[ ]?"(.*?[^\\\\])"[,\}\s]'
 
 
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
@@ -26,7 +26,7 @@
 from .enums import FileMode, LinkType, NoarchType, PackageType, PathType, Platform
 from .._vendor.auxlib.collection import frozendict
 from .._vendor.auxlib.entity import (BooleanField, ComposableField, DictSafeMixin, Entity,
-                                     EnumField, IntegerField, ListField, MapField,
+                                     EnumField, IntegerField, ListField, MapField, NumberField,
                                      StringField)
 from ..base.context import context
 from ..common.compat import isiterable, iteritems, itervalues, string_types, text_type
@@ -48,6 +48,15 @@ def box(self, instance, instance_type, val):
         return super(NoarchField, self).box(instance, instance_type, NoarchType.coerce(val))
 
 
+class TimestampField(NumberField):
+
+    def box(self, instance, instance_type, val):
+        val = super(TimestampField, self).box(instance, instance_type, val)
+        if val and val > 253402300799:  # 9999-12-31
+            val /= 1000  # convert milliseconds to seconds; see conda/conda-build#1988
+        return val
+
+
 class Link(DictSafeMixin, Entity):
     source = StringField()
     type = LinkTypeField(LinkType, required=False)


Test patch:
diff --git a/tests/conda_env/test_create.py b/tests/conda_env/test_create.py
--- a/tests/conda_env/test_create.py
+++ b/tests/conda_env/test_create.py
@@ -133,5 +133,9 @@ def test_create_advanced_pip(self):
                 assert exists(python_path)
                 assert_package_is_installed(prefix, 'argh', exact=False, pip=True)
                 assert_package_is_installed(prefix, 'module-to-install-in-editable-mode', exact=False, pip=True)
-                assert_package_is_installed(prefix, 'six', exact=False, pip=True)
+                try:
+                    assert_package_is_installed(prefix, 'six', exact=False, pip=True)
+                except AssertionError:
+                    # six may now be conda-installed because of packaging changes
+                    assert_package_is_installed(prefix, 'six', exact=False, pip=False)
                 assert_package_is_installed(prefix, 'xmltodict-0.10.2-<pip>', exact=True, pip=True)