Phil O
Phil O

Reputation: 1668

docker build ERROR: Could not install packages due to an EnvironmentError: [Errno 2]

I'm getting this error when I run docker build while its processing the requirements file.

ERROR: Could not find a version that satisfies the requirement mkl-fft==1.0.6 (from -r /requirements.txt (line 44)) (from versions: none)
ERROR: No matching distribution found for mkl-fft==1.0.6 (from -r /requirements.txt (line 44))
The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1

Suggestions?

Dockerfile:

FROM python:3.6-alpine
MAINTAINER My Project

ENV PYTHONUNBUFFERED 1

COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

RUN mkdir /app
WORKDIR /app
COPY . /app

RUN adduser -D user
USER user

requirements.txt:

asgiref==3.2.10
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
click==7.1.2
cymem==2.0.3
cytoolz==0.9.0.1
dill==0.2.9
Django==3.0.7
djangorestframework==3.11.0
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz
gunicorn==20.0.4
idna==2.10
intervaltree==3.0.2
joblib==0.15.1
msgpack==0.6.1
msgpack-numpy==0.4.3.2
murmurhash==1.0.2
nltk==3.5
numpy==1.15.4
plac==0.9.6
preshed==2.0.1
pycparser==2.20
pyOpenSSL==19.1.0
pyreadline==2.1
PySocks==1.7.1
python-dateutil==2.8.1
pytz==2020.1
regex==2020.6.8
requests==2.24.0
six==1.15.0
sortedcontainers==2.2.2
spacy==2.0.16
SQLAlchemy==1.3.18
sqlparse==0.3.1
thinc==6.12.1
toolz==0.10.0
tqdm==4.47.0
ujson==3.0.0
urllib3==1.25.9
win-inet-pton==1.1.0
wincertstore==0.2
wrapt==1.10.11
mkl-fft==1.0.6
mkl-random==1.0.1
brotlipy==0.7.0
cryptography==2.9.2
pandas==1.0.5
psycopg2==2.8.4
TBB==0.1

With help from https://stackoverflow.com/users/5666087/jakub I've changed my Dockerfile to use the image FROM continuumio/miniconda3:4.8.2

I've changed my requirements file to:

asgiref==3.2.10
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
click==7.1.2
cymem==2.0.3
cytoolz==0.9.0.1
dill==0.2.9
Django==3.0.7
djangorestframework==3.11.0
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz
gunicorn==20.0.4
idna==2.10
intervaltree==3.0.2
joblib==0.15.1
msgpack==0.6.1
msgpack-numpy==0.4.3.2
murmurhash==1.0.2
nltk==3.5
numpy==1.15.4
plac==0.9.6
preshed==2.0.1
pycparser==2.20
pyOpenSSL==19.1.0
pyreadline==2.1
PySocks==1.7.1
python-dateutil==2.8.1
pytz==2020.1
regex==2020.6.8
requests==2.24.0
six==1.15.0
sortedcontainers==2.2.2
spacy==2.0.16
SQLAlchemy==1.3.18
sqlparse==0.3.1
thinc==6.12.1
toolz==0.10.0
tqdm==4.47.0
ujson==3.0.0
urllib3==1.25.9
win-inet-pton==1.1.0
wincertstore==0.2
wrapt==1.10.11
brotlipy==0.7.0
cryptography==2.9.2
pandas==1.0.5
tbb
psycopg2-binary==2.8.5
mkl-fft
mkl-random

And I'm left with the error:

ERROR: Could not find a version that satisfies the requirement mkl-fft (from -r /requirements.txt (line 49)) (from versions: none)
ERROR: No matching distribution found for mkl-fft (from -r /requirements.txt (line 49))
The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1

Upvotes: 1

Views: 4482

Answers (2)

juanjosegdoj
juanjosegdoj

Reputation: 309

It's because the latest library of mkl-fft is not compatible with python:3.6-alpine your python version. Keep the version in the requirements.txt, thus mkl-fft==1.0.6.

In a more general way, for any other library: You have two options.

  1. Look for another version of the library that supports your current python:XXX.
  2. Change your python version in order to find out another library that is presenting issues.

Upvotes: 0

jkr
jkr

Reputation: 19260

The error

ERROR: Could not find a version that satisfies the requirement mkl-fft==1.0.6 (from -r /requirements.txt (line 44)) (from versions: none)
ERROR: No matching distribution found for mkl-fft==1.0.6 (from -r /requirements.txt (line 44))
The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1

occurs because you are using an Alpine-based image (which uses MUSL instead of glibc) while trying to install manylinux wheel files (which are glibc) (see https://github.com/docker-library/docs/issues/904). An easy way around this is to use python:3.6-slim, which is based on Debian.

However, there are other issues in the requirements.txt file. You will have to install a compiler (e.g., gcc) to install cytoolz and some other packages.

If you don't want to have to compile packages, you can look into miniconda3 docker image (https://hub.docker.com/r/continuumio/miniconda3). That that package manager ships pre-compiled packages.

Upvotes: 1

Related Questions