Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image should hard-code python executable path #933

Open
kdm9 opened this issue Feb 12, 2025 · 2 comments
Open

Docker image should hard-code python executable path #933

kdm9 opened this issue Feb 12, 2025 · 2 comments

Comments

@kdm9
Copy link

kdm9 commented Feb 12, 2025

Have you checked the FAQ? https://github.com/google/deepvariant/blob/r1.8/docs/FAQ.md:

Describe the issue:

Currently, the run_deepvariant and similar bash wrappers use just python3 as the interpreter for the corresponding run_deepvariant.py etc scripts, meaning the python interpreter is picked from $PATH at runtime. While generally advisable, in the case of a docker image we do want to force the use of the specific docker-image-wide python3, /usr/bin/python3. This way, the python executable with all dependencies installed is used, irrespective of any user shell configuration exposed to the container that might set PATH such that some external python3 is preferred above the image-wide one. This is particularly a problem with apptainer, which by default maps a user's home directory, so that if someone has a python3 installed in e.g. ~/opt with $PATH set to prefer that above /usr/bin, then the python3 from e.g. ~/opt/python3/bin/python3 will have higher PATH priority than the (docker-image) /usr/bin/python3.

AFAICT this would be easily fixed by using /usr/bin/python3 in place of just python3 here, and subsequent occurrences

'python3 /opt/deepvariant/bin/make_examples.zip "$@"' > \

I'm happy to make a PR, if you accept them from folks outside google.

This is also the very simple workaround: in place of /opt/deepvariant/bin/run_deepvariant, use /usr/bin/python3 /opt/deepvariant/bin/run_deepvariant.py, however this probably still should be fixed as the docs use the bash wrapper.

Setup

  • Operating system: Any unix, but I am on Debian 12
  • DeepVariant version: 1.6 and 1.8
  • Installation method (Docker, built from source, etc.): Docker via apptainer
  • Type of data: (sequencing instrument, reference genome, anything special that is unlike the case studies?)

Steps to reproduce:

  • Command: Set PATH such that some other python3 is preferred over /usr/bin, and map that path through with docker/apptainer. There will be import errors, as these "external" pythons don't have deepvariant or deps installed.
  • Error trace: (if applicable)

Does the quick start test work on your system?
Please test with https://github.com/google/deepvariant/blob/r0.10/docs/deepvariant-quick-start.md.
Is there any way to reproduce the issue by using the quick start?

Any additional context:

@danielecook
Copy link
Collaborator

@kdm9 I think this should be ok. Let me test and see if there are any issues.

No need to open a PR. However, have you tested this change with apptainer yourself?

@kdm9
Copy link
Author

kdm9 commented Feb 12, 2025

Great, thanks. I tested it "manually" in that I used vi to change it for run_deepvariant in a container, but I didn't test the modifications I suggested to the docker build script. The effect should be identical, so long as I understand the docker build process correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants