streamlit: streamlit run fails for containerized v1.10.0
Summary
With the 1.10.0 release I get the error listed below from my deployed streamlit container. Testing locally with streamlit run and virtualenvs works fine however.
Traceback (most recent call last):
File "/usr/local/bin/streamlit", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/streamlit/cli.py", line 205, in main_run
_main_run(target, args, flag_options=kwargs)
File "/usr/local/lib/python3.9/site-packages/streamlit/cli.py", line 240, in _main_run
bootstrap.run(file, command_line, args, flag_options)
File "/usr/local/lib/python3.9/site-packages/streamlit/bootstrap.py", line 362, in run
_install_pages_watcher(main_script_path)
File "/usr/local/lib/python3.9/site-packages/streamlit/bootstrap.py", line 338, in _install_pages_watcher
watch_dir(
File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/path_watcher.py", line 154, in watch_dir
return _watch_path(
File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/path_watcher.py", line 129, in _watch_path
watcher_class(
File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/event_based_path_watcher.py", line 92, in __init__
path_watcher.watch_path(
File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/event_based_path_watcher.py", line 170, in watch_path
folder_handler.watch = self._observer.schedule(
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/api.py", line 302, in schedule
emitter.start()
File "/usr/local/lib/python3.9/site-packages/watchdog/utils/__init__.py", line 93, in start
self.on_thread_start()
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify.py", line 118, in on_thread_start
self._inotify = InotifyBuffer(path, self.watch.is_recursive)
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_buffer.py", line 35, in __init__
self._inotify = Inotify(path, recursive)
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_c.py", line 167, in __init__
self._add_dir_watch(path, recursive, event_mask)
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_c.py", line 370, in _add_dir_watch
self._add_watch(full_path, mask)
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_c.py", line 384, in _add_watch
Inotify._raise_error()
File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_c.py", line 404, in _raise_error
raise OSError(err, os.strerror(err))
FileNotFoundError: [Errno 2] No such file or directory
Steps to reproduce
The docker image is build locally on OSX (M1 chip) using the --platform linux/amd64 flag and afterwards deployed to kubernetes. The same build and deployment process works if I pin streamlit version 1.9.2 instead of using the latest release.
requirements.txt
streamlit==1.10.0
streamlit-aggrid
streamlit-searchbox
pandas
plotly
vega_datasets
matplotlib
psycopg2
sqlalchemy
python-dotenv
awesome_streamlit
watchdog
streamlit-tags
PyJWT
protobuf~=3.19.0
Shortened Dockerfile
FROM python:3.9.12
ARG BUILD_PG_PASSWORD
....
ENV PG_PASSWORD=$BUILD_PG_PASSWORD
....
EXPOSE 8501
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
COPY ./utils /utils
....
COPY app.py .
ENTRYPOINT [ "streamlit", "run"]
CMD ["app.py"]
Debug info
- Streamlit version: 1.10.0
- Python version: 3.9
- OS version: OSX with M1 chip
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 27
Commits related to this issue
- Bugfix: Data explorer local runner usage (#307) I have tested `fondant explore` by using local manifest on a M1. Therefore, I ran into some issues. - I updated the data explorer Dockerfile accord... — committed to ml6team/fondant by mrchtr a year ago
- Bugfix: Data explorer local runner usage (#307) I have tested `fondant explore` by using local manifest on a M1. Therefore, I ran into some issues. - I updated the data explorer Dockerfile accord... — committed to satishjasthi/fondant by mrchtr a year ago
- Bugfix: Data explorer local runner usage (#307) I have tested `fondant explore` by using local manifest on a M1. Therefore, I ran into some issues. - I updated the data explorer Dockerfile accord... — committed to ml6team/fondant by mrchtr a year ago
- workaround for streamlit not running in docker as in https://github.com/streamlit/streamlit/issues/4842 — committed to Lucew/changepoynt by deleted user 4 months ago
Hi Guys, my solution for this problem is run streamlit app with following parameters:
Long story short, I disable watcher.
My system is:
I’m using
streamlit=1.27, and I still seem to be getting the same error on my M2 MacBook when running my streamlit app via a Docker container:This issue was closed quite a while ago, but there have been a lot of comments since, maybe it should be re-opened?
Also seeing this on my M1 Mac with Streamlit 1.28 and base image python:3.11-slim.
Just adding
"--server.fileWatcherType", "none"while triggeringstreamlit runshould resolve the error. example:I faced below error. $
streamlit helloI’m using Mac M2 pro and using docker. Solution was very simple.
1. pull linux/arm64/v8 image
$
docker pull --platform linux/arm64/v8 python:3.10.13<— This is the point.--platform linux/arm64/v82. edit Dockerfile
3. build and create container
$
docker-compose up -dThen, above error has gone.
@nschenone I am also interested in feedback from you too, since
WORKDIRin your Dockerfile is specified Could you please try to build and run the image from https://github.com/kajarenc/hello-dockLook’s like the installation of a watchdog for docker working on top of M1 is an issue. Maybe specifying
--platform=linux/amd64option fordocker buildand updating docker desktop (I use v4.9.1) should fix an issue