Biopython BLAST module help

Hello, I am trying to deploy an app which uses Biopython’s wrapper for the the NCBI blastP package. Unfortunately, I keep getting the error /bin/sh: 1: blastp: not found when deployed (though the code does work locally using streamlit run

An example code snipped for what I’m trying to do is below. The NamedTemporaryFile part is because the NcbiblastpCommandLine module requires local paths to files, and I’m not sure if this is also what’s causing the above error. Thank you for any help on this specific issue!

from Bio.Blast.Applications import NcbiblastpCommandline
with NamedTemporaryFile(dir='.', suffix='.fasta') as f:

        cline_pblast = NcbiblastpCommandline(
        out = cline_pblast()

What is in your requirements file and/or can you link your repository?

Sure thing. Here is a link to the requirements.txt file

Repository link here with the page I’m having issues with at pages/

I’ve never used this package, so I’m no expert. Looking at the documentation I gather you’ll need to get the setup for BLAST+ also included with your dependencies. The app dependencies link I posted above would be the starting point if you need to go beyond what you can pip install. I don’t know how quick I’m going to find the exact answer or if there will be some fundamental incompatibility depending on the exact architecture of BLAST+, but I thought I’d share at least that much while I’m passively poking around at it. :slight_smile:

(post deleted by author)

Hi, I did try adding in BLAST+ as a dependency via a conda environment.yml file, since BLAST+ didn’t appear to be installable via pip. Here is the link to my .yml file. Unfortunately I am still getting the error message message '/bin/sh: 1: blastp: not found'

I did a quick search to see if I could find another use case, and I found an example with blast where the dependency was recorded as blast instead of blast-plus. Did you by chance try it both ways? (I am kind of stabbing in the dark here, but just checking.)

Here was the gist I found: blast yaml file · GitHub

Yep, I’ve tried both. I separated blast and blast-plus into two separate apps (blast .yml link here, blast-plus .yml link here) and weirdly I’m getting new errors for both. It appears to be a streamlit/conda issue that I’m having a difficult time resolving. Thanks for all of your help and ideas so far!

Here is the full error message for the blast version, which is the same I get for the blast-plus version. The important line seems to be OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /home/appuser/.local/lib/python3.9/site-packages/certifi/cacert.pem but I don’t understand why I’m getting that.

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/", line 1129, in __call__

        return func(*args, **kwargs)

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda_env/cli/", line 80, in do_call

        exit_code = getattr(module, func_name)(args, parser)

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 75, in wrapper


      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 39, in display_notices

        channel_notice_responses = http.get_notice_responses(channel_name_urls, silent=silent)

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 36, in get_notice_responses

        return tuple(

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 39, in <genexpr>


      File "/home/appuser/.conda/lib/python3.9/concurrent/futures/", line 609, in result_iterator

        yield fs.pop().result()

      File "/home/appuser/.conda/lib/python3.9/concurrent/futures/", line 439, in result

        return self.__get_result()

      File "/home/appuser/.conda/lib/python3.9/concurrent/futures/", line 391, in __get_result

        raise self._exception

      File "/home/appuser/.conda/lib/python3.9/concurrent/futures/", line 58, in run

        result = self.fn(*self.args, **self.kwargs)

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 42, in <lambda>

        lambda args: get_channel_notice_response(*args), url_and_names

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 37, in wrapper

        return_value = func(url, name)

      File "/home/appuser/.conda/lib/python3.9/site-packages/conda/notices/", line 58, in get_channel_notice_response

        resp = session.get(url, allow_redirects=False, timeout=5)  # timeout: connect, read

      File "/home/appuser/.conda/lib/python3.9/site-packages/requests/", line 600, in get

        return self.request("GET", url, **kwargs)

      File "/home/appuser/.conda/lib/python3.9/site-packages/requests/", line 587, in request

        resp = self.send(prep, **send_kwargs)

      File "/home/appuser/.conda/lib/python3.9/site-packages/requests/", line 701, in send

        r = adapter.send(request, **kwargs)

      File "/home/appuser/.conda/lib/python3.9/site-packages/requests/", line 460, in send

        self.cert_verify(conn, request.url, verify, cert)

      File "/home/appuser/.conda/lib/python3.9/site-packages/requests/", line 263, in cert_verify

        raise OSError(

    OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /home/appuser/.local/lib/python3.9/site-packages/certifi/cacert.pem

`$ /home/appuser/.conda/bin/conda-env update -n base --file environment.yml`

  environment variables:

                 CIO_TEST=<not set>



           CURL_CA_BUNDLE=<not set>









       REQUESTS_CA_BUNDLE=<not set>

            SSL_CERT_FILE=<not set>

     active environment : None

       user config file : /home/appuser/.condarc

 populated config files : /home/appuser/.condarc

          conda version : 22.9.0

    conda-build version : not installed

         python version :

       virtual packages : __linux=5.10.133=0




       base environment : /home/appuser/.conda  (writable)

      conda av data dir : /home/appuser/.conda/etc/conda

  conda av metadata url : None

           channel URLs :




          package cache : /home/appuser/.conda/pkgs

       envs directories : /home/appuser/.conda/envs

               platform : linux-64

             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.12 Linux/5.10.133+ debian/11 glibc/2.31

                UID:GID : 1000:1000

             netrc file : None

           offline mode : False

An unexpected error has occurred. Conda has prepared the above report.

[17:32:24] ❗️ installer returned a non-zero exit code

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

[17:33:55] ❗️ Streamlit server consistently failed status checks

[17:33:55] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

When I try to get to the BLAST+ install files from here, I do get a username/password prompt from the FTP link. I did see in a gist that someone specified some security information in the configuration for BLAST+ (for something other than Streamlit Cloud), so my non-expert thought is that if this is possible, it will be necessary to manually copy the setup files for BLAST+ into your repository. However, I really am wondering if Streamlit Cloud will be able to accommodate the installation. I don’t know how complex of a thing BLAST+ is. It says it’s command line tools (rather than a Python package), so I don’t know if there is a way to get it on Streamlit Cloud or not. I haven’t personally done anything vastly complicated with the system myself.

Hopefully someone with deeper knowledge can chime in here, as I don’t think I’ll be quick to figure out more. :slight_smile:

Thans for all the work to look into it! I’ve been downloading the tools using conda (blast, blast-plus) so I didn’t need to copy BLAST+ setup files or provide a username/password.

I’ll also add that I’ve tried troubleshooting the above error OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /home/appuser/.local/lib/python3.9/site-packages/certifi/cacert.pem based on this previous forum post to little success. I get one of two errors based on my setup:

  • If I set the .yml python requirement to >= 3.9 and deploy with python3.10 in the advanced settings, the app loads but can’t find any packages that were installed via pip
  • If I set the .yml python requirement to == 3.10 and deploy with 3.10, the app fails to load with an error reading: ModuleNotFoundError: No module named 'conda.cli.main_info'

Maybe unrelated, but where in the repo are you putting the dependencies file? I noticed that the app is within the lefi/ folder and you were putting environment.yml in that same folder as well. I remember Streamlit Cloud failing if the dependencies file was not in the root of the repo, or if you had multiple dependency files – then the whole thing had to be rebooted.

Good point – I made sure to remove the environment.yml file in the root lefi/ directory, but I’m still getting similar conda issues. For example, this app (github repo here), using python3.10 during deployment, gives this error: ModuleNotFoundError: No module named 'conda.cli.main_info'

Generally, it’d be helpful to get more useful conda environment error messages-- it’s very difficult to troubleshoot things like this.

This seems to work in a separate repo using a requirements.txt. But not sure what kind of file is expected to test further, I just put some random fasta sequence and got an error (unrelated to dependencies).

What type of error did you get? It would be great to replicate what you made, since I’ve had issues using the requirements.txt approach since the blast package seems to require conda for installation. It’s possible that the error you got is related to what I’ve been dealing with.

I’d initially linked a requirements file I had been using but I unfortunately deleted it to try troubleshooting some of the other options (in retrospect, I should’ve kept things in separate directories).

It was not related to a missing dependency, it is an IndexError: string index out of range, coming from the process_fasta function. (Just curious, why not use Bio.SeqIO to parse the file?)

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/", line 564, in _run_script
    exec(code, module.__dict__)
  File "/app/lefi_blastplus/pages/", line 175, in <module>
    nodes, edges = fasta_to_dicts(fasta_file)
  File "/app/lefi_blastplus/pages/", line 50, in fasta_to_dicts
    fasta_dict = process_fasta(fasta_file)
  File "/app/lefi_blastplus/pages/", line 26, in process_fasta
    while lines[new_index][0] != '>':
IndexError: string index out of range

No good reason–I realized my mistake though and fixed the bug here. Very dumb error when I tried to make the parsing better, and I should probably just move to the SeqIO method.

Any other thoughts on how to get this to work? I’m still finding the conda environment-related error messages difficult to understand. Thanks for everyone’s input so far; I realize this is a bit tricky.

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