Can't import streamlit anymore!

My streamlit was working fine a couple of days ago but now it does not even import. I deleted, and removed cache, even reinstall anaconda python, nothing helped.

This is the error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/toml/decoder.py in loads(s, _dict, decoder)
    455                 ret = decoder.load_line(line, currentlevel, multikey,
--> 456                                         multibackslash)
    457             except ValueError as err:

~/opt/anaconda3/lib/python3.7/site-packages/toml/decoder.py in load_line(self, line, currentlevel, multikey, multibackslash)
    724         else:
--> 725             value, vtype = self.load_value(pair[1], strictly_valid)
    726         try:

~/opt/anaconda3/lib/python3.7/site-packages/toml/decoder.py in load_value(self, v, strictly_valid)
    738         if not v:
--> 739             raise ValueError("Empty value is invalid")
    740         if v == 'true':

ValueError: Empty value is invalid

During handling of the above exception, another exception occurred:

TomlDecodeError                           Traceback (most recent call last)
<ipython-input-19-12b511d36365> in <module>
----> 1 import streamlit

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/__init__.py in <module>
    110 from streamlit import string_util as _string_util
    111 from streamlit import type_util as _type_util
--> 112 from streamlit.DeltaGenerator import DeltaGenerator as _DeltaGenerator
    113 from streamlit.ReportThread import add_report_ctx as _add_report_ctx
    114 from streamlit.ReportThread import get_report_ctx as _get_report_ctx

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/DeltaGenerator.py in <module>
     32 from datetime import time
     33 
---> 34 from streamlit import caching
     35 from streamlit import config
     36 from streamlit import cursor

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/caching.py in <module>
     40 from streamlit import file_util
     41 from streamlit import util
---> 42 from streamlit.hashing import CodeHasher
     43 from streamlit.hashing import Context
     44 from streamlit.hashing import get_hash

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/hashing.py in <module>
     42 from streamlit import type_util
     43 from streamlit.errors import UnhashableType, UserHashError, InternalHashError
---> 44 from streamlit.folder_black_list import FolderBlackList
     45 from streamlit.logger import get_logger
     46 

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/folder_black_list.py in <module>
     37 # weird situations where the ID of a class in one run is not the same as in another
     38 # run.
---> 39 if config.get_option("global.developmentMode"):
     40     import os
     41 

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/config.py in get_option(key)
     93     """
     94     # Don't worry, this call cached and only runs once:
---> 95     parse_config_file()
     96 
     97     if key not in _config_options:

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/config.py in parse_config_file(force)
    878             file_contents = input.read()
    879 
--> 880         _update_config_with_toml(file_contents, filename)
    881 
    882     _config_file_has_been_parsed = True

~/opt/anaconda3/lib/python3.7/site-packages/streamlit/config.py in _update_config_with_toml(raw_toml, where_defined)
    800 
    801     """
--> 802     parsed_config_file = toml.loads(raw_toml)
    803 
    804     for section, options in parsed_config_file.items():

~/opt/anaconda3/lib/python3.7/site-packages/toml/decoder.py in loads(s, _dict, decoder)
    456                                         multibackslash)
    457             except ValueError as err:
--> 458                 raise TomlDecodeError(str(err), original, pos)
    459             if ret is not None:
    460                 multikey, multilinestr, multibackslash = ret

TomlDecodeError: Empty value is invalid (line 3 column 1 char 25)

In [20]:

Do you have a config file at any of these locations?

  • [your project folder]/.streamlit/config.toml
  • ~/.streamlit/config.toml

If so, my guess is there’s a syntax error in one of those. Probably something that looks like foo= (with nothing on the right side). If you see something like that, please remove it from the config file and try running Streamlit again.

(And in the meantime, I’ve opened a bug on our end since we should throw a clearer error message in that case!)

Actually the error in the config file should be near line 3, character 25.

Empty value is invalid (line 3 column 1 char 25)

Yes, I messed up the config file. Deleted that from home folder. All is good now.

Thank you :slight_smile: