What is the simplest way to install an older version of Python?

I need to install Python 3.11 (currently on 3.13).

There seems to a half dozen different ways of doing it, but none seem simple and (righlty or wrongly) I was expecting it be quite a common task.

What I’ve tried:

1.Arch wiki says to install from AUR, but the AUR package for python 3.11 has barely any support and the recent comments are filled with issues…hardly inspiring confidence. So…
2. Arch wiki also mentions pyenv. So I download that and it installed 3.11 in it’s own space (~/.pyenv). Nothing else seems to be able to find it there python3.11 is not recognised, even in the directory. So…
3. PyEnv has its own virtual environment manager. Worth a try. But it wants me to start messing around with my whole bash profile… So…
4. Virtualenv to the rescue as is apparently takes a path to the python directory as an argument. Only pointing it to the 3.11 directory that PyEnv installed for me just gets “permission denied” even though the directory is in ~ and 755.
5. Python themselves suggest venv. But venv insists the version is 3.13, even when opened in the directory with 3.11 in it.

I can’t believe using an earlier version of python is so complicated, so presume I’m missing something obvious.

Any clues?

sudo downgrade python

2 Likes

Is there a specific app that you would like to install that uses Python 3.11 or is it that you have a project that uses it?

In any case, you could use Distrobox to set up an environment that is just for that app or project, while keeping your system up-to-date with the latest Python.

There’s also this: https://github.com/FFY00/arch-python-repo
But I can’t vouch for it. Use at your own risk.

DO NOT downgrade python, it will break your system. (sorry for shouting).

2 Likes

Didn’t know that it would do that. :thinking:

2 Likes

There is a lot of stuff that depend on 3.13, try and remove python:

sudo pacman -R python                                                                                  22:06:54
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing python breaks dependency 'python' required by autopep8
:: removing python breaks dependency 'python' required by borg
:: removing python breaks dependency 'python' required by borgmatic
:: removing python breaks dependency 'python' required by code-features
:: removing python breaks dependency 'python' required by code-marketplace
:: removing python breaks dependency 'python' required by cudatext-qt6-bin
:: removing python breaks dependency 'python' required by cython
:: removing python breaks dependency 'python' required by dotdrop-git
:: removing python breaks dependency 'python' required by drkonqi
:: removing python breaks dependency 'python' required by durdraw
:: removing python breaks dependency 'python' required by extremecooling4linux
:: removing python breaks dependency 'python' required by fwupd
:: removing python breaks dependency 'python' required by gdb
:: removing python breaks dependency 'python' required by gdb-common
:: removing python breaks dependency 'python' required by glances
:: removing python breaks dependency 'python' required by glib2-devel
:: removing python breaks dependency 'python' required by gobject-introspection
:: removing python breaks dependency 'python' required by googler
:: removing python breaks dependency 'python' required by gpsd
:: removing python breaks dependency 'python3' required by indicator-stickynotes
:: removing python breaks dependency 'python' required by joomla
:: removing python breaks dependency 'python3' required by kitty
:: removing python breaks dependency 'python3' required by kitty-shell-integration
:: removing python breaks dependency 'python' required by libixion
:: removing python breaks dependency 'python' required by liborcus
:: removing python breaks dependency 'python' required by libreoffice-fresh
:: removing python breaks dependency 'python' required by libvips
:: removing python breaks dependency 'python' required by lutris
:: removing python breaks dependency 'python' required by maestral
:: removing python breaks dependency 'python' required by maestral-qt
:: removing python breaks dependency 'python' required by med-openmpi
:: removing python breaks dependency 'python' required by meld
:: removing python breaks dependency 'python' required by meson
:: removing python breaks dependency 'python' required by nuitka-git
:: removing python breaks dependency 'python' required by plasma6-applets-panel-colorizer
:: removing python breaks dependency 'python' required by powerline
:: removing python breaks dependency 'python' required by ps_mem
:: removing python breaks dependency 'python' required by px_ptop
:: removing python breaks dependency 'python' required by pypiserver
:: removing python breaks dependency 'python' required by pyside6
:: removing python breaks dependency 'python' required by pyside6-tools
:: removing python breaks dependency 'python' required by pysolfc
:: removing python breaks dependency 'python' required by python-aiofiles
:: removing python breaks dependency 'python' required by python-aiohappyeyeballs
:: removing python breaks dependency 'python' required by python-aiohttp
:: removing python breaks dependency 'python' required by python-aiosignal
:: removing python breaks dependency 'python' required by python-annotated-types
:: removing python breaks dependency 'python' required by python-anyio
:: removing python breaks dependency 'python' required by python-argcomplete
:: removing python breaks dependency 'python' required by python-asgiref
:: removing python breaks dependency 'python' required by python-astroid
:: removing python breaks dependency 'python' required by python-asyncssh
:: removing python breaks dependency 'python' required by python-attrdict3
:: removing python breaks dependency 'python' required by python-attrs
:: removing python breaks dependency 'python' required by python-autocommand
:: removing python breaks dependency 'python' required by python-babel
:: removing python breaks dependency 'python' required by python-beautifulsoup4
:: removing python breaks dependency 'python' required by python-bidict
:: removing python breaks dependency 'python' required by python-brotli
:: removing python breaks dependency 'python' required by python-cairo
:: removing python breaks dependency 'python' required by python-capng
:: removing python breaks dependency 'python' required by python-cattrs
:: removing python breaks dependency 'python' required by python-certifi
:: removing python breaks dependency 'python' required by python-chardet
:: removing python breaks dependency 'python' required by python-charset-normalizer
:: removing python breaks dependency 'python' required by python-click
:: removing python breaks dependency 'python' required by python-colorama
:: removing python breaks dependency 'python' required by python-configargparse
:: removing python breaks dependency 'python' required by python-configobj
:: removing python breaks dependency 'python' required by python-contourpy
:: removing python breaks dependency 'python' required by python-cryptography
:: removing python breaks dependency 'python' required by python-cssselect2
:: removing python breaks dependency 'python' required by python-customtkinter-git
:: removing python breaks dependency 'python' required by python-cycler
:: removing python breaks dependency 'python' required by python-darkdetect
:: removing python breaks dependency 'python' required by python-dbus
:: removing python breaks dependency 'python' required by python-dbus-fast
:: removing python breaks dependency 'python' required by python-defusedxml
:: removing python breaks dependency 'python' required by python-deprecated
:: removing python breaks dependency 'python' required by python-desktop-notifier
:: removing python breaks dependency 'python' required by python-dill
:: removing python breaks dependency 'python' required by python-dirty-equals
:: removing python breaks dependency 'python' required by python-distlib
:: removing python breaks dependency 'python' required by python-distro
:: removing python breaks dependency 'python' required by python-docopt
:: removing python breaks dependency 'python' required by python-docopt-ng
:: removing python breaks dependency 'python' required by python-docstring-to-markdown
:: removing python breaks dependency 'python' required by python-docutils
:: removing python breaks dependency 'python' required by python-dropbox
:: removing python breaks dependency 'python' required by python-entrypoints
:: removing python breaks dependency 'python' required by python-evdev
:: removing python breaks dependency 'python' required by python-fastapi
:: removing python breaks dependency 'python' required by python-fasteners
:: removing python breaks dependency 'python' required by python-ffmpy
:: removing python breaks dependency 'python' required by python-filelock
:: removing python breaks dependency 'python' required by python-fonttools
:: removing python breaks dependency 'python' required by python-frozenlist
:: removing python breaks dependency 'python' required by python-fsspec
:: removing python breaks dependency 'python' required by python-gobject
:: removing python breaks dependency 'python' required by python-gradio
:: removing python breaks dependency 'python' required by python-gradio-client
:: removing python breaks dependency 'python' required by python-greenlet
:: removing python breaks dependency 'python' required by python-h11
:: removing python breaks dependency 'python' required by python-httpcore
:: removing python breaks dependency 'python' required by python-httptools
:: removing python breaks dependency 'python' required by python-httpx
:: removing python breaks dependency 'python' required by python-huggingface-hub
:: removing python breaks dependency 'python' required by python-idna
:: removing python breaks dependency 'python' required by python-imagesize
:: removing python breaks dependency 'python' required by python-importlib_resources
:: removing python breaks dependency 'python' required by python-inflect
:: removing python breaks dependency 'python' required by python-iniconfig
:: removing python breaks dependency 'python' required by python-isort
:: removing python breaks dependency 'python' required by python-jaraco.classes
:: removing python breaks dependency 'python' required by python-jaraco.collections
:: removing python breaks dependency 'python' required by python-jaraco.context
:: removing python breaks dependency 'python' required by python-jaraco.functools
:: removing python breaks dependency 'python' required by python-jaraco.text
:: removing python breaks dependency 'python' required by python-jedi
:: removing python breaks dependency 'python' required by python-jeepney
:: removing python breaks dependency 'python' required by python-jinja
:: removing python breaks dependency 'python' required by python-jsonschema
:: removing python breaks dependency 'python' required by python-jsonschema-specifications
:: removing python breaks dependency 'python' required by python-keyutils
:: removing python breaks dependency 'python' required by python-kiwisolver
:: removing python breaks dependency 'python' required by python-lxml
:: removing python breaks dependency 'python' required by python-magic
:: removing python breaks dependency 'python' required by python-mako
:: removing python breaks dependency 'python>=3.8.0' required by python-mariadb-connector
:: removing python breaks dependency 'python' required by python-markdown
:: removing python breaks dependency 'python' required by python-markdown2
:: removing python breaks dependency 'python' required by python-markupsafe
:: removing python breaks dependency 'python' required by python-mccabe
:: removing python breaks dependency 'python' required by python-mdurl
:: removing python breaks dependency 'python' required by python-more-itertools
:: removing python breaks dependency 'python' required by python-msgpack
:: removing python breaks dependency 'python' required by python-multidict
:: removing python breaks dependency 'python' required by python-narwhals
:: removing python breaks dependency 'python' required by python-npyscreen
:: removing python breaks dependency 'python' required by python-numpy
:: removing python breaks dependency 'python' required by python-ordered-set
:: removing python breaks dependency 'python' required by python-orjson
:: removing python breaks dependency 'python' required by python-outcome
:: removing python breaks dependency 'python' required by python-packaging
:: removing python breaks dependency 'python' required by python-parso
:: removing python breaks dependency 'python' required by python-pathspec
:: removing python breaks dependency 'python' required by python-peewee
:: removing python breaks dependency 'python' required by python-picotui-git
:: removing python breaks dependency 'python' required by python-pillow
:: removing python breaks dependency 'python' required by python-pip
:: removing python breaks dependency 'python' required by python-pipx
:: removing python breaks dependency 'python' required by python-pivy
:: removing python breaks dependency 'python' required by python-platformdirs
:: removing python breaks dependency 'python' required by python-pluggy
:: removing python breaks dependency 'python' required by python-plumbum
:: removing python breaks dependency 'python' required by python-ply
:: removing python breaks dependency 'python' required by python-portio
:: removing python breaks dependency 'python' required by python-prompt_toolkit
:: removing python breaks dependency 'python' required by python-protobuf
:: removing python breaks dependency 'python' required by python-psutil
:: removing python breaks dependency 'python' required by python-pycodestyle
:: removing python breaks dependency 'python' required by python-pycparser
:: removing python breaks dependency 'python' required by python-pycryptodomex
:: removing python breaks dependency 'python' required by python-pycups
:: removing python breaks dependency 'python' required by python-pydantic
:: removing python breaks dependency 'python' required by python-pydantic-core
:: removing python breaks dependency 'python' required by python-pydantic-extra-types
:: removing python breaks dependency 'python' required by python-pydantic-settings
:: removing python breaks dependency 'python' required by python-pydub
:: removing python breaks dependency 'python' required by python-pydyf
:: removing python breaks dependency 'python' required by python-pyflakes
:: removing python breaks dependency 'python' required by python-pyfuse3
:: removing python breaks dependency 'python' required by python-pygame
:: removing python breaks dependency 'python' required by python-pygdbmi
:: removing python breaks dependency 'python' required by python-pygments
:: removing python breaks dependency 'python' required by python-pyjwt
:: removing python breaks dependency 'python' required by python-pylint
:: removing python breaks dependency 'python' required by python-pynacl
:: removing python breaks dependency 'python' required by python-pynvim
:: removing python breaks dependency 'python' required by python-pyodbc
:: removing python breaks dependency 'python' required by python-pyparsing
:: removing python breaks dependency 'python' required by python-pyperclip
:: removing python breaks dependency 'python' required by python-pyphen
:: removing python breaks dependency 'python' required by python-pyqrcode
:: removing python breaks dependency 'python' required by python-pyqt5-sip
:: removing python breaks dependency 'python' required by python-pyqt6-sip
:: removing python breaks dependency 'python' required by python-pyqt6-webengine
:: removing python breaks dependency 'python>=3.8' required by python-pyro5
:: removing python breaks dependency 'python' required by python-pysol_cards
:: removing python breaks dependency 'python' required by python-pystray
:: removing python breaks dependency 'python>=3.8' required by python-pytermgui
:: removing python breaks dependency 'python' required by python-python-multipart
:: removing python breaks dependency 'python' required by python-pytoolconfig
:: removing python breaks dependency 'python' required by python-pytz
:: removing python breaks dependency 'python' required by python-pyxdg
:: removing python breaks dependency 'python' required by python-referencing
:: removing python breaks dependency 'python' required by python-regex
:: removing python breaks dependency 'python' required by python-reportlab
:: removing python breaks dependency 'python' required by python-rpds-py
:: removing python breaks dependency 'python' required by python-ruamel.yaml.clib
:: removing python breaks dependency 'python' required by python-semantic-version
:: removing python breaks dependency 'python' required by python-serpent
:: removing python breaks dependency 'python' required by python-setproctitle
:: removing python breaks dependency 'python' required by python-setuptools
:: removing python breaks dependency 'python' required by python-shellingham
:: removing python breaks dependency 'python' required by python-shtab
:: removing python breaks dependency 'python' required by python-simplejson
:: removing python breaks dependency 'python' required by python-simplenote
:: removing python breaks dependency 'python' required by python-six
:: removing python breaks dependency 'python' required by python-sniffio
:: removing python breaks dependency 'python' required by python-snowballstemmer
:: removing python breaks dependency 'python' required by python-sortedcontainers
:: removing python breaks dependency 'python' required by python-soupsieve
:: removing python breaks dependency 'python' required by python-sphinx-alabaster-theme
:: removing python breaks dependency 'python' required by python-sphinxcontrib-applehelp
:: removing python breaks dependency 'python' required by python-sphinxcontrib-devhelp
:: removing python breaks dependency 'python' required by python-sphinxcontrib-htmlhelp
:: removing python breaks dependency 'python' required by python-sphinxcontrib-qthelp
:: removing python breaks dependency 'python' required by python-sphinxcontrib-serializinghtml
:: removing python breaks dependency 'python' required by python-sqlalchemy
:: removing python breaks dependency 'python' required by python-starlette
:: removing python breaks dependency 'python' required by python-stone
:: removing python breaks dependency 'python' required by python-survey
:: removing python breaks dependency 'python' required by python-systemd
:: removing python breaks dependency 'python' required by python-tabulate
:: removing python breaks dependency 'python' required by python-termcolor
:: removing python breaks dependency 'python' required by python-textual
:: removing python breaks dependency 'python' required by python-titlecase
:: removing python breaks dependency 'python' required by python-toml
:: removing python breaks dependency 'python' required by python-tomli
:: removing python breaks dependency 'python' required by python-tomli-w
:: removing python breaks dependency 'python' required by python-tomlkit
:: removing python breaks dependency 'python' required by python-tornado
:: removing python breaks dependency 'python' required by python-tqdm
:: removing python breaks dependency 'python' required by python-trio
:: removing python breaks dependency 'python' required by python-typing_extensions
:: removing python breaks dependency 'python' required by python-uc-micro-py
:: removing python breaks dependency 'python' required by python-ujson
:: removing python breaks dependency 'python' required by python-unidecode
:: removing python breaks dependency 'python' required by python-urllib3
:: removing python breaks dependency 'python' required by python-urwid
:: removing python breaks dependency 'python' required by python-userpath
:: removing python breaks dependency 'python' required by python-uvloop
:: removing python breaks dependency 'python' required by python-virtualenv
:: removing python breaks dependency 'python' required by python-watchdog-git
:: removing python breaks dependency 'python' required by python-wcwidth
:: removing python breaks dependency 'python' required by python-weasyprint
:: removing python breaks dependency 'python' required by python-webencodings
:: removing python breaks dependency 'python' required by python-websockets
:: removing python breaks dependency 'python' required by python-whatthepatch
:: removing python breaks dependency 'python' required by python-wheel
:: removing python breaks dependency 'python' required by python-wrapt
:: removing python breaks dependency 'python' required by python-yaml
:: removing python breaks dependency 'python' required by python-yarl
:: removing python breaks dependency 'python' required by python-zipp
:: removing python breaks dependency 'python' required by python-zopfli
:: removing python breaks dependency 'python' required by qtcreator
:: removing python breaks dependency 'python' required by ranger
:: removing python breaks dependency 'python' required by reflector
:: removing python breaks dependency 'python' required by samba
:: removing python breaks dependency 'python' required by shiboken6
:: removing python breaks dependency 'python' required by smbclient
:: removing python breaks dependency 'python' required by speedtest-cli
:: removing python breaks dependency 'python' required by squeekboard
:: removing python breaks dependency 'python' required by steam
:: removing python breaks dependency 'python' required by trash-cli
:: removing python breaks dependency 'python' required by trelby-git
:: removing python breaks dependency 'python' required by udiskie
:: removing python breaks dependency 'python' required by uvicorn
:: removing python breaks dependency 'python' required by vapoursynth
:: removing python breaks dependency 'python' required by wikicurses
:: removing python breaks dependency 'python' required by windsurf-features
:: removing python breaks dependency 'python' required by windsurf-marketplace
:: removing python breaks dependency 'python' required by yapf
:: removing python breaks dependency 'python' required by zenmap

Removing python is different than downgrading it. I just did it for the hell of it. :person_shrugging:

[ricklinux@rick-ms7c37 ~]$ pacman -Qi python
Name            : python
Version         : 3.11.3-1
Description     : Next generation of the python high-level scripting language
Architecture    : x86_64
URL             : https://www.python.org/
Licenses        : custom
Groups          : None
Provides        : python3
Depends On      : bzip2  expat  gdbm  libffi  libnsl  libxcrypt  openssl  zlib
Optional Deps   : python-setuptools
                  python-pip
                  sqlite [installed]
                  mpdecimal: for decimal [installed]
                  xz: for lzma [installed]
                  tk: for tkinter
Required By     : fwupd  glances  libixion  liborcus  libreoffice-fresh  meld  python-annotated-types
                  python-cairo  python-capng  python-colorama  python-dbus  python-defusedxml
                  python-gobject  python-orjson  python-packaging  python-psutil  python-pycups
                  python-pydantic  python-pydantic-core  python-pyqt5-sip  python-shtab  python-termcolor
                  python-typing_extensions  python-yaml  reflector  rhythmbox  samba  smbclient  snap-pac
                  vapoursynth
Optional For    : btrfs-progs  cifs-utils  fastfetch  git  gstreamer  gtest  gtk2  gupnp  i2c-tools  imath
                  iproute2  ki18n  ldb  lensfun  libcaca  libevent  libftdi  libimobiledevice  libnewt
                  libplist  libxml2  libxslt  nfs-utils  nftables  openconnect  pcsclite  plasma-firewall
                  qbittorrent  rsync  talloc  tdb  tevent  usbutils  util-linux-libs  xfsprogs  zbar
Conflicts With  : None
Replaces        : python3
Installed Size  : 75.26 MiB
Packager        : Felix Yan <felixonmars@archlinux.org>
Build Date      : Wed 05 Apr 2023 11:52:25 AM
Install Date    : Sat 25 Jan 2025 05:11:18 PM
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Edit:

[ricklinux@rick-ms7c37 ~]$ yay
:: Synchronizing package databases...
 endeavouros is up to date
 core is up to date
 extra                                                                                                              7.5 MiB  12.2 MiB/s 00:01 [---------------------------------------------------------------------------------------] 100%
 multilib is up to date
:: Searching AUR for updates...
:: Searching databases for updates...
 -> Flagged Out Of Date AUR Packages: libpamac-aur
:: 1 package to upgrade/install.
1  core/python  3.11.3-1 -> 3.13.1-1
==> Packages to exclude: (eg: "1 2 3", "1-3", "^4" or repo name)
 -> Excluding packages may cause partial upgrades and break systems
==> 
1 Like

I know, it was just to show the problems it would cause.

Downgrade and try to run a python based program - it will fall flat on it’s arse:

ranger                                                                                                      22:19:20
Traceback (most recent call last):
  File "/usr/bin/ranger", line 36, in <module>
    import ranger  # NOQA pylint: disable=import-self,wrong-import-position
    ^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'ranger'

Upgrading again.

1 Like

Thing is, yes, downgrading would work, BUT, the fact is some packages require a specific version of Python, like python311, rather than just python. And if a user has such packages, it can indeed break parts of the system, and of course, those specific packages.

This happened with Blender several months back. Blender closes when I add a Fluid Domain - #17 by ddnn

Well i just wrote i didn’t know that downgrading would do that because that’s what you posted. :person_shrugging:

1 Like

But the user has a specific package that needs a specific version. :person_shrugging:

Edit: I would have no idea what the user has on their system. They just asked … i answered. Whether it would break something i have no idea. I don’t know all there is to know nor do i pretend to.

1 Like

There are some Arch Core packages which are needed by a great number of other packages. When they get updated, piles of other updates come with them, and some AUR immediate breakages or near future updates.

In this class are python, icu, and openssl/libssl. Probably a couple others. Usually downgrades on these are risky to system stability.

1 Like

A Note on Distrobox:

If you choose this route, use a static release distro like Debian, Fedora, etc. for the guest.
As you can probably imagine, using an Arch guest, or something based on it, will give you the latest python, which is the problem.

https://wiki.archlinux.org/title/Python/Virtual_environment

This is the way I would do it.

1 Like

Which python package you need 3.11? Python311 is flagged in aur…

But which package is needed why.needee this path

I’m trying to install a python package which uses numpy 1.24, but 1.24 is incompatible with python versions 3.12 and above.

I only need to run it in a virtual environment, I need to keep 3.13 on the system too. I should have made the more clear in the OP. Sorry for the confusion

I can create a virtual environment using 3.11 once it’s on my machine, but it needs to be installed in the right place for venv or virtualenv to recognise it’s there.

Pyenv installs it, but in the wrong place.

The AUR version will install it in the right place, but seems a risk, given the comments.

I just assumed, given the need for testing python applications against different versions, there’d be some standard way of doing it that didn’t involve playing roulette with various third party repositories…

What exactly did you try with pyenv? What does pyenv versions show?

The virtual environment is not the problem. The problem is getting the older version of python on the machine in the first place.

But thanks for taking the time to answer anyway.

A python script? Or a python module?

pyenv install 3.11
Worked a charm but installed it in its own directory

pyenv versions correctly shows both system and 3.11

But there doesn’t seem to be a way of switching to the 3.11 environment using pyenv without messing around with the bashrc, which seems crazy.

I don’t understand why pyenv needs me to change the whole console environment. That seems massively overkill just to run a virtual environment, not to mention it defeats the whole point of a virtual environment (which is to run something without making major changes to your system)