Unable to upgrade past 3.6.9

Hello. I am unable to upgrade past python 3.6.9, even though I have tried multiple methods (some of which created other problems!) I am reluctant to ‘install it manually’ (build using source tarball from Python.org) – I will expand on this later.

I am using GalliumOS (linux for chromebooks), based on Ubuntu 18.04 (bionic). YES, I know it is old but GalliumOS has not been updated (depreciated?), and it is the version of linux that works on my Chromebook. Right now, GalliumOS works FINE except that I can’t install python past 3.6.9

I think that I cannot install any higher versions of python since it is not part of the Bionic repositories. I tried using deadsnakes repositories, but no luck. This is what I see when I try to sudo apt install python3.9:

E: Unable to locate package python3.9
E: Couldn't find any package by glob 'python3.9'
E: Couldn't find any package by regex 'python3.9'

whereis -b python gives me:

python: /usr/bin/python3.6-config /usr/bin/python3.6m-config /usr/bin/python3.6 /usr/bin/python2.7 /usr/bin/python /usr/bin/python3.6m /usr/bin/python2.7-config /usr/lib/python3.7 /usr/lib/python3.6 /usr/lib/python2.7 /usr/lib/python3.8 /etc/python3.6 /etc/python2.7 /etc/python3.8 /etc/python /usr/local/lib/python3.6 /usr/local/lib/python2.7 /usr/include/python3.6 /usr/include/python2.7 /usr/include/python3.6m /usr/share/python

I have been having problems installing modules for python (eg. pygame, and even a problem with PIP). I don’t know if this is related to my current problem.

I had a heck of a time fixing the problems mentioned above (and I am still not sure why/how I did it). It is working right now, and i am reluctant to ‘screw’ with my system in case it gets messed up again. That is why I am reluctant to install 3.13 from tarball. (Do I need to install other versions first, or can I jump right to 3.13? Will this override the other versions installed? Will this installation mess with my current setup?)

Any suggestions??

See 2. Using Python on Unix platforms — Python 3.13.0 documentation and be sure to use make altinstall

OK, thank you, I’ll try it.

But as I said above, I am VERY worried that it will mess up my system (see previous problems in link).

Also, wouldn’t altinstall just install another version? What about the other versions, shouldn’t they be ‘removed’? How does the system know to use THIS version? (note that this is part of the problems I have having previously)

Maybe I should wait for your reply before I use the tarball

1 Like

So, you’re on an old and unsupported OS, and you want a newer Python. Good news: That is definitely possible. Minorly bad news: You won’t be able to use apt to install it.

As Elis has said, the best option is to build from source. Personally, I like to fetch from git and build the bleeding edge version, but I’m crazy like that :slight_smile: If you prefer, grabbing a tarball will mean you’re getting a known release with (hopefully) fewer bugs. I won’t go into more details about how you do that, as the instructions are all there. But there are a few things to be aware of when you build a separate Python:

  1. This does NOT affect system scripts. That’s a very good thing, since some of them might not work! But if you were messing around with changes to system scripts, you’ll have to keep that in mind (either switch from the system Python to your own, or stick to the old version). Also, you won’t get any security improvements for system-provided programs, although that’s not likely to be too big a deal.
  2. You may need to type python3.13 instead of python3, although if you prefer, you can change your own $PATH to make that work the way you want.
  3. Any Python modules installed using apt (eg apt install python3-requests) will work with the system Python; any installed using pip (eg python3.13 -m pip install requests) will work with the version of Python you installed them with. On that subject, using python[SOMETHING] -m pip is the most reliable way to do this, rather than a shorthand like pip3 install requests, as it’ll always use the corresponding Python.
  4. In fact, it’s probably easiest, when you have multiple Pythons installed, to make good use of virtual environments. python3.13 -m venv env followed by source env/bin/activate will set you up with a venv that is built on Python 3.13.

These are fairly small considerations but they’re worth keeping in mind.

To answer a couple of your smaller questions:

Jump right to 3.13. It’s fine. They won’t upgrade, they’ll simply run in parallel. You can have any combination of Pythons installed, and they won’t trample on each other.

Nope! Do be aware of the altinstall feature though; although even if you make install, chances are it won’t break much - at worst, it’ll just mean that the name python3 now refers to 3.13, which might be what you want. Normally, the one you build from source will be installed into /usr/local/bin, and the one from apt will be installed in /usr/bin, and system scripts will be written with #!/usr/bin/python3.6 in them to make sure they run with the right Python. (Or maybe #!/usr/bin/python3 - not sure. But they’ll almost certainly have the exact path.)

No, subject to the caveat about proper use of pip. You will be learning some new tricks here, but within the rules of those new tricks, it’s straight-forward enough to have all the different versions.

Hopefully that’ll get you going!

Finally, the documentation you directed me to was not very helpful (unless one is more experienced with the make process).

I assume the process on this page is what is presented here (but more step-by-step)?

If so, would I have to build the dependencies first (as noted on this page)?

Yes, it will install another version. So will make install. The only difference is whether the new one takes the convenient name python3 or if it’s only available using python3.13.

Not unless YOU remove them (which you shouldn’t).

System scripts will continue to use the system Python. You can explicitly request any installed version by giving its full name (python3.6 or python3.13 or whichever). You can choose what the python3 command does.

Ah, okay. This’ll be something worth getting comfortable with, but here’s a bit more of a rundown. I assume you’ve downloaded the tarball and extracted it into a directory, such as ~/Python-3.13.0.

  • Change into that directory: cd ~/Python-3.13.0
  • Make sure you have all your basic build dependencies: sudo apt build-dep python3 Note that technically this is installing the build dependencies for Python 3.6, but the deps for Python 3.13 will almost certainly be the same. Worst case, you might run into a problem and need to install one more package, eg liblzma-dev (if LZMA is missing).
  • Let Python search your system and find the things it needs: ./configure
  • If that fails, post here with what went wrong. Most likely, it’ll succeed, and then you can:
  • Build Python: make
  • Again, this will most likely succeed, but if it fails, post here and we can help.
  • Test the brand new Python: ./python It should drop you into the REPL using the not-yet-installed Python. You can mess around with it as normal. In fact, you could stop here and just use it like that if you like, but for convenience, you’ll want to:
  • Install this. sudo make altinstall

And that should all work, and give you a brand new Python, still hot from the oven! … don’t actually put snakes in the oven though, they’re warm blooded and … yeah, also, don’t mix your metaphors like this, it doesn’t end well.

2 Likes

Thank you! Both of you are very helpful.

[quote=“Chris Angelico, post:5, topic:69734, full:true, username:Rosuav”]
2. You may need to type python3.13 instead of python3, although if you prefer, you can change your own $PATH to make that work the way you want.[/quote]

YES, I was expected/plan to do this! Thanks for reminding me.

OK, but from my whereis -b python list, it seems that there are versions in BOTH these directories but I didn’t install any from source (unless they were there from the OS install)

OK, this is making me less worried. Still, I had significant problems with pip (and I still don’t know what I did to ‘fix’ it – I make extensive notes when I install/make changes, but no notes on this)

So, I guess I will follow the steps here? Sorry for being such a bother…

I think we were typing our posts simultaneously, but to specifically answer the question about build dependencies: apt build-dep is WAY easier than keeping track of what’s needed, that SO post is unnecessarily complicated for a typical Debian (or Ubuntu) system!

1 Like

Uh oh

[quote=“Chris Angelico, post:7, topic:69734, full:true, username:Rosuav”]
Make sure you have all your basic build dependencies: sudo apt build-dep python3 [/quote]

I get E: You must put some 'source' URIs in your sources.list

I just fixed this (repeated entries, from solutions I was trying). Not sure what to do.

I restored /etc/apt/sources.list, (non-commented out) contents below:

deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted 
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted 
deb http://security.ubuntu.com/ubuntu/ bionic-security universe 
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe 
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse 
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse 
deb [arch=amd64] https://packages.microsoft.com/repos/vscode/ stable main 
# deb-src [arch=amd64] https://packages.microsoft.com/repos/vscode/ stable main

I had made changes to /etc/apt/sources.list.d/deadsnakes-buuntu-ppa-bionic.list but that was only to remove repeated entries (thus causing errors). The errors went away after the fix.

Should I skip this step, or do something else?

[quote=“Garth Elliott, post:10, topic:69734, username:GarthE”]

Ah, interesting. Let’s check your apt sources:

cat /etc/apt/sources.list

(You may also have a directory /etc/apt/sources.list.d but on an old OS like that, I expect the relevant part is in sources.list itself)

Most likely you have 1-3 lines like this:

deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware

The exact URL won’t be the same, and it’ll probably say “bionic” where mine says “bookworm”, but it should be more-or-less like this.

If you do, the solution’s pretty easy. Edit the file with sudo -e /etc/apt/sources.list - this should drop you into nano or vim (I hope you’re comfortable with one or both of those editors, as it’ll make life a lot easier; I’ve no idea what your experience level is). Duplicate the line, and change deb at the start to deb-src. You’ll then have two lines (or more pairs if you had more sources) like this:

deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware

(but, again, saying what’s relevant to YOUR system, with the URL and such that you had). Then run sudo apt update to download all the packages.

On a current OS, that would be all you’d need. Everything would work from there. Unfortunately, I’ve no idea what GalliumOS does with their old package index files. Maybe they’ve kept them; maybe they’ve discarded them; or maybe they’re still around, but the URL needs to change. But if you’re lucky, the apt update command will find everything it needs.

If it DOES succeed, awesome! The build-dep command will now work. If not… post what you have in your sources.list, and what apt update said, and we can try to advise. You may also want to look for GalliumOS support forums, since this is less about Python and more about Gallium, and they may be better able to help.

Okay, yeah, you’ll need those deb-src lines in order to get the packages. This is talking about bionic-security though; is there any corresponding line that just says bionic? Is what you posted the entire sources.list?

Oops. I missed the other lines since they were buried in comments. Below is any ‘non-commented’ lines (so that I don’t waste space here):

deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted 
deb http://ca.archive.ubuntu.com/ubuntu/ bionic universe 
deb http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 

Plus the one’s I have already shown.

So, I should ‘uncomment’ the deb-src lines? I will do my best to remember vi! :slight_smile:

[quote=“Chris Angelico, post:14, topic:69734, full:true, username:Rosuav”]
This is talking about bionic-security though; is there any corresponding line that just says bionic?[/quote]

OK, so I have ‘added’ (or removed comment hash) these lines (from original list).

The other ones (I just sent) are the one’s I think you are referring to (“just says bionic”). Add the deb-src lines too (uncomment these lines)?

You’re very kind and patient, btw!

I jumped ahead and fixed those other (deb-src) lines.

I hate doing this, but here is the complete (fixed) sources.list file:

# deb cdrom:[GalliumOS 3.1 - Release amd64 (20191222)]/ apt/ 

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted 
deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted 

## Major bug fix updates produced after the final release of the
## distribution.
# deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates restricted main  
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted 

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic universe 
deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic universe 
# deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe  
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe 

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse 
deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse 
# deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse  
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse 

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 
deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu/ bionic partner 
# deb-src http://archive.canonical.com/ubuntu/ bionic partner 

deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted 
deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted 
deb http://security.ubuntu.com/ubuntu/ bionic-security universe 
deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe 
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse 
deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse 
deb [arch=amd64] https://packages.microsoft.com/repos/vscode/ stable main 
deb-src [arch=amd64] https://packages.microsoft.com/repos/vscode/ stable main

I notice some duplication (eg.
Does this look good, or do I need the other ones too (eg. # deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe) or are these the ‘duplicates’ that I got rid of (since they were causing errors)?

FYI, sudo apt build-dep python3 still has the same error… :anguished:

Sorry, I jumped the gun before your reply.

Yep, these look good. What does sudo apt update tell you? Does it fetch a bunch of stuff and then say all’s well? Does it report a ton of errors about things not being found at those addresses? I’m looking at the site in question and bionic does seem to be supported, so it’s probably okay.

Yup! :smile:

There was a LOT of package lists read! (I guess we added some) There was one package to be upgraded:

iproute2/bionic-backports 4.18.0-1ubuntu2~ubuntu18.04.1 amd64 [upgradable from: 4.15.0-2ubuntu1.3]
N: There are 3 additional versions. Please use the '-a' switch to see them.

Other than that, all seemed good. (I won’t upgrade that package until necessary)

And THANKS for looking up about this! (are you looking at galliumos.org?)