Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensforflow-cpu 2.12.0 suddenly stopped working with Python 3.7-slim #66211

Open
gsamaras opened this issue Apr 22, 2024 · 5 comments
Open

Tensforflow-cpu 2.12.0 suddenly stopped working with Python 3.7-slim #66211

gsamaras opened this issue Apr 22, 2024 · 5 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author TF 2.12 For issues related to Tensorflow 2.12 type:support Support issues

Comments

@gsamaras
Copy link

gsamaras commented Apr 22, 2024

I have a Dockerfile that was working fine until recently. I made a software update in my Oracle VM VirtualBox Ubuntu 20.04.3 LTS x86_64, and after that the build would fail, due to version incompatibility. If update the version of tensforflow-cpu or Python, then a chain reaction happens with all the other packages I use, and like a Hydra head, build and/or runtime errors spawn continuously.

I see here https://pypi.org/project/tensorflow-cpu/2.12.0/ that tensorflow-cpu 1.12.0 has Python 3.9 as minimum Python version. However, I am pretty sure I was able to have everything perfectly work with Python 3.7-slim (slim may does a difference). Did something change in the dependencies of tensorflow-cpu 1.12.0? Could it be that the Python dependency changed recently?

Dockerfile:

# Build stage
FROM python:3.7-slim AS build
WORKDIR /todo

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt-get update

RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*

RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh 
RUN conda --version
RUN apt-get --purge autoremove -y wget

RUN python -m pip install --no-cache-dir --no-deps tensorflow-cpu==2.12.0 # <--- ERROR HERE

# Runtime stage
FROM python:3.7-slim
WORKDIR /todo

RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

COPY --from=build /root/miniconda3 /root/miniconda3
COPY requirements.txt requirements.txt
COPY get_predict_m_data.py get_predict_m_data.py

ENV PATH="/root/miniconda3/bin:${PATH}"
ENV PATH="/usr/local/lib/:${PATH}"

RUN pip3 install --no-cache-dir -r requirements.txt

ENV PORT 5556
EXPOSE 5556

RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

CMD ["python", "-u", "get_predict_m_data.py"]

Output with Error:

gsamaras@lv74744332234a:~/Code$ sudo docker build --no-cache -t predict_api .
[sudo] password for gsamaras: 
[+] Building 36.1s (14/23)                                                                                                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 1.68kB                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/python:3.7-slim-buster                                                                                                                             3.4s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                                                         0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [build 1/8] FROM docker.io/library/python:3.7-slim-buster@sha256:9bd2bfc822a533f99cbe6b1311d5bf0ff136f776ebac9b985407829f17278935                                                                 0.0s
 => [internal] load build context                                                                                                                                                                     0.0s
 => => transferring context: 533B                                                                                                                                                                     0.0s
 => CACHED [build 2/8] WORKDIR /todo                                                                                                                                                                  0.0s
 => [build 3/8] RUN apt-get update                                                                                                                                                                    6.5s
 => CANCELED [stage-1  3/12] RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*                                                                                            32.7s
 => [build 4/8] RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*                                                                                                          2.9s
 => [build 5/8] RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && mkdir /root/.conda && bash Miniconda3-latest-Linux-x86_64.sh -b && rm -f Miniconda3-latest-Linux-  20.8s
 => [build 6/8] RUN conda --version                                                                                                                                                                   0.5s
 => [build 7/8] RUN apt-get --purge autoremove -y wget                                                                                                                                                0.5s
 => ERROR [build 8/8] RUN python -m pip install --no-cache-dir --no-deps tensorflow-cpu==2.12.0                                                                                                       1.4s
------                                                                                                                                                                                                     
 > [build 8/8] RUN python -m pip install --no-cache-dir --no-deps tensorflow-cpu==2.12.0:                                                                                                                  
1.094 ERROR: Could not find a version that satisfies the requirement tensorflow-cpu==2.12.0 (from versions: 2.16.0rc0, 2.16.1)                                                                             
1.094 ERROR: No matching distribution found for tensorflow-cpu==2.12.0                                                                                                                                     
------                                                                                                                                                                                                     
Dockerfile:22                                                                                                                                                                                              
--------------------                                                                                                                                                                                       
  20 |     RUN apt-get --purge autoremove -y wget                                                                                                                                                          
  21 |                                                                                                                                                                                                     
  22 | >>> RUN python -m pip install --no-cache-dir --no-deps tensorflow-cpu==2.12.0                                                                                                                       
  23 |                                                                                                                                                                                                     
  24 |     # Runtime stage
--------------------
ERROR: failed to solve: process "/bin/sh -c python -m pip install --no-cache-dir --no-deps tensorflow-cpu==2.12.0" did not complete successfully: exit code: 1
@Venkat6871 Venkat6871 added type:support Support issues TF 2.12 For issues related to Tensorflow 2.12 labels Apr 24, 2024
@Venkat6871
Copy link

Hi @gsamaras ,

  • Could you please update tensorflow to a newer version that is compatible with Python 3.7-slim. Newer versions of tensorflow often include bug fixes, performance improvements, and compatibility updates.
  • Here i providing link for your reference. please go through it once for checking compatible. And let us know if the issue still persists?

Thank you!

@Venkat6871 Venkat6871 added the stat:awaiting response Status - Awaiting response from author label Apr 24, 2024
@gsamaras
Copy link
Author

Hi @Venkat6871, if I update Tensorflow to let's say 2.16.1, then I get myriads of compatibility/runtime issues, so for now I want to postpone upgrading Tensorflow please.

I was able to use Tensorflow 2.12.0 with Python3.7-slim a month ago or so, why I cannot do this now please? I am looking for an explanation, so that I can weigh my options.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Apr 24, 2024
@Venkat6871
Copy link

Hi @gsamaras ,

  • It might have worked at that time, but now it won't work due to compatibility issues. For TensorFlow 2.12.0 we need to use python version "3.8-3.11", only then it will work. Here i am providing link for your reference.

Thank you!

@Venkat6871 Venkat6871 added the stat:awaiting response Status - Awaiting response from author label Apr 25, 2024
@gsamaras
Copy link
Author

@Venkat6871 thank you for getting back to me. I am sure that TF 2.12.0 was working perfectly with Python 3.7-slim a month ago or so.

The link you provide redirects me to an SSO link for google.com I think, was that your intention?

I want to understand why it was working before and now it does not. Could it be that the Python dependency for TF 2.12.0 changed? If so, is there a link or similar that shows that change/edit history please?

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Apr 25, 2024
@Venkat6871
Copy link

Hi @gsamaras ,

  • As my observation there is no changes in TF 2.12.0, It might be changed in Python 3.7-slim. That's Why it works may be a month ago. But there is no chance to work because of compatibility issues.
  • I just provided a screenshot belongs to compatibility versions for your reference. TensorFlow 2.12.0 we need to use python version "3.8-3.11".

Thank you!

@Venkat6871 Venkat6871 added the stat:awaiting response Status - Awaiting response from author label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author TF 2.12 For issues related to Tensorflow 2.12 type:support Support issues
Projects
None yet
Development

No branches or pull requests

2 participants