Failing to build a Streamlit Cloud app

I have a very basic application that I’m trying to deploy using Streamlit cloud. The code can be found here: GitHub - drorata/piecewise-linear-regression: Playing around with piecewise linear regression.

I’m using a conda environment (ref):

name: piecewise-linear-regression
channels:
  - conda-forge
dependencies:
  - python=3.10
  - streamlit=1.10.0
  - pandas=1.4.2
  - plotly=5.9.0
  - scipy=1.8.1

When trying to deploy the app on Streamlit cloud, I get the following:

[     UTC     ] Logs for drorata-piecewise-linear-regression-main-app-b7vphg.streamlitapp.com/
────────────────────────────────────────────────────────────────────────────────────────
[05:33:37] 🖥 Provisioning machine...
[05:31:22] 🚀 Starting up repository: 'piecewise-linear-regression', branch: 'main', main module: 'main_app.py'
[05:31:22] 🐙 Cloning repository...
[05:31:23] 🐙 Cloning into '/app/piecewise-linear-regression'...
[05:31:23] 🐙 Cloned repository!
[05:31:23] 🐙 Pulling code changes from Github...
[05:31:24] 📦 Processing dependencies...
Collecting package metadata (repodata.json): ...working... [2022-07-08 05:32:59.123123] done
[05:33:39] 🎛 Preparing system...
[05:33:39] ⛓ Spinning up manager process...
[05:38:13] ❗️ installer returned a non-zero exit code
[05:38:13] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.
[05:39:52] ❗️ Streamlit server consistently failed status checks
[05:39:52] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

Unfortunately, the logs are not providing enough hints what could be the problem. Needless to say, I am able to run the application locally using the same environment.

Hi @drorata, welcome to the Streamlit community! :wave:

I suspect conda is failing during dependency resolution. One workaround is to delete environment.yml and instead create a requirements.txt containing the following:

streamlit==1.10.0
pandas==1.4.2
plotly==5.9.0
scipy==1.8.1

Once you replace environment.yml with the above requirements.txt, delete and re-deploy on Streamlit Cloud. The deployment should work without issues:

Best, :balloon:
Snehan

Is it possible somehow to fix the environment using conda? As per the doc (ref), it should work also with environment.yml.

Note that changing to requirements.txt is doable of course, but this will make it harder to streamline the environment config locally vs in Streamlit cloud. More specifically, I could extract the dependencies into a requirements.txt and use it inside my environment.yml (which I would like to keep due to the creation of virtual envs locally). But, in this case, the deployment will still pick the environment.yml first.

Any advise?

Is this still an issue @drorata? I saw in your code you switched to Pipfile, so didn’t want to spend more time if it were already solved.

Best,
Randy

@randyzwitch I guess you cannot say that the problem was solved. My first go-to was to use environment.yml and streamlit failed to support it. Also the recommendation made by @snehankekre was not really solving the problem. I decided to switch to a Pipfile indeed, but the bug is still present. I would be happy to provide more feedback on this so streamlit could be even better :slight_smile: