'No matching distribution found for package have "ubuntu" in there name

I am have some problem while install pip package in docker image.

My Dockerfile is like this

....
RUN python -m venv /vir_env
RUN . /vir_env/bin/activate && pip install --upgrade pip
RUN pip install -r ./requirements.txt
....

My requirements.txt file is generate by pip freeze > requirements.txt

But when I run docker build it always error in package have "ubuntu" in there name python-apt==2.0.0+ubuntu0.20.4.6, distro-info===0.23ubuntu1

Error log:

....
#13 5.890 ERROR: No matching distribution found for python-apt==2.0.0+ubuntu0.20.4.6
#13 6.360 WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
#13 6.360 You should consider upgrading via the '/vir_env/bin/python3 -m pip install --upgrade pip' command.
------
error: failed to solve: executor failed running [/bin/sh -c . /vir_env/bin/activate && pip3 install -r /requirements.txt]: exit code: 1
....
#13 5.890 ERROR: No matching distribution found for distro-info===0.23ubuntu1
#13 6.360 WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
#13 6.360 You should consider upgrading via the '/vir_env/bin/python3 -m pip install --upgrade pip' command.
------
error: failed to solve: executor failed running [/bin/sh -c . /vir_env/bin/activate && pip3 install -r /requirements.txt]: exit code: 1

I already try pip upgrade but not don't work.

Is there any other way to fix or is there any update about this but I missed ?



Solution 1:[1]

I still don't know what problem is it.

But I make new ubuntu container and install package manually and try pip freeze > requirements.txt it don't generate any pip package with "ubuntu" in there name.

I think there is some problem with my docker or my pip package.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MMicls