How to update python to the latest version on ArchLinux?
Asked Answered
S

3

5

How to install the latest python version 3.11.0 on ArchLinux through pacman?

ArchLinux wiki says current version is 3.10, although python 3.11 has been officially released.

When running sudo pacman -Syyu p I'm welcomed with warning: python-3.10.8-3 is up to date.

Am I doing something wrong?

Shadowgraph answered 11/11, 2022 at 16:36 Comment(6)
Someone has to actually do the work to package Python 3.11 for Arch, and then all the other packages in Arch need to be tested to work with it. All these things take time.Scrounge
If you want a distro and package manager that can control for interdependencies and let you install newer tools (or older ones, or patched ones, etc etc) while still keeping other versions in place for the things that need them, might I interest you in NixOS? Mind, you can also install Nix (the package manager itself) on top of Arch if you choose.Scrounge
(...and insofar as everything discussed is true for all packages on Arch, vs being specific to Python or programming tools, I'd suggest that this question would be more topical on Unix & Linux rather than here)Scrounge
Thank you @CharlesDuffy, I will take a look at NixOS. Also, thanks for pointing me out to Unix StackExchange. Will post there next time.Shadowgraph
I recommend to use pyenv to install the latest version. For development, it's the best.Pteridophyte
The issue was addressed on the arch-dev-public mailing list.Dusen
P
4

Use AUR like "yay" to get the new python3.11.

If you haven't installed yay on your system, setup yay by following these instructions

Run this command after setting up yay in your system:

yay -S python311
Pannier answered 11/11, 2022 at 16:57 Comment(2)
Thank you, python311 is installed now. But how do I run it? python311 returns command not found, and python -V returns Python 3.10.8Shadowgraph
@RuanMolinari you need to add newly installed python to path. You can do that by adding export PATH=”$PATH:/usr/local/bin/python311” to your .bashrc filePannier
S
12

You can install multiple versions and implementations of Python independently of your distro's package manager using pyenv.

  1. Install pyenv with sudo pacman -S pyenv.
  2. Set up your shell for usage with pyenv https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv
  3. Install the Python version of your choice (please note that CPython will be built from source).
pyenv install -l # This will list all available versions
pyenv install 3.11.1 # This will install CPython 3.11.1
  1. Select the Python version as the default.
pyenv shell 3.11.1 # Use this version only for this shell session
pyenv local 3.11.1 # Use this version only when you are in this directory
pyenv global 3.11.1 # Use this version as the default version

Note that this will not replace Python installed by the package manager located at /usr/bin/python. Pyenv will only change the PATH to point python to its Python binary.

Seritaserjeant answered 18/12, 2022 at 15:42 Comment(0)
P
4

Use AUR like "yay" to get the new python3.11.

If you haven't installed yay on your system, setup yay by following these instructions

Run this command after setting up yay in your system:

yay -S python311
Pannier answered 11/11, 2022 at 16:57 Comment(2)
Thank you, python311 is installed now. But how do I run it? python311 returns command not found, and python -V returns Python 3.10.8Shadowgraph
@RuanMolinari you need to add newly installed python to path. You can do that by adding export PATH=”$PATH:/usr/local/bin/python311” to your .bashrc filePannier
U
-5

You can update python to the latest version on ArchLinux using the following command:

pacman -Syu python

Uzzi answered 12/11, 2022 at 18:0 Comment(3)
This won't install 3.11. The latest version in the core repos is 3.10.Earthling
To clarify, this installs the "latest version available in AUR at the time of the command". Never latest release since Python devs don't seem to publish to AUR on their own.Evacuation
this answer has nothing to do with AUR, thats the users repo not the official repoHuffman

© 2022 - 2025 — McMap. All rights reserved.