The service has encountered an error while checking the health of the Streamlit app: Get "http://localhost:8501/healthz": dial tcp 127.0.0.1:8501: connect: connection refused

I’m stuck! I have no idea why this isn’t working. It works great locally, but I can’t deploy it. I’ve tried stripping out large parts of it. It’s not really a resource-intensive script as far as I can tell. I’ve tried profiling, but the memory hovers around 160MB:
plot

Here’s the app url: https://rent-to-own.streamlit.app/
Github repo: GitHub - mattsjohnston/rent-to-own-calculator: Simple calculator to understand the rent-to-own program for prospective renters.
Streamlit version: 1.37.0
Python version: 3.12.0

Any help would be really appreciated!

Logs:

[     UTC     ] Logs for rent-to-own.streamlit.app/

────────────────────────────────────────────────────────────────────────────────────────

[01:46:06] 🖥 Provisioning machine...

[01:46:06] 🎛 Preparing system...

[01:46:06] ⛓ Spinning up manager process...

[01:46:09] 🚀 Starting up repository: 'rent-to-own-calculator', branch: 'main', main module: 'calculator.py'

[01:46:09] 🐙 Cloning repository...

[01:46:10] 🐙 Cloning into '/mount/src/rent-to-own-calculator'...
Warning: Permanently added the ED25519 host key for IP address '140.82.116.3' to the list of known hosts.

[01:46:10] 🐙 Cloned repository!

[01:46:10] 🐙 Pulling code changes from Github...

[01:46:11] 📦 Processing dependencies...


──────────────────────────────────────── uv ───────────────────────────────────────────


Using uv pip install.

Resolved 74 packages in 398ms

Downloaded 74 packages in 4.77s

Installed 74 packages in 543ms

 + altair==5.3.0

 + attrs==23.2.0

 + beautifulsoup4==4.12.3

 + blinker==1.8.2

 + cachetools==5.4.0

 + certifi==2024.7.4

 + charset-normalizer==3.3.2

 + click==8.1.7

 + contourpy==1.2.1

 + cycler==0.12.1

 + entrypoints==0.4

 + faker==26.0.0

 + favicon==0.7.0

 + fonttools==4.53.1

 + gitdb==4.0.11

 + gitpython==3.1.43

 + htbuilder==0.6.2

 + idna==3.7

 + jinja2==3.1.4

 + jsonschema==4.23.0

 + jsonschema-specifications==2023.12.1

 + kiwisolver==1.4.5

 + lxml==5.2.2

 + markdown==3.6

 + markdown-it-py==3.0.0

 + markdownlit==0.0.7

 + markupsafe==2.1.5

 + matplotlib==3.9.1

 + mdurl==0.1.2

 + more-itertools==10.3.0

 + numpy==2.0.1

 + numpy-financial==1.0.0

 + packaging==24.1

 + pandas==2.2.2

 + pillow==10.4.0

 + plotly==5.23.0

 +[2024-07-26 01:46:17.561328]  prometheus-client==0.20.0

 + protobuf==5.27.2

 + pyarrow==17.0.0

 + pydeck==0.9.1

 + pygments==2.18.0

 + pymdown-extensions==10.8.1

 + pyparsing==3.1.2

 + python-dateutil==2.9.0.post0[2024-07-26 01:46:17.561532] 

 + pytz==2024.1

 + pyyaml==6.0.1

 + referencing==0.35.1

 + requests==2.32.3

 + rich==13.7.1

 + rpds-py==0.19.1

 + six==1.16.0

 + smmap[2024-07-26 01:46:17.561695] ==5.0.1

 + soupsieve==2.5

 + st-annotated-text==4.0.1

 + st-theme==1.2.3

 + streamlit==1.37.0

 + streamlit-camera-input-live==0.2.0

 + streamlit-card==1.0.2

 + streamlit-embedcode==0.1.2

 + [2024-07-26 01:46:17.561904] streamlit-extras==0.4.3

 + streamlit-faker==0.0.3

 + streamlit-image-coordinates==0.1.9

 + streamlit-keyup==0.2.4

 + streamlit-toggle-switch==1.0.2

 + streamlit-vertical-slider==2.5.5

 + tenacity==8.5.0

 + toml==0.10.2

 + toolz==0.12.1

 + tornado==6.4.1

 + typing-extensions==4.12.2

 + tzdata==2024.1

 + urllib3==2.2.2

 + validators==0.33.0

 + watchdog==4.0.1

Checking if Streamlit is installed

Found Streamlit version 1.37.0 in the environment


────────────────────────────────────────────────────────────────────────────────────────


[01:46:19] 🐍 Python dependencies were installed from /mount/src/rent-to-own-calculator/requirements.txt using uv.

Check if streamlit is installed

Streamlit is already installed

[01:46:21] 📦 Processed dependencies!


      👋 Welcome to Streamlit!


      If you’d like to receive helpful onboarding emails, news, offers, promotions,

      and the occasional swag, please enter your email address below. Otherwise,

      leave this field blank.


[01:46:25] ❗️ The service has encountered an error while checking the health of the Streamlit app: Get "http://localhost:8501/healthz": dial tcp 127.0.0.1:8501: connect: connection refused

[01:47:59] ❗️ Streamlit server consistently failed status checks

[01:47:59] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

It’s working now… I’m still not sure what fixed it. I stripped out all the dependencies from requirements.txt and my imports, deployed, and then it worked. I slowly added them back one by one and it kept working, even when I got back to my original code base.