python-3.xastropy

astropy.extern.configobj.configobj.ConfigObjError: Parsing failed with several errors


When I import the astropy package, I got the following error message.

>>> import astropy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/__init__.py", line 288, in <module>
    log = _init_log()
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/logger.py", line 97, in _init_log
    log._set_defaults()
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/logger.py", line 473, in _set_defaults
    self.setLevel(conf.log_level)
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/config/configuration.py", line 273, in __get__
    return self()
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/config/configuration.py", line 396, in __call__
    sec = get_config(self.module)
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/config/configuration.py", line 530, in get_config
    cobj = configobj.ConfigObj(cfgfn, interpolation=False)
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/extern/configobj/configobj.py", line 1227, in __init__
    self._load(infile, configspec)
  File "/home/lalitawadee/anaconda3/lib/python3.7/site-packages/astropy/extern/configobj/configobj.py", line 1316, in _load
    raise error
astropy.extern.configobj.configobj.ConfigObjError: Parsing failed with several errors.
First error at line 142.

I've already tried to remove Anaconda and re-install it, but the problem still remains. Could you please help me with this? Thank you in advance.


Solution

  • It sounds like you somehow have a corrupt astropy config file somewhere. It would help if the error message gave the filename, but see http://docs.astropy.org/en/stable/config/ for possible locations.

    For starters, I would try something at the command-line like

    $ mv ~/.astropy/ ~/.astropy.bak
    

    and try again. I don't think this should have anything specifically to do with Anaconda.