From 3491d3194073286be7f93d8650b96b6aeb5abf14 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 17:05:14 +0200 Subject: [PATCH 01/14] Try adding packages --- streamlit_app/app.py | 9 --------- streamlit_app/packages.txt | 2 ++ 2 files changed, 2 insertions(+), 9 deletions(-) create mode 100644 streamlit_app/packages.txt diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 4906662..5a82fa7 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -21,7 +21,6 @@ import plotly.express as px import plotly.io as pio import streamlit as st -import kaleido from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -44,14 +43,6 @@ default_statistics_stress_strain, ) -# Ensure Kaleido uses the latest version and has access to Chrome for rendering -# This is necessary for Plotly to export figures as PNGs correctly. -# Note: Kaleido 1.0.0+ requires a Chromium installation to work properly -# This is a workaround to ensure it works in Streamlit Cloud and other environments. -# If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version -# of Kaleido that does not require Chrome. -kaleido.get_chrome_sync() - # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING # ─────────────────────────────────────────────────────────────── diff --git a/streamlit_app/packages.txt b/streamlit_app/packages.txt new file mode 100644 index 0000000..4d56a9b --- /dev/null +++ b/streamlit_app/packages.txt @@ -0,0 +1,2 @@ +chromium +chromium-driver \ No newline at end of file From a352fabed8f0ccd1869c98bebb090823b624d7a5 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 17:13:47 +0200 Subject: [PATCH 02/14] Try to fix permission error --- streamlit_app/app.py | 11 +++++++++++ streamlit_app/packages.txt | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) delete mode 100644 streamlit_app/packages.txt diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 5a82fa7..80c99da 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -9,6 +9,7 @@ from __future__ import annotations +import os import io import json import tempfile @@ -21,6 +22,7 @@ import plotly.express as px import plotly.io as pio import streamlit as st +import kaleido from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -43,6 +45,15 @@ default_statistics_stress_strain, ) +# Ensure Kaleido uses the latest version and has access to Chrome for rendering +# This is necessary for Plotly to export figures as PNGs correctly. +# Note: Kaleido 1.0.0+ requires a Chromium installation to work properly +# This is a workaround to ensure it works in Streamlit Cloud and other environments. +# If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version +# of Kaleido that does not require Chrome. +os.environ["CHOREOGRAPHER_BROWSER_DIR"] = "/tmp/chrome" +kaleido.get_chrome_sync() + # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING # ─────────────────────────────────────────────────────────────── diff --git a/streamlit_app/packages.txt b/streamlit_app/packages.txt deleted file mode 100644 index 4d56a9b..0000000 --- a/streamlit_app/packages.txt +++ /dev/null @@ -1,2 +0,0 @@ -chromium -chromium-driver \ No newline at end of file From f712cc6ce3a5f3a799ca68daa503e2e78d5e0118 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 17:17:37 +0200 Subject: [PATCH 03/14] Retry --- streamlit_app/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 80c99da..aae1fbc 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -51,7 +51,13 @@ # This is a workaround to ensure it works in Streamlit Cloud and other environments. # If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version # of Kaleido that does not require Chrome. +# Set a safe path os.environ["CHOREOGRAPHER_BROWSER_DIR"] = "/tmp/chrome" + +# Ensure the directory exists +Path(os.environ["CHOREOGRAPHER_BROWSER_DIR"]).mkdir(parents=True, exist_ok=True) + +# Now call the sync function kaleido.get_chrome_sync() # ─────────────────────────────────────────────────────────────── From bed3ed177b66feb388ca6b2207771ae26786b323 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 17:58:59 +0200 Subject: [PATCH 04/14] TRy adding package with chromium --- streamlit_app/app.py | 14 +++++++------- streamlit_app/requirements.txt | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/streamlit_app/app.py b/streamlit_app/app.py index aae1fbc..6eaf0de 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -9,7 +9,6 @@ from __future__ import annotations -import os import io import json import tempfile @@ -22,7 +21,8 @@ import plotly.express as px import plotly.io as pio import streamlit as st -import kaleido + +# import kaleido from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -52,13 +52,13 @@ # If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version # of Kaleido that does not require Chrome. # Set a safe path -os.environ["CHOREOGRAPHER_BROWSER_DIR"] = "/tmp/chrome" +# os.environ["CHOREOGRAPHER_BROWSER_DIR"] = "/tmp/chrome" -# Ensure the directory exists -Path(os.environ["CHOREOGRAPHER_BROWSER_DIR"]).mkdir(parents=True, exist_ok=True) +# # Ensure the directory exists +# Path(os.environ["CHOREOGRAPHER_BROWSER_DIR"]).mkdir(parents=True, exist_ok=True) -# Now call the sync function -kaleido.get_chrome_sync() +# # Now call the sync function +# kaleido.get_chrome_sync() # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index 49a29c8..97a0d19 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -2,4 +2,5 @@ streamlit plotly pandas merrypopins -kaleido \ No newline at end of file +kaleido +playwright-python \ No newline at end of file From d57a2d754e1b8da1cd262eab1eef6d933e509e52 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:01:26 +0200 Subject: [PATCH 05/14] Fix the requirement package name --- streamlit_app/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index 97a0d19..fe6d8d8 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -3,4 +3,4 @@ plotly pandas merrypopins kaleido -playwright-python \ No newline at end of file +playwright \ No newline at end of file From 17c65473897c286b0048688811688789c3177275 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:15:49 +0200 Subject: [PATCH 06/14] Try another package --- streamlit_app/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index fe6d8d8..af5695e 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -3,4 +3,4 @@ plotly pandas merrypopins kaleido -playwright \ No newline at end of file +chromedriver-py \ No newline at end of file From 9f23756306cb1691d717d72a5a6b79dbff59f18e Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:23:13 +0200 Subject: [PATCH 07/14] Try another package --- streamlit_app/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index af5695e..efc76d9 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -3,4 +3,5 @@ plotly pandas merrypopins kaleido +selenium chromedriver-py \ No newline at end of file From 7096820f8f545dedc2ea8a55643f8d3cc99b2752 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:30:10 +0200 Subject: [PATCH 08/14] Try new version of kaleido --- streamlit_app/app.py | 7 +++++-- streamlit_app/requirements.txt | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 6eaf0de..a36620d 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -23,6 +23,7 @@ import streamlit as st # import kaleido +from kaleido import write_fig_sync from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -91,8 +92,10 @@ def _fig_to_png(fig) -> bytes: - """Robust PNG export that always uses Kaleido.""" - return pio.to_image(fig, format="png") # dimensions come from scope defaults + """Export Plotly figure to PNG using Kaleido v1.""" + buf = io.BytesIO() + write_fig_sync(fig, file_obj=buf, format="png", width=1000, height=600, scale=2) + return buf.getvalue() def persist_file_uploader(label: str, key: str, types: Tuple[str, ...]): diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index efc76d9..49a29c8 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -2,6 +2,4 @@ streamlit plotly pandas merrypopins -kaleido -selenium -chromedriver-py \ No newline at end of file +kaleido \ No newline at end of file From 83c4157e1218fe1723544ca210ab81faf6ca4d7e Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:35:27 +0200 Subject: [PATCH 09/14] Try old version of plotly --- Dockerfile | 2 +- streamlit_app/app.py | 24 ++---------------------- streamlit_app/requirements.txt | 2 +- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index d13e548..2653899 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y \ # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -e . \ - && pip install --no-cache-dir streamlit plotly matplotlib kaleido + && pip install --no-cache-dir streamlit plotly matplotlib "kaleido<1.0.0" # Set the Streamlit port ENV PORT=8501 diff --git a/streamlit_app/app.py b/streamlit_app/app.py index a36620d..5a82fa7 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -22,9 +22,6 @@ import plotly.io as pio import streamlit as st -# import kaleido -from kaleido import write_fig_sync - from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( default_preprocess, @@ -46,21 +43,6 @@ default_statistics_stress_strain, ) -# Ensure Kaleido uses the latest version and has access to Chrome for rendering -# This is necessary for Plotly to export figures as PNGs correctly. -# Note: Kaleido 1.0.0+ requires a Chromium installation to work properly -# This is a workaround to ensure it works in Streamlit Cloud and other environments. -# If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version -# of Kaleido that does not require Chrome. -# Set a safe path -# os.environ["CHOREOGRAPHER_BROWSER_DIR"] = "/tmp/chrome" - -# # Ensure the directory exists -# Path(os.environ["CHOREOGRAPHER_BROWSER_DIR"]).mkdir(parents=True, exist_ok=True) - -# # Now call the sync function -# kaleido.get_chrome_sync() - # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING # ─────────────────────────────────────────────────────────────── @@ -92,10 +74,8 @@ def _fig_to_png(fig) -> bytes: - """Export Plotly figure to PNG using Kaleido v1.""" - buf = io.BytesIO() - write_fig_sync(fig, file_obj=buf, format="png", width=1000, height=600, scale=2) - return buf.getvalue() + """Robust PNG export that always uses Kaleido.""" + return pio.to_image(fig, format="png") # dimensions come from scope defaults def persist_file_uploader(label: str, key: str, types: Tuple[str, ...]): diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index 49a29c8..eaa9ca3 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -2,4 +2,4 @@ streamlit plotly pandas merrypopins -kaleido \ No newline at end of file +kaleido<1.0.0 \ No newline at end of file From 05655990f086a11ab4ed6d9a23114a78be7f994a Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:41:16 +0200 Subject: [PATCH 10/14] Try fixing buttons --- .streamlit/config.toml | 1 - streamlit_app/app.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.streamlit/config.toml b/.streamlit/config.toml index 0b90ad2..6c7053a 100644 --- a/.streamlit/config.toml +++ b/.streamlit/config.toml @@ -1,5 +1,4 @@ [theme] -base = "auto" primaryColor = "#F63366" backgroundColor = "#0E1117" secondaryBackgroundColor = "#262730" diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 5a82fa7..cc39033 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -67,10 +67,10 @@ # —— upload and png helper ———————————————————————————— # ── ensure PNG export always uses Kaleido ────────────────────── -pio.defaults.default_format = "png" # <-- new -pio.defaults.default_width = 1000 # optional defaults -pio.defaults.default_height = 600 -pio.defaults.default_scale = 2 +pio.kaleido.scope.defaults.default_format = "png" # <-- new +pio.kaleido.scope.defaults.default_width = 1000 # optional defaults +pio.kaleido.scope.defaults.default_height = 600 +pio.kaleido.scope.defaults.default_scale = 2 def _fig_to_png(fig) -> bytes: From 7e569c40934a4ca9efa48392951af38d8a18689a Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Thu, 10 Jul 2025 18:47:42 +0200 Subject: [PATCH 11/14] Fix kaleido problems --- Dockerfile | 2 +- streamlit_app/app.py | 21 +++++++++++++++++---- streamlit_app/requirements.txt | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2653899..d13e548 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y \ # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -e . \ - && pip install --no-cache-dir streamlit plotly matplotlib "kaleido<1.0.0" + && pip install --no-cache-dir streamlit plotly matplotlib kaleido # Set the Streamlit port ENV PORT=8501 diff --git a/streamlit_app/app.py b/streamlit_app/app.py index cc39033..2cbb5b3 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -9,6 +9,7 @@ from __future__ import annotations +import os import io import json import tempfile @@ -17,10 +18,14 @@ from pathlib import Path from typing import Dict, Tuple +# Set Kaleido cache dir to a user-writable location before importing plotly/kaleido +os.environ["KALEIDO_CACHE_DIR"] = os.path.expanduser("~/.cache/kaleido") + import pandas as pd import plotly.express as px import plotly.io as pio import streamlit as st +import kaleido from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -43,6 +48,14 @@ default_statistics_stress_strain, ) +# Ensure Kaleido uses the latest version and has access to Chrome for rendering +# This is necessary for Plotly to export figures as PNGs correctly. +# Note: Kaleido 1.0.0+ requires a Chromium installation to work properly +# This is a workaround to ensure it works in Streamlit Cloud and other environments. +# If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version +# of Kaleido that does not require Chrome. +kaleido.get_chrome_sync() + # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING # ─────────────────────────────────────────────────────────────── @@ -67,10 +80,10 @@ # —— upload and png helper ———————————————————————————— # ── ensure PNG export always uses Kaleido ────────────────────── -pio.kaleido.scope.defaults.default_format = "png" # <-- new -pio.kaleido.scope.defaults.default_width = 1000 # optional defaults -pio.kaleido.scope.defaults.default_height = 600 -pio.kaleido.scope.defaults.default_scale = 2 +pio.defaults.default_format = "png" # <-- new +pio.defaults.default_width = 1000 # optional defaults +pio.defaults.default_height = 600 +pio.defaults.default_scale = 2 def _fig_to_png(fig) -> bytes: diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index eaa9ca3..49a29c8 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -2,4 +2,4 @@ streamlit plotly pandas merrypopins -kaleido<1.0.0 \ No newline at end of file +kaleido \ No newline at end of file From 3831fb6bfff4231aaa7ecf55859da72e063fc662 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Fri, 11 Jul 2025 16:07:50 +0200 Subject: [PATCH 12/14] Reverse kaleido latest version it breaks streamlit cloud --- streamlit_app/app.py | 11 +++++------ streamlit_app/requirements.txt | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 2cbb5b3..165042e 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -25,7 +25,6 @@ import plotly.express as px import plotly.io as pio import streamlit as st -import kaleido from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -54,7 +53,7 @@ # This is a workaround to ensure it works in Streamlit Cloud and other environments. # If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version # of Kaleido that does not require Chrome. -kaleido.get_chrome_sync() +# kaleido.get_chrome_sync() # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING @@ -80,10 +79,10 @@ # —— upload and png helper ———————————————————————————— # ── ensure PNG export always uses Kaleido ────────────────────── -pio.defaults.default_format = "png" # <-- new -pio.defaults.default_width = 1000 # optional defaults -pio.defaults.default_height = 600 -pio.defaults.default_scale = 2 +pio.kaleido.scope.default_format = "png" # <-- new +pio.kaleido.scope.default_width = 1000 # optional defaults +pio.kaleido.scope.default_height = 600 +pio.kaleido.scope.default_scale = 2 def _fig_to_png(fig) -> bytes: diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index 49a29c8..09e0d60 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -1,5 +1,5 @@ streamlit -plotly +plotly<6.0.0 pandas merrypopins -kaleido \ No newline at end of file +kaleido<1.0.0 \ No newline at end of file From ef3407adfda49529a1b5cb64c1fc7b4f9720e1bc Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Fri, 11 Jul 2025 16:19:07 +0200 Subject: [PATCH 13/14] Version 1.0.3 downgrade kaleido --- CHANGELOG.md | 8 +++++++- Dockerfile | 2 +- pyproject.toml | 2 +- src/merrypopins/__init__.py | 2 +- streamlit_app/app.py | 12 ------------ 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bcfab0..6b17437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,4 +37,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ## [1.0.2] – 2025-07-08  :dependabot: **“Dependency Update”** ### Changed - **Streamlit App**: - - Updated `kaleido` dependency to latest version. \ No newline at end of file + - Updated `kaleido` dependency to latest version. + +## [1.0.3] – 2025-07-15  :bug: **“Patch Release”** +### Fixed +- **Streamlit Cloud App**: + - Fixed issue with PNG export not working in the latest version of Kaleido, new major version of Kaleido now requires Chromium to be installed. So we have downgraded Kaleido to 0.2.1. We have tried to call `kaleido.get_chrome_sync()` to ensure it works in Streamlit Cloud and other environments, but it is not + possible to call it in the Streamlit Cloud environment, the Streamlit Cloud environment does not allow changing system environment variables like `KALEIDO_CACHE_DIR` or calling `kaleido.get_chrome_sync()`. So we have removed the call to `kaleido.get_chrome_sync()` and set the default format, width, height, and scale for PNG export using `pio.kaleido.scope`. For this we also had to update the `plotly` dependency to `<6.0.0` to ensure compatibility with the `0.2.1` version of `kaleido`. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d13e548..5430c2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y \ # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -e . \ - && pip install --no-cache-dir streamlit plotly matplotlib kaleido + && pip install --no-cache-dir streamlit "plotly<6.0.0" matplotlib "kaleido<1.0.0" # Set the Streamlit port ENV PORT=8501 diff --git a/pyproject.toml b/pyproject.toml index 53b1788..bc9c55d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "merrypopins" -version = "1.0.2" +version = "1.0.3" description = "Merrypopins: Automated pop-in detection for nano-indentation experiments tooling: load_datasets, preprocess, locate, statistics & make_dataset" readme = "README.md" requires-python = ">=3.10,<3.13" diff --git a/src/merrypopins/__init__.py b/src/merrypopins/__init__.py index e3bc9e7..26cf66c 100644 --- a/src/merrypopins/__init__.py +++ b/src/merrypopins/__init__.py @@ -11,7 +11,7 @@ - `make_dataset`: Construct enriched datasets by running the full pipeline and exporting annotated results and visualizations. """ -__version__ = "1.0.2" +__version__ = "1.0.3" # Expose submodules at the package level from . import load_datasets, preprocess, locate, statistics, make_dataset diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 165042e..5d82cd3 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -9,7 +9,6 @@ from __future__ import annotations -import os import io import json import tempfile @@ -18,9 +17,6 @@ from pathlib import Path from typing import Dict, Tuple -# Set Kaleido cache dir to a user-writable location before importing plotly/kaleido -os.environ["KALEIDO_CACHE_DIR"] = os.path.expanduser("~/.cache/kaleido") - import pandas as pd import plotly.express as px import plotly.io as pio @@ -47,14 +43,6 @@ default_statistics_stress_strain, ) -# Ensure Kaleido uses the latest version and has access to Chrome for rendering -# This is necessary for Plotly to export figures as PNGs correctly. -# Note: Kaleido 1.0.0+ requires a Chromium installation to work properly -# This is a workaround to ensure it works in Streamlit Cloud and other environments. -# If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version -# of Kaleido that does not require Chrome. -# kaleido.get_chrome_sync() - # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING # ─────────────────────────────────────────────────────────────── From 37e57d76f002bf7bb6835f1bcbd0a58ecff61ba9 Mon Sep 17 00:00:00 2001 From: Cahit Acar Date: Fri, 11 Jul 2025 17:00:34 +0200 Subject: [PATCH 14/14] Add recommended flag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bb4e79..100ccad 100644 --- a/README.md +++ b/README.md @@ -463,7 +463,7 @@ docker build -t merrypopins-app . # Run the app on http://localhost:8501 docker run -p 8501:8501 merrypopins-app ``` -#### 🌐 Option 2: Pull and Run Pre-built Image from Docker Hub +#### 🌐 Option 2: Pull and Run Pre-built Image from Docker Hub (Recommended) ```bash # Pull the latest pre-built image from Docker Hub