Issue running streamlit hello

1.9k views Asked by At

I encounter the following error when trying to run streamlit hello command in the anaconda prompt window. I installed it using pip install streamlit and everything worked fine. Any ideas as to why this isn't working? My PC is new and running Windows 10, the only installation I have performed in terms of coding progammes is Anaconda. I haven't installed python separately.

Error message:

(base) C:\Users\matte>streamlit hello
Traceback (most recent call last):
  File "c:\users\matte\anaconda3\lib\site-packages\git\__init__.py", line 83, in <module>
    refresh()
  File "c:\users\matte\anaconda3\lib\site-packages\git\__init__.py", line 73, in refresh
    if not Git.refresh(path=path):
  File "c:\users\matte\anaconda3\lib\site-packages\git\cmd.py", line 278, in refresh
    raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\users\matte\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\matte\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\matte\anaconda3\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "c:\users\matte\anaconda3\lib\site-packages\streamlit\cli.py", line 28, in <module>
    import streamlit.bootstrap as bootstrap
  File "c:\users\matte\anaconda3\lib\site-packages\streamlit\bootstrap.py", line 29, in <module>
    from streamlit.server.server import Server, server_address_is_unix_socket
  File "c:\users\matte\anaconda3\lib\site-packages\streamlit\server\server.py", line 39, in <module>
    from streamlit.report_session import ReportSession
  File "c:\users\matte\anaconda3\lib\site-packages\streamlit\report_session.py", line 26, in <module>
    from streamlit.git_util import GitRepo
  File "c:\users\matte\anaconda3\lib\site-packages\streamlit\git_util.py", line 1, in <module>
    import git  # type: ignore[import]
  File "c:\users\matte\anaconda3\lib\site-packages\git\__init__.py", line 85, in <module>
    raise ImportError('Failed to initialize: {0}'.format(exc)) from exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet
2

There are 2 answers

0
Randy Zwitch On

Based on this error message, I believe that you need to install git on your computer and/or set the $PATH correctly

ImportError: Bad git executable. The git executable must be specified in one of the following ways: - be included in your $PATH - be set via $GIT_PYTHON_GIT_EXECUTABLE

0
Smaranjit Ghose On
  • Uninstall streamlit
  • Make sure you have Anaconda set to path
  • Setup a new Anaconda Environment
  • Install streamlit
  • Try the command again