[x] I searched existing issues before opening this one
Expected behavior
Similar behavior on both hosts. Specifically, matplotlib (numpy) library should be imported on both hosts.
Actual behavior
I try to import matplotlib (numpy) python module but an error is occurred. When I build and run the docker image on a mac with macOS mojave 10.14.2 everything is working fine. When I move the same image to Ubuntu 16.04.5 LTS server it fails. The image has as base image python:3-alpine that uses alpine linux.
I switch the base image to python:3 that uses debian stretch and everything is working as expected.
FROM python:3-alpine
RUN apk --no-cache --update-cache add build-base wget freetype-dev libpng-dev openblas-dev
RUN pip3 install pipenv
RUN set -ex && mkdir /app
WORKDIR /app
COPY Pipfile .
COPY Pipfile.lock .
RUN set -ex && pipenv install
COPY . .
ENTRYPOINT ["/bin/sh"]
Build image & start docker container:
docker build -t my_image .
docker run -it my_image
Inside docker container:
pipenv run python
Python 3.7.2 (default, Dec 29 2018, 07:16:08)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/matplotlib/pyplot.py", line 32, in <module>
import matplotlib.colorbar
File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/matplotlib/colorbar.py", line 28, in <module>
import matplotlib.artist as martist
File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/matplotlib/artist.py", line 11, in <module>
from .path import Path
File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/matplotlib/path.py", line 17, in <module>
from . import _path, rcParams
ImportError: numpy.core.multiarray failed to import
Output of docker version:
macOS mojave 10.14.2:
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:47:43 2018
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:55:00 2018
OS/Arch: linux/amd64
Experimental: true
Ubuntu 16.04.5 LTS:
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:57 2018
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:16:44 2018
OS/Arch: linux/amd64
Experimental: false
Expected behavior
Similar behavior on both hosts. Specifically, matplotlib (numpy) library should be imported on both hosts.
Actual behavior
I try to import matplotlib (numpy) python module but an error is occurred. When I build and run the docker image on a mac with macOS mojave 10.14.2 everything is working fine. When I move the same image to Ubuntu 16.04.5 LTS server it fails. The image has as base image
python:3-alpine
that uses alpine linux.I switch the base image to
python:3
that uses debian stretch and everything is working as expected.First I open an issue at matplotlib repo: https://github.com/matplotlib/matplotlib/issues/13059 but they said that it seems to be a docker issue.
Steps to reproduce the behavior
Dockerfile
Build image & start docker container:
Inside docker container:
Output of
docker version
:macOS mojave 10.14.2:
Ubuntu 16.04.5 LTS:
Output of
docker info
:macOS mojave 10.14.2:
Ubuntu 16.04.5 LTS:
Additional environment details (AWS, VirtualBox, physical, etc.)