Error installing requirements when deploying, installation on local machine works fine

I’m trying to deploy an app from this repository but I’m getting an Error installing requirements issue when deploying. The app is actually up and running via Heroku here but I want to try streamlit share.

The error message is below. When I run conda env update -n <env_name> --file projects/pitchcast/environment.yml locally I get no problem.

[     UTC     ] Logs for dafriedman97-pitchcast-appapp-mdo5j8.streamlit.app/
[17:13:42] 🚀 Starting up repository: 'pitchcast', branch: 'main', main module: 'app/app.py'
[17:13:42] 🐙 Cloning repository...
[17:13:43] 🐙 Cloning into '/app/pitchcast'...
[17:13:43] 🐙 Cloned repository!
[17:13:43] 🐙 Pulling code changes from Github...
[17:13:44] 📦 Processing dependencies...
Collecting package metadata (repodata.json): ...working... [2023-01-18 17:15:11.761736] done
Solving environment: [2023-01-18 17:15:11.763305] ...working... [2023-01-18 17:21:30.585098] bash: line 3:    16 Killed                  /home/appuser/.conda/bin/conda env update -n base --file environment.yml
[17:21:31] ❗️ installer returned a non-zero exit code
[17:21:31] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.
[17:23:02] ❗️ Streamlit server consistently failed status checks
[17:23:02] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

Streamlit Cloud won’t use both the environment and requirements file. I would eliminate the environment file and just use requirements.txt by itself. (And it may be necessary to reboot the app after messing with the environment to give it an encouraging push.)

Thanks @mathcatsand. I tried removing requirements.txt (I added that for the Heroku app–environment.yml is what I really want) but I’m still getting an issue

[18:39:41] 🖥 Provisioning machine...

[18:39:42] 🚀 Starting up repository: 'pitchcast', branch: 'share', main module: 'app/app.py'

[18:39:42] 🐙 Cloning repository...

[18:39:44] 🐙 Cloning into '/app/pitchcast'...

[18:39:44] 🐙 Cloned repository!

[18:39:44] 🐙 Pulling code changes from Github...

[18:39:45] 📦 Processing dependencies...

[18:39:46] 🎛 Preparing system...

[18:39:46] ⛓ Spinning up manager process...

Collecting package metadata (repodata.json): ...working... [2023-01-18 18:41:26.112493] done

[18:47:48] ❗️ installer returned a non-zero exit code

[18:47:48] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.

[18:49:22] ❗️ Streamlit server consistently failed status checks

[18:49:22] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

Did this in a new branch called share, btw.

Any ideas? Thanks

Can you try using the requirements.txt for Streamlit Cloud, just to check if it works? There are several threads where people had issues making Streamlit Cloud process the environment.yml file as it does appear to be a bit more tempermental. It appears your environment file is installing a few more things than your requirements file and also some different versions, so either way I’d trim things down to a bare minimum for what’s being passed to Streamlit Cloud.

So if you can confirm your requirements file can work, I’d try to emulate it in the environment file next:

Your requirements.txt is:

matplotlib==3.6.0
numpy==1.23.4
pandas==1.5.1
seaborn==0.12.1
streamlit==1.11.0
tensorflow-cpu==2.10.0

So maybe remove the extra stuff from your environment file and reduce it to something like:

channles:
  - conda-forge
dependencies:
  - matplotlib==3.6.0
  - numpy==1.23.4
  - pandas==1.5.1
  - seaborn==0.12.1
  - streamlit==1.11.0
  - tensorflow-cpu==2.10.0

(I don’t use the environment.yml file as much myself, so I’m not sure I’d recognize a suspicious line on sight.)

Trying that. It’s been stuck on ⛓ Spinning up manager process... for about 20 minutes. Will keep you posted. Thanks!

@mathcatsand I deleted the app and restarted and it worked! So the solution was to just have requirements.txt rather than environment.yml and requirements.txt

One open question though: I’m wondering if there is a way to keep environment.yml in the repo (and have Streamlit Cloud ignore it). Essentially I want requirements.txt for Streamlit but environment.yml for the project as a whole.

I believe Streamlit just uses the first one it finds and I’m not sure how to command it from the Streamlit Cloud side to do otherwise. After you confirmed that the requirements.txt file works, did you iterate back and see if you could get the simpler version of the environment.yml file to work?

Could you keep separate branches for the deployment, or could you try from your other deployment to do something tricky? Make it do something like accept a different name than environments.yml so Streamlit Cloud wouldn’t recognize it as an environment setup file?

Getting the same original issue when I use the simpler environment.yml

Collecting package metadata (repodata.json): ...working... [2023-01-19 02:19:21.849859] done

Solving environment: ...working... [2023-01-19 02:23:34.173510] bash: line 3:    16 Killed                  /home/appuser/.conda/bin/conda env update -n base --file environment.yml

[02:23:35] ❗️ installer returned a non-zero exit code

[02:23:35] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.

[02:25:05] ❗️ Streamlit server consistently failed status checks

[02:25:05] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

I was able to deploy an app to Streamlit Cloud with this environment.yml file. See if you can start from here:

name: myenv
dependencies:
- pip
- pip:
  - matplotlib==3.6.0
  - numpy==1.23.4
  - pandas==1.5.1
  - seaborn==0.12.1
  - streamlit==1.11.0
  - tensorflow-cpu==2.10.0

(You may need to specify the version of protobuf, by the way. Seems like Streamlit and tensorflow-cpu will be picky on that point.)

Looks like the same errors as before… how do I specify the version of protobuf? (that’s a new term to me)

Just to check, did you manually reboot the app after changing the environment file? I know it was correctly parsed on a simple app that just imports matplotlib to test the environment. Hmmm…

Protobuf is just another package that you can set, same matplotlib, numpy, pandas, etc.

I think it’s something like

protobuf<3.20,>=3.9.2

so you could try pinning it at a specific 3.19.x version.