Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing scikit-learn in docker with python 3.8

I have the following dockerfile

FROM python:3.8-slim-buster

RUN pip install scikit-learn==0.21.3

The docker build . doesn't work, returning

        from Cython import Tempita
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------

Is there a way to use scikit-learn in python 3.8 via docker? I am particularly interested to build on top of python:3.8-slim-buster.

like image 947
David Masip Avatar asked Jul 02 '26 00:07

David Masip


1 Answers

You probably need to add this to your docker file to add Cython layer before you try to install scikit-learn

RUN pip install Cython --install-option="--no-cython-compile"
like image 86
Brian Horakh Avatar answered Jul 04 '26 14:07

Brian Horakh