Skip to content

Streamlit fails to start without Git executable #2208

@kgrabowski

Description

@kgrabowski

Summary

Streamlit version 0.69.1 fails to start when run inside a Docker container that doesn't have Git installed.

Steps to reproduce

  1. Create a Dockerfile with the following contents:
FROM python:3.8-slim
RUN pip install streamlit
CMD ["streamlit", "hello"]
  1. Build the image:
docker build -t demo .
  1. Run the app:
docker run -it --rm demo

Expected behavior:

Streamlit starts without issues.

Actual behavior:

Streamlit fails to start and displays the following error message:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/git/__init__.py", line 83, in <module>
    refresh()
  File "/usr/local/lib/python3.8/site-packages/git/__init__.py", line 73, in refresh
    if not Git.refresh(path=path):
  File "/usr/local/lib/python3.8/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

Is this a regression?

yes (worked up until at least version 0.67.1)

Debug info

  • Streamlit version: 0.69.1
  • Python version: 3.8.6
  • Using Conda? PipEnv? PyEnv? Pex? NO
  • OS version: 4.19.76-linuxkit

Additional information

This bug can be worked around by setting GIT_PYTHON_REFRESH=quiet environment variable inside the Docker image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions