Score:1

Error Installing python 3.7 on Ubuntu 23.04

gr flag

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'
Nmath avatar
ng flag
Don't do this. If you need a different version of python for some task, use a [virtual environment](https://askubuntu.com/q/244641). 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.
us flag
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.
csmaster avatar
in flag
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.
Marco avatar
br flag
Maybe install your python verion in `/usr/local`. Found a manual in german: https://wiki.ubuntuusers.de/Python/manuelle_Installation/
VIshu Kamble avatar
gr flag
@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.
Nmath avatar
ng flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.