Standalone executable from streamlit app


I used pyinstaller to create an executable from my streamlit app. When running the executable, I get the following error when the app tries to display a pandas dataframe with either st.dataframe or st.table.

Steps to reproduce

  1. I created a module
import streamlit as st
from pathlib import Path
import pandas as pd
import datetime 
import numpy as np
from plotly.subplots import make_subplots
from plotly import graph_objects as go
import as px

# These imports are needed for the streamlit execution below.
import streamlit.web.cli as stcli
import sys
import streamlit.runtime.scriptrunner.magic_funcs

if __name__ == "__main__":

    sys.argv=["streamlit", "run", "","--global.developmentMode=false"]

  1. With the pip environment activated, I run the command:

pyinstaller --copy-metadata streamlit --collect-data streamlit ./ --noconfirm

  1. I copy my in the created โ€œdistโ€ folder where the executable is.

  2. I run the executable

The app works, but crashes with the following error message (which does not occur when running the app directyl with โ€œstreamlit run streamlit_app.pyโ€

ModuleNotFoundError: No module named 'pyarrow.vendored.version'
File "streamlit\runtime\scriptrunner\", line 565, in _run_script
File "D:\code\ladlegate_streamlit\dist\run\", line 909, in <module>
File "D:\code\ladlegate_streamlit\dist\run\", line 656, in main
    with tab1: st.table(metadata.overview.loc[metadata.overview.set_id == set_id])
File "streamlit\runtime\", line 311, in wrapped_func
File "streamlit\elements\", line 156, in table
File "streamlit\runtime\", line 311, in wrapped_func
File "streamlit\elements\", line 159, in _arrow_table
File "streamlit\elements\", line 197, in marshall
File "streamlit\", line 759, in data_frame_to_bytes
File "pyarrow\table.pxi", line 3557, in pyarrow.lib.Table.from_pandas
    arrays, schema, n_rows = dataframe_to_arrays(
File "pyarrow\", line 571, in dataframe_to_arrays
File "pyarrow\", line 385, in _get_columns_to_convert
File "pyarrow\pandas-shim.pxi", line 126, in pyarrow.lib._PandasAPIShim.pd.__get__
File "pyarrow\pandas-shim.pxi", line 96, in pyarrow.lib._PandasAPIShim._check_import
File "pyarrow\pandas-shim.pxi", line 56, in pyarrow.lib._PandasAPIShim._import_pandas
    from pyarrow.vendored.version import Version

Debug info

  • Streamlit version:1.18.1
  • Python version: 3.7.9
  • Using standard python environment
  • OS version: Windows
  • Browser: Google Chrome

Requirements file

Package                   Version
------------------------- -----------
altair                    4.2.2
altgraph                  0.17.3
attrs                     22.2.0
backports.zoneinfo        0.2.1
blinker                   1.6.2
cachetools                5.3.0
certifi                   2022.12.7
charset-normalizer        3.1.0
click                     8.1.3
colorama                  0.4.6
cycler                    0.11.0
decorator                 5.1.1
entrypoints               0.4
fonttools                 4.38.0
gitdb                     4.0.10
GitPython                 3.1.31
idna                      3.4
importlib-metadata        6.3.0
importlib-resources       5.12.0
Jinja2                    3.1.2
jsonschema                4.17.3
kiwisolver                1.4.4
markdown-it-py            2.2.0
MarkupSafe                2.1.2
matplotlib                3.5.3
mdurl                     0.1.2
numpy                     1.21.6
packaging                 23.1
pandas                    1.3.5
pefile                    2023.2.7
Pillow                    9.5.0
pip                       23.0.1
pkgutil_resolve_name      1.3.10
plotly                    5.14.1
protobuf                  3.20.3
pydeck                    0.8.0
Pygments                  2.15.0
pyinstaller               5.10.0
pyinstaller-hooks-contrib 2023.2
Pympler                   1.0.1
pyparsing                 3.0.9
pyrsistent                0.19.3
python-dateutil           2.8.2
pytz                      2023.3
pytz-deprecation-shim     0.1.0.post0
pywin32-ctypes            0.2.0
requests                  2.28.2
rich                      13.3.4
semver                    3.0.0
setuptools                47.1.0
six                       1.16.0
smmap                     5.0.0
streamlit                 1.18.1
tenacity                  8.2.2
toml                      0.10.2
toolz                     0.12.0
tornado                   6.2
typing_extensions         4.5.0
tzdata                    2023.3
tzlocal                   4.3
urllib3                   1.26.15
validators                0.20.0
watchdog                  3.0.0
zipp                      3.15.0

Additional information

I also reproduced the procedure described in but I observed the same error.

hey! Iโ€™m not experienced with pyinstaller, but iโ€™ve seen people find a lot of success with stlite, which you can create an executable with (GitHub - whitphx/stlite: Serverless Streamlit). Not sure if youโ€™ve seen it before!

could you try install pyarrow as well pyinstaller --copy-metadata streamlit --collect-data streamlit --hidden-import pyarrow.vendored.version ./ --noconfirm

1 Like

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