Rene Duchamp
Rene Duchamp

Reputation: 2629

Anaconda Python: conda update resulted in AssertionError() and No module named 'conda_package_handling'

I tried to update the conda to the latest version using the following command:

(base) PS C:\> conda update -n base -c defaults conda
Preparing transaction: done
Verifying transaction: done
Executing transaction: - DEBUG menuinst_win32:__init__(199): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\username\AppData\Local\Continuum\anaconda3', env_name: 'None', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(323): Shortcut cmd is C:\Users\username\AppData\Local\Continuum\anaconda3\python.exe, args are ['C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3\\cwp.py', 'C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3', 'C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3\\python.exe', 'C:\\Users\\username\\AppData\\Local\\Continuum\\anaconda3\\Scripts\\jupyter-notebook-script.py', '"%USERPROFILE%/"']
done
Rolling back transaction: done

AssertionError()
()
AssertionError()
AssertionError()

After this point, the base anaconda python seems to be broken and anything to do with usual conda commands seems to return the same No module named 'conda_package_handling' error. How do I fix this, please advise.

For instance:

(base) PS C:\> conda list
Error processing line 1 of C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib-3.1.0-py3.7-nspkg.pth:

  Traceback (most recent call last):
    File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 580, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 80, in do_call
    module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main_list.py", line 14, in <module>
    from ..core.prefix_data import PrefixData
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\prefix_data.py", line 24, in <module>
    from ..gateways.disk.create import write_as_json_to_file
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 17, in <module>
    import conda_package_handling.api
ModuleNotFoundError: No module named 'conda_package_handling'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\Scripts\conda-script.py", line 12, in <module>
    sys.exit(main())
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1190, in print_unexpected_error_report
    from .cli.main_info import get_env_vars_str, get_main_info_str
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
ModuleNotFoundError: No module named 'conda_package_handling'

Upvotes: 2

Views: 1439

Answers (1)

merv
merv

Reputation: 77117

This seems to be an ongoing issue. Unfortunately, it seems most users end up having to reinstall to resolve it.

Upvotes: 2

Related Questions