简体   繁体   中英

How to install scikit-learn, pandas and numpy in a docker image?

I am doing a project using the PySEAL library. My project is Machine Learning related so I want to use scikit-learn, pandas and numpy libraries. How can I install these libraries so that I can use them in PySEAL docker container's code?

Simply add numpy and scikit-learn to PySEAL's requirements file .

Your final requirements file should be:

pybind11
cppimport
jupyter
numpy
scikit-learn

And run build-docker.sh again.

Within your python project, you can freeze the python packages with pip freeze and then add the following commands to your Dockerfile:

COPY ./requirements.txt /var/code/requirements.txt
WORKDIR /var/code
RUN pip install -r requirements.txt

I had the same error in OpenShift 4.6 environment. So i had to update my requirements.txt and run start-build command again

Flask==1.1.1
numpy
pandas
sklearn

Then run the below command in order oc cli to update and rebuild the image and restart the pods

oc start-build my-app --from-dir . --follow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM