ModuleNotFoundError: No module named 'Bio'

  1. Public app link - https://rhev-subtype-webapp.streamlit.app/
  2. Github reposistory- GitHub - sxh1136/rHEV-subtype-webapp
  3. Error:
File "/mount/src/rhev-subtype-webapp/p-distance-calc.py", line 3, in <module>
    from Bio import SeqIO, Align
ModuleNotFoundError: No module named 'Bio'
  1. streamlit==1.42.2, python=3.12

Hi streamlit community. I’ve been trying to get my webapp on the community cloud for the past week but can’t for the life of me get it to run correctly. I’ve tried editing the environment.yml file to install biopython using conda and pip as well as using older versions of biopython. The webapp works perfectly in a local session. The environment.yml was created using:

conda env export --no-builds > environment.yml 

The streamlit-app.py also contains a from Bio import line but does not appear to break the script. It only breaks when it tries to import Bio as part of the p-distance-calc.py script.

Thanks for everyone’s help in advance.

In typical fashion, I found the error documented hours after posting a forum post:

However, I now have this error:
/bin/sh: 1: mafft: not found

Do non-python packages not work with streamlit even if included in environment.yml?

In general, external dependencies should be listed in a packages.txt file (see App dependencies for your Community Cloud app - Streamlit Docs). I would expect biopython to bundle mafftin the pip install… but if not, you could include the portable version in your repo and specify the path to the mafft executable using their wrapper:

https://biopython.org/docs/1.75/api/Bio.Align.Applications.html?#Bio.Align.Applications.MafftCommandline

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/mount/src/salary-prediction/advance.py", line 3, in <module>
    import matplotlib.pyplot as plt