Error when deploying using a conda environment.yml

I’m trying to build an environment using conda because there is this package that is only available from one of their channels (Installation — pyGIMLi - Geophysical Inversion and Modelling Library). It works fine locally, so I just exported the environment with conda env export > environment.yml and putting that file in the repo (GitHub - edsaac/groundwater_course: Groundwater course + streamlit). However, it gets stuck with the following error:

# To activate this environment, use
#
#     $ conda activate base
#
# To deactivate an active environment, use
#
#     $ conda deactivate
[02:35:39] 🐍 Python dependencies were installed from /app/groundwater_course/environment.yml using conda.
[02:35:39] 📦 Processed dependencies!
env: ‘/home/appuser/venv/bin/streamlit’: No such file or directory
env: ‘/home/appuser/venv/bin/streamlit’: No such file or directory
[02:35:41] 🖥 Provisioning machine...
[02:35:41] ❗️ error restarting streamlit: exit status 7: output: streamlit: ERROR (not running)
streamlit: ERROR (spawn error)
[02:35:41] 🎛 Preparing system...
[02:35:41] ⛓ Spinning up manager process...
env: ‘/home/appuser/venv/bin/streamlit’: No such file or directory
env: ‘/home/appuser/venv/bin/streamlit’: No such file or directory

Downloading and installing the listed packages seems to work fine, but a good portion of the logs gets mangled out in the section where conda reports the packages that has retrieved and installed:

Maybe this is the same issue reported here: Unable to deploy using anaconda with environment.yml, but not sure if that was ever solved. I have also tried a shorter environment.yml file with just the package I’m trying to use and letting conda resolve the dependencies, but that also fails. Any ideas of what might be the issue?

1 Like

It appears that the environment got installed correctly (at least I don’t see any obvious errors from what you posted). So, could you try the old faithful “turn it off and on again”? Sounds silly, but if you haven’t tried it yet, you might try restarting the app, and if that doesn’t do anything, try deleting and recreating it.

Yeah, the dependencies are installed correctly. The error message at the end suggests that streamlit cannot be found.

env: ‘/home/appuser/venv/bin/streamlit’: No such file or directory

My guess is that all packages from conda are installed somewhere in a /home/appuser/.conda folder, but the Cloud service then fails to activate the environment because it looks for streamlit in /home/appuser/venv (as if it was a pip environment), hence the error message. Does that make sense?


Things I’ve tried that did not work:

  • Reboot the app
  • Delete the app and re-deploy it
  • Remove streamlit from the environment.yml
  • Shorten the environment.yml file doing conda env export --from-history --name my_env > myenv.yml

Wild guess: even though the conda environment is activated after installing all dependencies, that is reverted by the streamlit-install.sh script when it looks up for the streamlit executable:

/
#!/bin/bash

VIRTUALENV_BIN_DIR=/home/appuser/venv/bin

echo "Check if streamlit is installed"
if [[ ! -f "${VIRTUALENV_BIN_DIR}/streamlit" ]]; then
    echo -e "\n\x1b[35m──────────────────────────────── Installing Streamlit ──────────────────────────────────\x1b[0m\n"

    source ${VIRTUALENV_BIN_DIR}/activate

Any ideas? :confused:

I am facing the same error “env: ‘/home/appuser/venv/bin/streamlit’: No such file or directory” after all the packages listed in the environment.yml file have been successfully installed. Please see this repository: GitHub - wjiang/streamlit-conda-minimal-example
which works properly a while ago on streamlit cloud but not any more.

An update on this issue with conda: when attempting to deploy the app, the log is significantly shorter than what was reported before. As of today, it only reports some error building the environment.

[15:00:30] 📦 Processing dependencies...
Collecting package metadata (repodata.json): ...working... [2023-02-07 15:00:53.312239] done
Solving environment: ...working... [2023-02-07 15:04:16.160115] bash: line 3:  2917 Killed                  /home/appuser/.conda/bin/conda env update -n base --file environment.yml
[15:04:17] ❗️ installer returned a non-zero exit code

Is there a way to obtain a more detailed log to evaluate the problem? Or, could someone point me to a successful deployment in Streamlit Cloud using a conda environment? :flushed:

1 Like

same Solving environment: …working… [2023-02-07 15:04:16.160115] bash: line 3 error
when I include conda-forge as channel

Same here. You cannot even install a single package when conda-forge is in the channels. Streamlit is pretty much useless with this bug.

Consider if you can install your dependencies using pip and debian packages, that seems to be much more reliable than conda.

No sorry, this is not an option. The package in this version is only available on conda.
It can’t be too hard to install a SINGLE package with conda.

You are probably aware that solving an environment using conda-forge can require an awful lot of memory.

So, if you have such memory requirements, then a free hosting service with only 1 GB of memory available is useless to you. But you can still deploy your Streamlit application in another, more powerful hosting.

Thanks @Goyo that makes sense. I wasn’t aware that memory is limited to 1 GB.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.