2

I am trying to install scikit-image in alpine docker but for some reason it is keep throwing No module named 'numpy' error

Here is the Dockerfile

COPY requirements.txt requirements.txt
# Installing System Libraries and Python Dependencies
RUN apk update && apk add --no-cache gcc musl-dev make && ln -s /usr/include/locale.h /usr/include/xlocale.h \
&& pip install -r requirements.txt && apk del gcc musl-dev make

And Here is the requirements.txt

numpy
matplotlib
scikit-image
scikit-learn

2 Answers 2

0

Since you are using an alpine image and making use of the pip package manager, you need to include in the apk update section as well.

FROM alpine
COPY ./requirements.txt /temp/requirements.txt
# Installing System Libraries and Python Dependencies
WORKDIR '/temp'
RUN apk update && apk add --update py-pip && apk add --no-cache gcc musl-dev make && ln -s /usr/include/locale.h /usr/include/xlocale.h \
&& pip install -r requirements.txt && apk del gcc musl-dev make

Since you are using the alpine as the base image, Make sure to add the other packages as well that requires for your requirement libraries.

Sign up to request clarification or add additional context in comments.

1 Comment

I have the same issue and I am using python:3.8.0 image and numpy comes before skimage in the requirements.txt file, any ideas what the error is?
0

I have the same problem. I tried to install numpy alone

pip install numpy

then install the requirements file as follows:

pip install -r requirements.txt

This workaround solved my issue. hope it helped!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.