# Use newer Python than 3.9 ?!?

**URL:** <https://forum.yunohost.org/t/use-newer-python-than-3-9/22568>\
**Category:** Apps packaging\
**Tags:** english\
**Created:** [December 10, 2022, 9:45am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568 "2022-12-10T09:45:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [December 10, 2022, 9:45am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/1 "2022-12-10T09:45:38Z")

</div>

Beside my different Python based projects, i used Home Assistant

After the update today, i see a warning that Home Asistant \>=2023.2 will need Python 3.10 and open [Python 3.9 no longer supported for Home Asistant \>=2023.2 · Issue #159 · YunoHost-Apps/homeassistant\_ynh · GitHub](https://github.com/YunoHost-Apps/homeassistant_ynh/issues/159) for this.

The Question here is, how to handle this?

I see these options:

- Install a newer Python via [GitHub - pyenv/pyenv: Simple Python version management](https://github.com/pyenv/pyenv)
- Include a external deb source (I don’t know which)
- Install Python from source: [Python Source Releases | Python.org](https://www.python.org/downloads/source/)
- Use docker and put the app into a python container

Has this topic ever been discussed anywhere?!?

I’m not the biggest fan of docker. But that is one of the the main reason to use it, isn’t it? 😉  
I think using Docker could be done without changing anything in the main system.  
It would be interesting to try it out. Has anyone try this in the past? I jsut search for “docker” all projects [Search · org:YunoHost-Apps docker · GitHub](https://github.com/search?q=org%3AYunoHost-Apps+docker) and found only [GitHub - YunoHost-Apps/gollum\_ynh: A simple, Git-powered wiki with a sweet API and local frontend, packaged with YunoHost and Docker.](https://github.com/YunoHost-Apps/gollum_ynh) and it seems that docker usage was removed in [Non-docker version by ketsapiwiq · Pull Request #1 · YunoHost-Apps/gollum\_ynh · GitHub](https://github.com/YunoHost-Apps/gollum_ynh/pull/1)

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [December 10, 2022, 3:51pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/2 "2022-12-10T15:51:35Z")

</div>

I would also add the option “stick to whatever version is supported until Debian Bookworm”

The whole thing about “installing custom versions of python locally” is a pandora box. As far as I know you basically have to compile python locally, which significantly lengthens up the app’s install time on low-end device such as ARM boards

Docker is another pandora’s box. Sure we can have one app using Docker, but then we’ll have another, and another, and another, and we’ll ultimately end up with a fragmented app ecosystem with one portion using Docker, and the other not, for no specific reason. It doesn’t “change anything on the main system”, but devil is always in the detail :

- Docker needs iptables rules and it is not clear how this interfere with Yunohost’s firewall.
- Not to mention I’ve seen people in the past having `apt/dpkg` being broken because for some reason `docker-ce` upgrade would crash (because using some apps that were packaged using docker, as you found out - but there was other such as diaporadocker\_ynh etc)
- People say there is supposedly “no resource overhead in using Docker vs. classic install”, but soon enough you will need PHP-FPM process or a mysql/postgresql DB. Except many apps need those too, and having a commong PHP-FPM master process, or a common mysql/postgresql stack reduces the overhead … yet many advantages of Docker reside in having “everything docker”, including the DB, cf the DB volumes which store the actual data, and so on …
- everything else we don’t know about - as I like to say : install stuff is usually stupidly easy. The real issue is the long-term maintenance and every stupid edge case you don’t know about yet and will only learn about along the way of “stabilization”.

With the said I’m not really “anti-Docker” or whatever … I use docker everyday for other projects and it’s awesome. YunoHost suffers from quite a lot of stability/upgrading issues because of trying to remain somewhat “low tech” with it’s “container-less” approach, such as what we see in the major debian upgrades and lack of guarantees that restoring an app from a backup will work. I would be glad if some project would explore building a Yunohost-like distro using the full power of the docker paradigm. But for it to be successful, it would also have to be really mindful of creating something simple that regular human being can use, something tech-savvy folks forget too quickly about (and even in the YunoHost we tend to loose our focus regularly…). And I expect there would be important challenges into keeping things lightweight enough to run on ARM boards (despite the claim that there’s no overhead using Docker, cf previous note) and hackable for people that know only a little bit of CLI.

Anyway, the other thing at stake in the low-tech vs. high-tech of adminsys is this frenesy to always seek having top-notch-up-to-date softwares and technology, sometimes defended by the argument of “security” (which you could also argue the other way around : you could expect that old, well-known software are safer than brand new stuff), and ultimately this goes a long way into complexifying everything. That goes also with the fact that upstream devs don’t really care about distribution (as in “making it effectively possible and easy for people to use your software”) beyond Docker (which alone is not an acceptable answer for distributing software to non-tech-savvy people). There would be a lot to say about how Debian packaging remained too complex and was not suited for webapp development and deployment and how this triggered the explosion of language-specific package managers with debatable behavior and policies … but I digress 😉. My point being : Debian Stable is a pretty good baseline, and people can live with a 6-month/1-year old software for some time.

---

<div class="post-metadata">

**Author:** ![ewilly](https://forum.yunohost.org/user_avatar/forum.yunohost.org/ewilly/32/12681_2.png) [@ewilly](https://forum.yunohost.org/u/ewilly)\
**Post date:** [December 10, 2022, 9:38pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/3 "2022-12-10T21:38:15Z")

</div>

If you look at the code you will see that the app is able to build the needed python from source (see [https://github.com/YunoHost-Apps/homeassistant\_ynh/blob/master/scripts/\_common.sh](https://github.com/YunoHost-Apps/homeassistant_ynh/blob/master/scripts/_common.sh)). It was already the case at the end of life of debian buster to propose a not too old version of home-assistant.  
For the time no need to worry about it its just a caution for the version that would be shipped after February.

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [December 11, 2022, 12:24pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/4 "2022-12-11T12:24:46Z")

</div>

> [@ewilly](#):
>
> (see [https://github.com/YunoHost-Apps/homeassistant\_ynh/blob/master/scripts/\_common.sh](https://github.com/YunoHost-Apps/homeassistant_ynh/blob/master/scripts/_common.sh)).

Oh. Interesting! Then there is a solution for the problem. This part of code is usefull for all Python based projects.  
Have you take a look to `pyenv`?

---

<div class="post-metadata">

**Author:** ![ewilly](https://forum.yunohost.org/user_avatar/forum.yunohost.org/ewilly/32/12681_2.png) [@ewilly](https://forum.yunohost.org/u/ewilly)\
**Post date:** [December 11, 2022, 8:03pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/5 "2022-12-11T20:03:24Z")

</div>

Not deeply… It’s perhaps a better way… I don’t have enough knowledge about the subject to understand what that imply for the whole system and how to manage it.

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [August 18, 2023, 6:39am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/6 "2023-08-18T06:39:36Z")

</div>

My projects still support Python 3.9… But only because of this old one in YunoHost. So i take another look on this topic…

Interesting thing is, that many projects used Python, see: [GitHub Search: “org:YunoHost-Apps python path:/^scripts//”](https://github.com/search?q=org%3AYunoHost-Apps+python+path%3A%2F%5Escripts%5C%2F%2F&type=code)

Found two ones that using [pyenv](https://github.com/pyenv/pyenv), but the bootstrap of this is much more code: [GitHub search: “org:YunoHost-Apps github.com/pyenv”](https://github.com/search?q=org%3AYunoHost-Apps+github.com%2Fpyenv&type=code)

The [homeassistant solution](https://github.com/YunoHost-Apps/homeassistant_ynh/blob/12192f8157ffc79e9073848a8a187556a26b02dd/scripts/_common.sh#L36) is much smaller and also used by [YunoHost-Apps/tandoor\_ynh](https://github.com/YunoHost-Apps/tandoor_ynh/blob/c522d21f4bc82d0c6d5ebdabcf0bd3f76cd1d5c9/scripts/_common.sh#L20)

The bad thing about this is IMHO, that you must specify the exactly version of Python, e.g: [py\_required\_version=3.11.4](https://github.com/YunoHost-Apps/homeassistant_ynh/blob/12192f8157ffc79e9073848a8a187556a26b02dd/scripts/_common.sh#L11)

Would be great if only the main version must be specify e.g.: `3.10` or `3.11` and the last bugfix version will be installed.

And what’s about to build a solution in YunoHost core, so it’s usable for all projects?

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [August 18, 2023, 10:22am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/7 "2023-08-18T10:22:03Z")

</div>

> [@jedie](#):
>
> And what’s about to build a solution in YunoHost core, so it’s usable for all projects?

No. Using Python 3.9 is not a huge deal, I don’t see what top-notch killer feature would be included in 3.10 or 3.11 that would make it worth it.

We use whatever is shipped in stock Debian.

If you get stucked because of limitations to stock Debian, then maybe contribute by joining the campaign to fix apps so they work on Bookworm.

Working on workarounds instead of helping with the actual issue/fix (the Bookworm transition) is only a waste of time, because then we have epic technical issues to debug because one way or another, these kind of magic tweaks always end up making random stuff explose (cf for example people installing stuff in global scope with `pip` … or anyway installing custom version of Python usually ends up in compiling locally, which takes an epic amount of time, which is not acceptable considering what YunoHost is trying to achieve) and then we (the support team) have to debug the mess

> [@jedie](#):
>
> Found two ones that using [pyenv](https://github.com/pyenv/pyenv), but the bootstrap of this is much more code: [GitHub search: “org:YunoHost-Apps github.com/pyenv”](https://github.com/search?q=org%3AYunoHost-Apps+github.com%2Fpyenv&type=code)

Yeah … please for the love of god stick to regular python venv, `python -m venv venv`. Anything else seems to be madness…

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [August 18, 2023, 11:36am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/8 "2023-08-18T11:36:36Z")

</div>

Note: `pyenv` is not related to `python -m venv` 😉  
pyenv are scripts to install different Python Interpreter versions on any systems 😉

> [@Aleks](#):
>
> Working on workarounds instead of helping with the actual issue/fix (the Bookworm transition) is only a waste of time

Yes and no, i think 😉  
All of my related projects still work on Python 3.9… Only because of YunoHost 😉

Other projects (homeassistant, tandoor, etc.) need a newer Python.

Migrating more quickly to any new Debian stable version helps in principle, of course.  
However, Debian is not super fast, so even fast YunoHost updates won’t solve the problem completely, i think 😉

That’s one of the reasons why some people use Docker or Fatpack etc. But this is a other topic.

The bottom line: We can stay with the current situation: Every package maintainer can stay with the default Python or use his own solution to install a newer one.  
Or: We add a helper in the core to install a newer Python.

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [August 18, 2023, 11:55am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/9 "2023-08-18T11:55:11Z")

</div>

Or: people can invest energy into the Bullseye-\>Bookworm transition to help move forward with the general situation for everybody, instead of investing energy into their own specific app needs using their own custom trick and creating cyber-frankensteins

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [January 4, 2024, 7:14pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/10 "2024-01-04T19:14:24Z")

</div>

I start now to use [https://github.com/YunoHost-Apps/homeassistant\_ynh/blob/master/scripts/\_common.sh](https://github.com/YunoHost-Apps/homeassistant_ynh/blob/master/scripts/_common.sh) too:

- [Install Python 3.11.7 by jedie · Pull Request #128 · YunoHost-Apps/pyinventory\_ynh · GitHub](https://github.com/YunoHost-Apps/pyinventory_ynh/pull/128)

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [January 4, 2024, 7:27pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/11 "2024-01-04T19:27:57Z")

</div>

![aaf605479a56f4109a3f7fee72505a75a7c578c6-350x186](https://forum.yunohost.org/uploads/default/original/2X/a/aaf605479a56f4109a3f7fee72505a75a7c578c6.gif)

---

<div class="post-metadata">

**Author:** ![Lapineige](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@Lapineige](https://forum.yunohost.org/u/Lapineige)\
**Post date:** [January 6, 2024, 2:19pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/12 "2024-01-06T14:19:21Z")

</div>

How do you make sure you won’t break user systems when you install this app ?

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [January 15, 2024, 11:18am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/13 "2024-01-15T11:18:00Z")

</div>

I see no problem here.

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [August 2, 2024, 6:47pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/14 "2024-08-02T18:47:25Z")

</div>

Maybe a other option is the new pyrun: [GitHub - eGenix/egenix-pyrun: eGenix PyRun - Your friendly, lean, open source Python runtime](https://github.com/eGenix/egenix-pyrun) … But i haven’t tried it, yet for a YunoHost package.

---

<div class="post-metadata">

**Author:** ![tituspijean](https://forum.yunohost.org/user_avatar/forum.yunohost.org/tituspijean/32/3584_2.png) [@tituspijean](https://forum.yunohost.org/u/tituspijean)\
**Post date:** [August 2, 2024, 8:19pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/15 "2024-08-02T20:19:35Z")

</div>

[GitHub - jdx/mise: dev tools, env vars, task runner](https://github.com/jdx/mise) has also been mentioned recently, and can handle several languages too.

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [August 30, 2024, 5:59am UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/16 "2024-08-30T05:59:57Z")

</div>

I convert “myynh\_install\_python()” borrowed from: [homeassistant\_ynh/scripts/\_common.sh at master · YunoHost-Apps/homeassistant\_ynh · GitHub](https://github.com/YunoHost-Apps/homeassistant_ynh/blob/master/scripts/_common.sh) into a Python script that works with Python 3.9.

In additional to the origin shell script: It checks the downloaded python source archive with gpg signature.

The source is in my project here: [manageprojects/manageprojects/install\_python.py at main · jedie/manageprojects · GitHub](https://github.com/jedie/manageprojects/blob/main/manageprojects/install_python.py)

Documentation: [manageprojects/docs/install\_python.md at main · jedie/manageprojects · GitHub](https://github.com/jedie/manageprojects/blob/main/docs/install_python.md)

The source of `install_python.py` will be copied into the YunoHost package via unittests, so it’s always up2date.  
See: [master \<- testing by jedie · Pull Request #73 · YunoHost-Apps/django-for-runners\_ynh · GitHub](https://github.com/YunoHost-Apps/django-for-runners_ynh/pull/73/files)

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [September 17, 2024, 3:23pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/17 "2024-09-17T15:23:35Z")

</div>

I have now a additional solution: [setup\_python.py](https://github.com/jedie/manageprojects/blob/main/docs/setup_python.md)

It downloads, verify and setup redistributable Python builds from: [github.com/indygreg/python-build-standalone/](https://github.com/indygreg/python-build-standalone/) … So other than [install\_python.py](https://github.com/jedie/manageprojects/blob/main/docs/install_python.md) no time consuming compiling of Python is needed.

Because both exists, i add it as a option, e.g.:

```auto
    [install.update_python]
    ask.en = "How to update Python? 'setup' will use redistributable Python builts (fast), 'install' will compile Python from source (slow)."
    type = "select"
    choices = ["INSTALL", "SETUP"]
    default = "SETUP"

```

See PR: [NEW: Select: "install" or "setup" Python by jedie · Pull Request #52 · YunoHost-Apps/django\_example\_ynh · GitHub](https://github.com/YunoHost-Apps/django_example_ynh/pull/52/)

Looks like:

 ![2025-01-11_09-27](https://forum.yunohost.org/uploads/default/original/2X/4/4b0b18a3a4f19ea71f1616cdf91a74b45491c431.png)

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [September 17, 2024, 3:25pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/18 "2024-09-17T15:25:16Z")

</div>

> [@jedie](#):
>
> no time consuming compiling of Python is needed.

But then why would the user chose to compile from sources ?

---

<div class="post-metadata">

**Author:** ![jedie](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.yunohost.org/u/jedie)\
**Post date:** [September 17, 2024, 3:26pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/19 "2024-09-17T15:26:18Z")

</div>

Maybe because [GitHub - indygreg/python-build-standalone: Produce redistributable builds of Python](https://github.com/indygreg/python-build-standalone/) contains bugs?

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [September 17, 2024, 3:28pm UTC](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568/20 "2024-09-17T15:28:13Z")

</div>

Where are you seeing that it contains bugs ? And if it contains bugs, why encourage people to use it ? x\_X

[Next page](https://forum.yunohost.org/t/use-newer-python-than-3-9/22568.md?page=2)
