Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Conda gives 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
like image 348
Nipun Garg Avatar asked Dec 29 '16 05:12

Nipun Garg


3 Answers

The module ruamel.yaml.comments will normally be loaded from site-packages/ruamel/yaml/comments.py, and not from site-packages/ruamel_yaml/comments.py

Conda seems to have problems with properly supporting namespaces (ruamel.) which I can only attribute to not (yet) being fully pip compatible. That although "namespaces are a honking good idea", and package namespaces have been around for many years.

Assuming you can extend "conda" installations with pip you could try to do a normal install of ruamel.yaml with:

 pip install ruamel_yaml==0.11.14

I would not normally recommend such an old version, but that is more likely to work in combination with the version conda uses itself internally.

The alternative would be to switch to using python and pip without conda, that way you can just use the latest version of software from PyPI.

like image 99
Anthon Avatar answered Nov 13 '22 05:11

Anthon


Try pip install ruamel.yaml

It works for me.

like image 26
Nicholas Luo Avatar answered Nov 13 '22 06:11

Nicholas Luo


Try conda install ruamel.yaml ... pip didnt work for me

like image 11
Varun kadekar Avatar answered Nov 13 '22 05:11

Varun kadekar