I'm trying to build a docker image from the docker file:
FROM ubuntu:18.04
# Install tzdata
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
# Install Python, Bowtie2 and Java
RUN apt-get install -y python3.10 python3-pip \
openjdk-8-jdk \
bowtie2 \
wget
RUN apt-get install --yes --no-install-recommends \
zlib1g-dev \
libbz2-dev \
liblzma-dev
# Install RSeQC
RUN apt-get install -y python-pip &&\
pip install RSeQC
# Install biopython=1.80
RUN pip install biopython
# Install Atria
RUN wget https://github.com/cihga39871/Atria/releases/download/v3.1.2/atria-3.1.2-linux.tar.gz && \
tar -zxf atria-3.1.2-linux.tar.gz && \
mv atria-3.1.2/bin/atria /usr/local/bin/atria && \
chmod x /usr/local/bin/atria
#Atria dependencies
RUN apt-get install pigz pbzip2
# Install findtail
RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/findtail/findtail_v1.01 && \
mv findtail_v1.01 /usr/local/bin/findtail_v1.01 && \
chmod x /usr/local/bin/findtail_v1.01
# Cleanup
RUN apt clean
But while on Step 6/10 : RUN pip install biopython
it gives the error :
---> Running in 062f9c27cc15
Collecting biopython
Downloading https://files.pythonhosted.org/packages/3d/2f/d9df24de05d651c5e686ee8fea3afe3985c03ef9ca02f4cc1e7ea10aa31e/biopython-1.77.tar.gz (16.8MB)
Complete output from command python setup.py egg_info:
Biopython requires Python 3.6 or later. Python 2.7 detected.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mgUybW/biopython/
The command '/bin/sh -c pip install biopython' returned a non-zero code: 1
I've check the python version on my pc. I'm running python version 3.10.6 on my OS and in the dockerfile I'm trying to incorporate python 3.10 version. Where is this error coming from?
CodePudding user response:
The default Python version in Ubuntu 18.04 is 3.6. However, on line 19, you are installing the python-pip
package, i.e. the Python 2 version of the pip package manager, which in turn depends on the Python 2.7 package and thus will install Python 2.7.
Which means from this point on, you have two Python versions installed on the system, with two Python VM executables, python
and python3
, and two pip executables, pip
and pip3
.
It is not clear why you install Python 2.7 and python-pip
on line 19 when you have already installed Python 3.10 and python3-pip
on line 8. Nor is it clear why you install BioPython using pip
, i.e. the Python 2 version instead of pip3
, i.e. the Python 3 version.
I would not install Python 2 at all, since it has not been maintained or supported for several years. I would also not use Ubuntu 18.04, which will be out of standard support in 4 months, unless you are paying for the Extended Security Maintenance. The latest Long-Term Support version of Ubuntu is 22.04.1 which has standard support until April 2027 and extended support until April 2032.