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?

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.