Unable to run "streamlit hello" or any other python file after installing streamlit latest

I am unable to run or start the streamlit app. This error is showing.

I run it in PowerShell
PS W:\Courses\olympics-analysis-web-app> streamlit hello

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\__init__.py", line 70, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\delta_generator.py", line 36, in <module>
    from streamlit import cursor, caching
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\cursor.py", line 18, in <module>
    from streamlit.scriptrunner import get_script_run_ctx
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\scriptrunner\__init__.py", line 16, in <module>
    from .script_runner import (
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 35, in <module>
    from streamlit.state import (
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\state\__init__.py", line 16, in <module>
    from .safe_session_state import SafeSessionState as SafeSessionState
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\state\safe_session_state.py", line 21, in <module>
    from .session_state import (
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\state\session_state.py", line 45, in <module>
    from streamlit.type_util import ValueFieldName
  File "C:\Users\Administrator\.virtualenvs\olympics-analysis-web-app-bB4ksczc\lib\site-packages\streamlit\type_util.py", line 43, in <module>
    import pyarrow as pa
**ValueError: source code string cannot contain null bytes**

Hi @Maaz_Shaban ,

Thanks for posting your issue. Looking at your issue,

have you tried running

sed -i 's/\x0//g' %YOUR_PYTHON_FILE%

this would look like:

sed -i 's/\x0//g' test.py

Here is the reference that I found in order to attempt to solve this issue. Let me know if this helps. shell - Identifying and removing null characters in UNIX - Stack Overflow

Still receiving the same error after running.

sed -i 's/\x0//g' test.py

Actually, it is working fine in the global environment but when I switch to a local environment using pipenv It gives this ValueError

Ah so you’re using a pipenv and then calling streamlit hello?

Is it possible you have conflicting dependencies?

Yes, It is possible. I think this is happening because of conflict but how I can figure out which dependency is causing the problem?

That’s a good question. I think you maybe able to run pip check. Let me know if that works.

I run this after enabling virtualenv using pipenv.

PS W:\Courses\olympics-analysis-web-app> pip check
No broken requirements found.
PS W:\Courses\olympics-analysis-web-app>

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