Python from os or pyenv

I’m looking in detail the installation documentation (by the way : bravo for the quality of the doc), if I’m understand correctly nginx — Indico 3.1 documentation you do not use the python 3.9 from the linux distribution, instead you’re using another version from pyenv

Why is that ? How can you keep up update of the python version ? Why don’t use the python 3.9 from the OS ?

If I ask it’s because it’s not very convenient for me to not using the python from the OS, not only because I manage my server with puppet, but also because

indico@indico2:~$ pyenv install 3.9.10
Downloading Python-3.9.10.tar.xz...
-> https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tar.xz
Installing Python-3.9.10...

BUILD FAILED (Debian 11 using python-build 20180424)

Inspect or clean up the working tree at /tmp/python-build.20220126195252.8737
Results logged to /tmp/python-build.20220126195252.8737.log

Last 10 log lines:
  File "/tmp/python-build.20220126195252.8737/Python-3.9.10/Lib/ensurepip/__init__.py", line 206, in _main
    return _bootstrap(
  File "/tmp/python-build.20220126195252.8737/Python-3.9.10/Lib/ensurepip/__init__.py", line 125, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20220126195252.8737/Python-3.9.10/Lib/ensurepip/__init__.py", line 34, in _run_pip
    return subprocess.run([sys.executable, "-c", code], check=True).returncode
  File "/tmp/python-build.20220126195252.8737/Python-3.9.10/Lib/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20220126195252.8737/Python-3.9.10/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpugtq907p/setuptools-58.1.0-py3-none-any.whl\', \'/tmp/tmpugtq907p/pip-21.2.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpugtq907p\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1264: install] Error 1
indico@indico2:~$ 

Regards

Not all supported distributions contain Python 3.9, and we’d be stuck with 3.9 for the next 5 or so years - by using pyenv we can easily require newer Python versions (e.g. 3.10) at some point.

But you can certainly use the Python 3.9 from your distribution if you’d like to - there’s nothing wrong with doing that.

Thanks for your answer.

According to your documentation, it’s 3.9.x (I mean currently) ? Is that mean It’s better to stick to 3.9 (the official version of python on python.org is 3.10)

You want 3.9 for now. I think we have still one or two dependencies that don’t work on 3.10 yet (at least that was the case late last year when I tried 3.10).

Well, both 3.10 and 3.9 are in active maintenance status ( 3.9 antil 2025, 3.10 until 2026) so there is no need to worry. Even 3.8 is still receiving security updates until 2024.

Thanks. But in fact my question are not just to choose between version of python. My main goal is to follow (the closest way possible) the official documentation and our deployment tool (puppet).

Eventually I use the the python from pyenv (hard to integrate in puppet), because I would never had two indico so it’s the less bad choice I can make.