2

trying to install Python 3.7 in a container with base Ubuntu 23.04. I keep getting the following errors. Here's what I have tried:

RUN apt-get install -y python3.7 python3-pip:
#8 0.788 Package python3.7 is not available, but is referred to by another package.
#8 0.788 This may mean that the package is missing, has been obsoleted, or
#8 0.788 is only available from another source
#8 0.788
#8 0.796 E: Package 'python3.7' has no installation candidate
[4/9] RUN apt-get update -y && apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa -y 
 => ERROR [5/9] RUN apt-get update -y                                 
#8 1.246 Err:6 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu lunar Release
#8 1.246   404  Not Found
#8 1.275 Reading package lists...
#8 1.671 E: The repository 'https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu lunar Release' does not have a Release file.
#8 0.712 Ign:5 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu lunar InRelease
#8 1.155 Err:6 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu lunar Release
#8 1.155   404  Not Found [IP: xx.xx.xx.xx]
#8 1.187 Reading package lists...
#8 1.608 E: The repository 'https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu lunar Release' does not have a Release file.
 => ERROR [6/8] RUN apt-get install -y python3.7.16 python3-pip 
------
 > [6/8] RUN apt-get install -y python3.7.16 python3-pip:
#9 0.315 Reading package lists...
#9 0.691 Building dependency tree...
#9 0.777 Reading state information...
#9 0.810 E: Unable to locate package python3.7.16
#9 0.810 E: Couldn't find any package by glob 'python3.7.16'
#9 0.810 E: Couldn't find any package by regex 'python3.7.16'
  • 1
    Don't do this. If you need a different version of python for some task, use a virtual environment. If you change the default python interpreter on your system, you will break things. You can remove the deadsnakes ppa and you'll be able to fix the problems with your package management, assuming that's the only thing you added. – Nmath May 19 '23 at 21:50
  • 1
    The deadsnakes PPA is only available for LTS versions of Ubuntu, and 23.04 is not an LTS, which is why you got those 404 not found errors. – Archisman Panigrahi May 19 '23 at 23:08
  • I have the same problem and haven't found any way to do that. We may need to download the Python source or binary package and install it manually to this version of Ubuntu. – csmaster May 20 '23 at 04:01
  • Maybe install your python verion in /usr/local. Found a manual in german: https://wiki.ubuntuusers.de/Python/manuelle_Installation/ – Marco May 20 '23 at 10:17
  • @Nmath my code base in 3.7, doing apt-get install python3 goes python 3.11 which is why I am trying to stay on 3.7. I guess the only option is to do it via source. – VIshu Kamble May 21 '23 at 13:49
  • That would not be a good decision for the reasons I mentioned above. In addition to that, building from source can cause even more problems with dependencies and other package management issues since it won't be installed by your package manager. Use a virtual environment. – Nmath May 22 '23 at 05:24

0 Answers0