Не получается установить tensorflow в Docker

Мой Dockerfile:

# syntax=docker/dockerfile:1
FROM python:3.9.13-alpine3.16
WORKDIR /code
ENV FLASK_APP=index.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
RUN pip install setuptools==59.8.0 && pip install numpy==1.19.2
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]

requirements.txt:

gensim==4.1.0
flask
razdel
pymorphy2
nltk==3.6.2
requests==2.27.1
tensorflow==2.6.0

Ошибка:

#0 8.879 ERROR: Could not find a version that satisfies the requirement tensorflow==2.6.0 (from versions: none)
#0 8.879 ERROR: No matching distribution found for tensorflow==2.6.0

В файле requirements.txt я пробовал не указывать версию tensorflow, но у меня все равно такая же ошибка.


Ответы (1 шт):

Автор решения: Makss123

Помогло исправить Dockerfile на:

# syntax=docker/dockerfile:1
FROM python:3.9.13

RUN apt-get update \
    && apt-get install -y \
        cmake libsm6 libxext6 libxrender-dev protobuf-compiler \
    && rm -r /var/lib/apt/lists/*
    
WORKDIR /code
ENV FLASK_APP=index.py
ENV FLASK_RUN_HOST=0.0.0.0

RUN pip install setuptools==59.8.0 && pip install numpy==1.19.2
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]
→ Ссылка