Anaconda Prompt will not start _NamespacePath

2019-06-21 05:21发布

问题:

I have an odd error that I can't find a solution to. Everytime I start the Anaconda Prompt (running Windows 10) I get the following error at the bottom. Even if I try to use conda I get the same error (after the install information). I tried uninstalling and reinstalling Anaconda and even Python. I never had a problem with Anaconda until today.

Thanks, Bob

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\conda-script.py", line 5, in <module>
    sys.exit(conda.cli.main())
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 151, in main
    activate.main()
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\activate.py", line 118, in main
    from conda.utils import shells
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\utils.py", line 13, in <module>
    from .gateways.disk.read import compute_md5sum
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 22, in <module>
    from ...models.channel import Channel
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\models\channel.py", line 9, in <module>
    from ..base.context import context
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 19, in <module>
    from .._vendor.auxlib.path import expand
  File "C:\ProgramData\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:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2985, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2971, in _call_aside
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 3013, in _initialize_master_working_set
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2544, in activate
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2118, in declare_namespace
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2058, in _handle_ns
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2087, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'

Current conda install:

           platform : win-64
      conda version : 4.3.14
   conda is private : False
  conda-env version : 4.3.14
conda-build version : not installed
     python version : 3.6.0.final.0
   requests version : 2.12.4
   root environment : C:\ProgramData\Anaconda3  (read only)
default environment : C:\ProgramData\Anaconda3
   envs directories : C:\ProgramData\Anaconda3\envs
                      C:\Users\auser\AppData\Local\conda\conda\envs
                      C:\Users\auser\.conda\envs
      package cache : C:\ProgramData\Anaconda3\pkgs
                      C:\Users\auser\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
       offline mode : False
         user-agent : conda/4.3.14 requests/2.12.4 CPython/3.6.0 Windows/10 Windows/10.0.15063

回答1:

i have solved it by clone source code of pip and setuptools. Then, install it using

python setup.py install

via Anaconda Prompt. Note: Install packages in order setuptools -> pip. With setuptools run python bootstrap.py before install it.