2

I have created conda environments in the past without any problems. So, even this time I proceeded to create one.
conda create -n astropython anaconda

Next, the documentation recommended uninstalling any previous copies of astropy by running: conda uninstall astropy I did that, and now my conda is broken. If I run any command with conda, I get the following error traceback.

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 19, in get_yaml
    import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 22, in get_yaml
    import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 74, in _main
    from ..base.context import context
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 28, in <module>
    from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 40, in <module>
    from .serialize import yaml_load
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 30, in <module>
    yaml = get_yaml()
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
    result = func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 24, in get_yaml
    raise ImportError("No yaml library available.\n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 19, in get_yaml
    import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 22, in get_yaml
    import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/bin/conda", line 13, in <module>
    sys.exit(main())
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1175, in print_unexpected_error_report
    from .base.context import context
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 28, in <module>
    from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 40, in <module>
    from .serialize import yaml_load
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 30, in <module>
    yaml = get_yaml()
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
    result = func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 24, in get_yaml
    raise ImportError("No yaml library available.\n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml

Running conda install ruamel_yaml again spits out the same traceback. My $PATH is correct, solution to No module named ruamel did not solve the issue.

So, I looked into the files and found that there was no ruamel_yaml folder in the site-packages dir. I copied the ruamel_yaml folder from $HOME/anaconda3/pkgs/ruamel_yaml0.15.71/ to $HOME/anaconda3/lib/python3.6/site-packages/. Now, when I run any conda commands, I get the following error:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 80, in do_call
    module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
  File "/Users/vsanc/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 8, in <module>
    from .install import install
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 19, in <module>
    from ..core.index import calculate_channel_urls, get_index
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda_package_handling/api.py", line 3, in <module>
    from libarchive.exception import ArchiveError as _LibarchiveArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/entry.py", line 4, in <module>
    from ctypes import c_char_p, create_string_buffer
  File "/Users/vsanc/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
  Referenced from: /Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/bin/conda", line 13, in <module>
    sys.exit(main())
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/Users/vsanc/anaconda3/lib/python3.6/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 "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda_package_handling/api.py", line 3, in <module>
    from libarchive.exception import ArchiveError as _LibarchiveArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/entry.py", line 4, in <module>
    from ctypes import c_char_p, create_string_buffer
  File "/Users/vsanc/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
  Referenced from: /Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
  Reason: image not found
1
  • I'm having the same issue. Did you figure out the solution?
    – JAG2024
    Apr 10 '20 at 17:02
0

This might not be a popular answer, but it finally helped me after many hours of troubleshooting:

  1. Uninstall conda (I used this stack overflow solution) and also rm -rf miniconda3 in my home directory, fwiw.
  2. Reinstalled conda using data camp's tutorial.

No other solutions worked for me after lots of head banging.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.