Streamlit broken

Streamlit is broken, i have already try to uninstall packages and python but return with the same error.

PS C:\Users\pietr\OneDrive\Desktop\Codici python> streamlit run app.py
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Users\pietr\AppData\Local\Programs\Python\Python311\Scripts\streamlit.exe_main
.py", line 7, in
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1130, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\web\cli.py”, line 174, in main_run
bootstrap.load_config_options(flag_options=kwargs)
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\web\bootstrap.py”, line 315, in load_config_options
config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\config.py”, line 1091, in get_config_options
file_contents = input.read()
^^^^^^^^^^^^
File “”, line 322, in decode
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte

Looks like you have a broken config.toml file somewhere and the app is crashing while trying to read it.

How can i fix it? Are there any sample?

Open the file in your editor and save it again, make sure it is encoded as utf8 when saving.

i create another config.toml empty but it result with the same error. Are there any option to cancel all old files and download again the new one?

If there is nothing you want to put in the config.toml file, then just delete it.

In addition to deleting the config.toml file, I have found only one (so far) decently stable version of streamlit. Version 0.62 seems work reasonably well, and even even with that, the version requirements of the other components is not properly defined. I have found these module version to work reasonably well, deviate from this at your own risk… I don’t think the python version is super critical, and MOST of the modules are the latest version I could install at the time, but a couple are older versions and if you install the newest version, various functions in streamlit break. If anyone can tell me the versions (if there are any) that get streamlit 1.17 (latest version) working completely, I would REALLY like to know! Someone REALLY needs to adjust the module requirements file!

Package               Version
--------------------- -----------
altair                4.2.2
astor                 0.8.1
asttokens             2.2.1
attrs                 22.2.0
backcall              0.2.0
base58                2.1.1
blinker               1.5
boto3                 1.26.60
botocore              1.29.60
cachetools            5.3.0
certifi               2022.12.7
charset-normalizer    3.0.1
click                 8.0.0
comm                  0.1.2
debugpy               1.6.6
decorator             5.1.1
entrypoints           0.4
enum-compat           0.0.3
executing             1.2.0
graphics.py           5.0.1.post1
idna                  3.4
importlib-metadata    6.0.0
ipykernel             6.21.0
ipython               8.9.0
ipywidgets            8.0.4
jedi                  0.18.2
Jinja2                3.1.2
jmespath              1.0.1
jsonschema            4.17.3
jupyter_client        8.0.2
jupyter_core          5.2.0
jupyterlab-widgets    3.0.5
MarkupSafe            2.1.2
matplotlib-inline     0.1.6
numpy                 1.20.3
packaging             23.0
pandas                1.5.3
parso                 0.8.3
pexpect               4.8.0
pickleshare           0.7.5
Pillow                9.4.0
pip                   21.3.1
platformdirs          2.6.2
prompt-toolkit        3.0.36
protobuf              3.20.0
psutil                5.9.4
ptyprocess            0.7.0
pure-eval             0.2.2
pycairo               1.23.0
pydeck                0.7.1
Pygments              2.14.0
pyrsistent            0.19.3
python-dateutil       2.8.2
pytz                  2022.7.1
pytz-deprecation-shim 0.1.0.post0
pyzmq                 25.0.0
readline              6.2.4.1
requests              2.28.2
s3transfer            0.6.0
setuptools            67.0.0
six                   1.16.0
stack-data            0.6.2
streamlit             0.62.0
tk                    0.1.0
toml                  0.10.2
toolz                 0.12.0
tornado               6.2
traitlets             5.9.0
tzdata                2022.7
tzlocal               4.2
urllib3               1.26.14
validators            0.20.0
watchdog              2.2.1
wcwidth               0.2.6
wheel                 0.38.4
widgetsnbextension    4.0.5
zipp                  3.12.0

Specifically numpy, protobuf, pydeck and urllib3 must be the versions shown.

I don’t quite get what you are asking here. Streamlit should work with any versions of its dependencies matching the specifications in setup.py. If there is a case where it doesn’t that is probably worth a bug report.

pip is sometimes unable to satisfy all the specifications for a package and installs a version which is not compatible with all of them, but that is a limitation of pip’s dependency resolution algorithm.

I wasn’t asking, I am making a statement, and yes, it is a bug! If you actually have a recent version of streamlit running more recent than 0.62 I would appreciate knowing what version of python you are using, what os, and the output from the command “pip freeze”.

I have created another microsoft account to use streamlit because no of your suggest works. The error is still there, i don’t know what happened to the program.

There must be a config.toml somewhere. Find it and delete it.

Your statement amounts to a generic “I am having issues”, there is nothing specific that a developer could act upon.

Here is a list of packages that work together (for me at least) with python 3.11
altair==4.2.2
attrs==22.2.0
blinker==1.5
cachetools==5.3.0
certifi==2022.12.7
charset-normalizer==3.0.1
click==8.1.3
colorama==0.4.6
decorator==5.1.1
entrypoints==0.4
gitdb==4.0.10
GitPython==3.1.30
idna==3.4
importlib-metadata==6.0.0
Jinja2==3.1.2
jsonschema==4.17.3
markdown-it-py==2.1.0
MarkupSafe==2.1.2
mdurl==0.1.2
numpy==1.24.1
packaging==23.0
pandas==1.5.3
Pillow==9.4.0
protobuf==3.20.3
pyarrow==11.0.0
pydeck==0.8.0
Pygments==2.14.0
Pympler==1.0.1
pyrsistent==0.19.3
python-dateutil==2.8.2
pytz==2022.7.1
pytz-deprecation-shim==0.1.0.post0
requests==2.28.2
rich==13.3.1
semver==2.13.0
six==1.16.0
smmap==5.0.0
streamlit==1.17.0
toml==0.10.2
toolz==0.12.0
tornado==6.2
typing_extensions==4.4.0
tzdata==2022.7
tzlocal==4.2
urllib3==1.26.14
validators==0.20.0
watchdog==2.2.1
zipp==3.12.0
1 Like

Run this code at the beginning of your application and see what files and directories appear:

from pathlib import Path
for path in (Path.home(), Path.cwd()):
    path = path / ".streamlit"
    st.text(path)
    if path.exists():
        for child in path.iterdir():
            st.text(child)

Thanks for that! That does NOT work on my python 3.9 system. I get this:

streamlit --version

Illegal instruction

streamlit hello

Illegal instruction

I may try upgrading to python 3.11 later, but with 3.9, that is the result I get.

That seems to be very specific to your particular environment, which I know nothing about.

@abcbarryn streamlit hello runs normally on a fresh Python 3.9, with a fresh virtual environment, with Streamlit installed by pip install streamlit with no pinned dependencies. Examine your OS (Windows?) and Python installation, try to figure out the exact paths of the executables you are using (python, pip, streamlit) and any permission issues you might be having. Also, stop pinning dependencies just for the sake of it. This is definitely a “your environment” type of problem.

@Dottor_Scotti making a new Windows account because something is wrong with your Python is a little extreme. You should start using virtual environments for your projects; maybe start here: Python Virtual Environments: A Primer – Real Python and see what happens in a clean environment?

2 Likes

Ok, so I created a virtual machine (VMWare) running Centos 9 and installed python 3.9.6 and streamlit 1.17 failed, then I wiped the system, reinstalled and installed python 3.11 and it worked. Then I wiped it again and tried python 3.9.16 and that also worked, but python 3.9.6 and 3.9.4 will not work on the two different systems I tried.

I know it’s very extreme way, but i have followed all advice e nothing work for me. Disinstalling all libraries, python versions, vs code, cancel config.toml and with creation of a virtual environment it remain still this error: (venv) PS C:\Users\pietr\OneDrive\Desktop\Codici python> streamlit run app.py
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Users\pietr\AppData\Local\Programs\Python\Python311\Scripts\streamlit.exe_main
.py", line 7, in
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1130, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py”, line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\web\cli.py”, line 174, in main_run
bootstrap.load_config_options(flag_options=kwargs)
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\web\bootstrap.py”, line 315, in load_config_options
config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
File “C:\Users\pietr\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\config.py”, line 1091, in get_config_options
file_contents = input.read()
^^^^^^^^^^^^
File “”, line 322, in decode
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte

Okay, if we assume it’s not the Python installation then let’s start over with your project:

  1. Is there a .streamlit folder inside your project? Could be a hidden folder.
  2. In VS Code there’s the file encoding shown in the bottom right. Are all your files UTF-8?
  3. This is unlikely to be the problem, but could you try checking what happens if you move your project out of OneDrive?
  4. Is there a repository you could publicly share?

edit: 5. What about C:\Users\pietr\.streamlit?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.