Is there a Pyinstaller hook for Biopython imports? How to package a Biopython script into executable?
0
0
Entering edit mode
2.5 years ago
A. Kozubik • 0

I have a script written in Python 3.7.2 with following imports:

from Bio import SeqIO
from Bio import SearchIO
from Bio import ExPASy
from Bio import SwissProt
from Bio.Blast import NCBIWWW

and I am attempting to package it into an .exe file, which fails because of the missing Bio imports. Probably the easiest solution would be to use a pyinstaller hook for Bio, but I couldn't find it anywhere and I don't think I know enough about Biopython and Python in general to create one myself. Alternativelly, is there any other way besides Pyinstaller to package a Biopython script into a standalone executable?

Thanks in advance!

Biopython python hook import pyinstaller • 762 views
ADD COMMENT
1
Entering edit mode

I think you might have better luck just making a Docker container for it under a Linux base image, and try using that Windows (which I assume since you are trying to build .exe). Failing that, just load an Ubuntu virtual machine in VirtualBox on Windows. If you are using Python, especially with niche esoteric libraries, you should just save your sanity and assume it will not work as a standalone executable anywhere, let alone Windows. If you want a standalone executable, then you really should not be using Python in the first place.

ADD REPLY
0
Entering edit mode

Thank you for your reply. I was afraid that indeed might be the case, since I've seen that even in the Biopython mailing list, nobody came up with any truly working solution.

Setting up a VM, while it might be functional, would go against the primary intentions of why I'm trying to pack the script into .exe, which is smoothing the user experience (people who will be using the script are not bioinformaticists).

For now, I've partially solved the problem by separating the script into two, where the first part requires Biopython libraries and therefore can be executed only via command line with Python installed, and the second part, which uses standard libraries, is packed into .exe

However, I will look into the possibilities of using a Docker container, thanks for the tip!

And yes, I have already experienced the pain of fruitless Biopython questioning on StackExchange and StackOverflow, which is why I'm surprised that my question would be marked as off topic here - when Biopython and how to make it run should be a relevant topic here.

ADD REPLY
1
Entering edit mode

also I would disagree about this being off-topic for the site. Getting help with niche Bioinformatics libraries from a general site like StackExchange is quite often an exercise in futility. A site like BioStars is a much better place for it because its more likely to have users with insight into these specific packages.

ADD REPLY
0
Entering edit mode

Hello A. Kozubik!

We believe that this post does not fit the main topic of this site.

Pure Python question. Please seek help at StackExchange.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Reopened

ADD REPLY

Login before adding your answer.

Traffic: 1821 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6