Conda 'ImportError: no module named ruamel.yaml.comments'

Conda gives an error when I run any command with it.

Traceback (most recent call last): File "/usr/local/bin/conda", line 7, in <module> from conda.cli.main import main File "/usr/local/lib/python2.7/dist-packages/conda/cli/__init__.py", line 8, in <module> from .main import main # NOQA File "/usr/local/lib/python2.7/dist-packages/conda/cli/main.py", line 46, in <module> from ..base.context import context File "/usr/local/lib/python2.7/dist-packages/conda/base/context.py", line 18, in <module> from ..common.configuration import (Configuration, MapParameter, PrimitiveParameter, File "/usr/local/lib/python2.7/dist-packages/conda/common/configuration.py", line 40, in <module> from ruamel.yaml.comments import CommentedSeq, CommentedMap # pragma: no cover ImportError: No module named ruamel.yaml.comments 
+6
source share
5 answers

The ruamel.yaml.comments module ruamel.yaml.comments usually loaded from site-packages/ruamel/yaml/comments.py , not from site-packages/ruamel_yaml/comments.py

Conda seems to have problems with proper namespace support ( ruamel. ), Which I can only attribute so that (for now) is not fully compatible with pip . That "namespaces is a good idea" and package namespaces have been around for many years.

Assuming you can expand your conda installations with pip , you can try a typical ruamel.yaml installation with

  pip install ruamel_yaml==0.11.14 

Normally, I would not recommend such an old version, but most likely it will work in conjunction with the conda version, which itself uses itself.

An alternative would be to switch to using python and pip without conda, so you can just use the latest software from PyPI.

+7
source

Try sudo pip install ruamel_yaml

+4
source

Try pip install ruamel.yaml

This works for me.

+4
source

I went into this file:

 /anaconda2/lib/python2.7/site-packages/dateparser/utils/__init__.py 

edited this line:

 import ruamel.yaml as yaml 

to read

 import ruamel_yaml as yaml 

Changing the dot to underline worked for me ... I hope this works for you.

+1
source

This answer did not help me. I had to do a new installation of the core conda components, as described in the Conda section here . Copy and paste below:

Problem: my conda is broken and I want to fix it without blowing off the current installation I get a conda error and want to reinstall Miniconda to fix it, but when I try it gives me an error that Miniconda (or Anaconda) is already installed and won't let me continue. I want to force install.

Resolution: Install Miniconda using the -f (force) option Download and install the appropriate Miniconda for your operating system on the Miniconda download page using the force or -f option, as shown below:

 bash Miniconda3-latest-MacOSX-x86_64.sh -f 

NOTE. Substitute the appropriate file name and version for your operating system.

NOTE. Make sure that you install in the same installation location as the existing installation so that it overwrites the main conda files and do not install the duplicate in a new folder.

0
source

Source: https://habr.com/ru/post/1013592/


All Articles