Import error accessing an excel file in my repository

I have just deployed a streamlit app that reads an excel file in the same directory. The file is in the gihub repository. It looks like the app deployed from gitub doesn’t include the Excel file. Moreover, I am facing some import errors copied below. I think these are related to openpyxl. My ap runs OK locally. Any advice appreciated.

File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/scriptrunner/script_runner.py”, line 443, in _run_script
exec(code, module.dict)
File “/app/games/dosched.py”, line 56, in
gl = get_game_list()
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/legacy_caching/caching.py”, line 573, in wrapped_func
return get_or_create_cached_value()
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/legacy_caching/caching.py”, line 557, in get_or_create_cached_value
return_value = func(*args, **kwargs)
File “/app/games/dosched.py”, line 9, in get_game_list
excel_data_df = pd.read_excel(‘2022 games.xlsx’)
File “/home/appuser/venv/lib/python3.7/site-packages/pandas/util/_decorators.py”, line 311, in wrapper
return func(*args, **kwargs)
File “/home/appuser/venv/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 364, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File “/home/appuser/venv/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 1233, in init
self._reader = self._engines[engine](self._io, storage_options=storage_options)
File “/home/appuser/venv/lib/python3.7/site-packages/pandas/io/excel/_openpyxl.py”, line 521, in init
import_optional_dependency(“openpyxl”)
File “/home/appuser/venv/lib/python3.7/site-packages/pandas/compat/_optional.py”, line 118, in import_optional_dependency
raise ImportError(msg) from None

The problem was that openpyxl was missing from my requirements.txt.
All is well now.

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