How to install Python 3.7 packages to Docker?

How to install Python 3.7 packages to Docker?

You will face a similar issue with mimetypes module too. Even this is part of python base and you dont need to install it manually. Also, you can have all the required modules in a requirements.txt file and install them at once. For that, you need to copy the requirements file into the docker image before running install.

requirements.txt

nibabel
pydicom
matplotlib
pillow
med2image
pandas
xlsxwriter
numpy
boto
boto3
botocore
oauth2client
urllib3
httplib2
apiclient

Dockerfile

FROM alpine
MAINTAINER <abc@gmail.com>
FROM python:3.7

COPY requirements.txt /tmp
WORKDIR /tmp
RUN pip install --upgrade pip && 
    pip install -r requirements.txt

You didnt make a mistake. The cStringIO module doesnt exist anymore. Just remove the email module from your pip install since it is already a part of python base and you should be good to go.

How to install Python 3.7 packages to Docker?

Leave a Reply

Your email address will not be published. Required fields are marked *