Conda: ImportError: cannot import name 'version_info' of ruamel_yaml

Created on 19 Jan 2018  路  3Comments  路  Source: conda/conda

SOLUTION:

This is caused by an updating to a bad ruamel_yaml package, which has since been replaced in the repository. To fix, you first need to rename all condarc configuration files so that conda does not need to parse any yaml. The most common location for this file is a file named .condarc in your home directory. After you rename that file, run

conda update ruamel_yaml

After a successful update, you can rename your condarc file back to the original name and your install should be fixed.


At first, I installed Anaconda 3 5.0.1 64-bit on my Ubuntu 16.04. I recently updated the conda and its packages using:

conda update conda
conda update --all

The update finished successfully, but it made the conda corrupted. I can't even update, install, and open anaconda-navigator. This problem will disappear if I reinstall the Anaconda, but it will come up again if I do the update. It shows something about "duplicate", but there is only one version of ruamel_yaml.

Here is the error message:

Traceback (most recent call last):
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 743, in __call__
return func(args, *kwargs)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 74, in _main
context.__init__(argparse_args=args)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 225, in __init__
argparse_args=argparse_args)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 723, in __init__
self._set_search_path(search_path)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 729, in _set_search_path
self._set_raw_data(load_file_configs(search_path))
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 371, in load_file_configs
raw_data = odict(kv for kv in chain.from_iterable(load_paths))
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 371, in
raw_data = odict(kv for kv in chain.from_iterable(load_paths))
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 346, in _file_yaml_loader
yield fullpath, YamlRawParameter.make_raw_parameters_from_file(fullpath)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 334, in make_raw_parameters_from_file
ruamel_yaml = yaml_load(fh)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 54, in yaml_load
return yaml.load(string, Loader=yaml.RoundTripLoader, version="1.2")
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/ruamel_yaml/main.py", line 637, in load
loader = Loader(stream, version, preserve_quotes=preserve_quotes)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/ruamel_yaml/loader.py", line 63, in __init__
RoundTripConstructor.__init__(self, preserve_quotes=preserve_quotes, loader=self)
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/ruamel_yaml/constructor.py", line 66, in __init__
self.allow_duplicate_keys = version_tnf((0, 15, 1), (0, 16))
File "/home/kadekutama/anaconda3/lib/python3.6/site-packages/ruamel_yaml/compat.py", line 200, in version_tnf
from ruamel_yaml import version_info # NOQA
ImportError: cannot import name 'version_info'

$ /home/kadekutama/anaconda3/bin/conda update conda

environment variables:
CIO_TEST=
COMPIZ_BIN_PATH=/usr/bin/
CONDA_ROOT=/home/kadekutama/anaconda3
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
PATH=/home/kadekutama/anaconda3/bin:/home/kadekutama/anaconda3/bin:/home/ka
dekutama/TTS/HTSEngineAPI/bin:/home/kadekutama/TTS/SPTK/bin:/home/kade
kutama/jdk1.8.0_144/bin:/home/kadekutama/TTS/HTS/bin:/home/kadekutama/
bin:/home/kadekutama/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sb
in:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
REQUESTS_CA_BUNDLE=
SSL_CERT_FILE=
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0

 active environment : None
   user config file : /home/kadekutama/.condarc

populated config files :
conda version : 4.4.7
conda-build version : 3.2.2
python version : 3.6.4.final.0
base environment : /home/kadekutama/anaconda3 (writable)
channel URLs : https://repo.continuum.io/pkgs/main/linux-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/linux-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/linux-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/linux-64
https://repo.continuum.io/pkgs/pro/noarch
package cache : /home/kadekutama/anaconda3/pkgs
/home/kadekutama/.conda/pkgs
envs directories : /home/kadekutama/anaconda3/envs
/home/kadekutama/.conda/envs
platform : linux-64
user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.4 Linux/4.13.0-26-generic ubuntu/16.04 glibc/2.23
UID:GID : 1000:1000
netrc file : None
offline mode : False

An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
Upload successful.

Thank you for helping to improve conda.
Opt-in to always sending reports (and not see this message again)
by running

$ conda config --set report_errors true
source-community type-bug

Most helpful comment

A bad ruamel_yaml package was released to defaults, but was quickly rectified.

If you run into this issue, rename any recognized condarc file (most common file is a file named .condarc in your home directory), run conda update ruamel_yaml, and then you can put your .condarc file back. The crucial part is that conda not see any configuration files to read and parse.

All 3 comments

A bad ruamel_yaml package was released to defaults, but was quickly rectified.

If you run into this issue, rename any recognized condarc file (most common file is a file named .condarc in your home directory), run conda update ruamel_yaml, and then you can put your .condarc file back. The crucial part is that conda not see any configuration files to read and parse.

@kalefranz Thank you for your explanation! It worked perfectly!

conda update ruamel_yaml didn't work for me, nor renaming .condarc

I am guessing one of these files is a configuration file that needs to be renameed as well. .bashrc-anaconda.bak? Something else?

.
..
.adobe
.anaconda
anaconda2
bin
.biojs_templates
.cache
.conda
.config
.continuum
.dbus
Desktop
Documents
Downloads
.emacs.d
ffmpeg_build
ffmpeg_sources
.gconf
.gimp-2.8
.gnupg
.ipython
.java
.jswingreader
.jupyter
.kde
.local
.macromedia
media
.mozilla
Music
.nano
.oracle_jre_usage
Pictures
.pki
Public
.pwsafe
.synaptic
.tabula
Templates
.thumbnails
.vamsas
Videos
.bash_aliases
.bash_history
.bash_logout
.bash_profile
.bashrc
.bashrc-anaconda2.bak
.bashrc.save
.bashrc.swp
.condarc_rename
..condrc.swp
.dmrc
examples.desktop
.flexlmrc
.ICEauthority
.identifiers.org.ids.json
.pam_environment
.profile
.profile.save
.sudo_as_admin_successful
.wget-hsts
.Xauthority
.xinputrc
.xsession-errors
.xsession-errors.old

Sorry for the newbie question . . . Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ajaypanekkad picture ajaypanekkad  路  3Comments

readmanchiu picture readmanchiu  路  3Comments

ark00 picture ark00  路  3Comments

mhlr picture mhlr  路  3Comments

codenara picture codenara  路  3Comments