Dropping python <=3.9 support for next version of Frappe/ERPNext

This is just a heads-up that we have dropped support for python versions up to 3.7 for the next release.

After further thought and discussion, support for 3.8 and 3.9 is also dropped for the next version.

3.10 is the recommended and required version for next/development version of Frappe/ERPNext.

  • If you’re on version-13 this doesn’t affect you yet.
  • If you’re an app developer, you probably need to bump the python version to 3.10 or higher in any automated test suites you’re running.
  • If you self-host/manage infra, you need to upgrade the python version to Python 3.10+ whenever you plan to upgrade to the next major release (v14)

more info here: build!: Bump minimum Python version to 3.10 by gavindsouza · Pull Request #17355 · frappe/frappe · GitHub

16 Likes

Some quality of life questions around this:

  • What is the recommended version for V13 (today)?
  • What version do you anticipate developing against for V14?

As an anecdote I have found V13 install are easier using 3.8 than 3.6

1 Like
  • What is the recommended version for V13 (today)?

3.7 / 3.8 are recommended and most tested versions. 3.6 is EOL.

  • What version do you anticipate developing against for V14?

3.8 / 3.9

2 Likes

When exactly is version 14 of ERPNext going to be released? Are there any specific dates.

I am asking this because I am going to start work on a project in a few days. If version 14 is around the corner then I think it would be prudent to wait for this new release.

As a rule of thumb, I would suggest you don’t hold your breathe on new release being stable in the first few months at least. Version 13 spent nearly a year in beta and still had bugs on full release so it’s best you start your development in v13.

4 Likes

After further thought and discussion, support for 3.8 and 3.9 is also dropped for the next version.

more info here: build!: Bump minimum Python version to 3.10 by gavindsouza · Pull Request #17355 · frappe/frappe · GitHub

3.10 is the recommended and required version for next/development version of Frappe/ERPNext.

2 Likes

Thanks for the update, @ankush!

I want to add some info and context, for future readers. With Python 3.10 as a firm Frappe v14 requirement, you may need to perform additional installation work, depending on your Linux distribution.

  • Ubuntu: The latest Ubuntu LTS 22.04 (released 21 April 2022) ships with Python 3.10. :white_check_mark:

  • Debian: The current LTS, Debian 11 “Bullseye”, only has Python 3.9. :warning:

    (Debian 12 has no official release date. Best guess is middle of year 2023.)

  • CentOS 8 : I’m unfamiliar with Red Hat distributions. I’ve read that they don’t actually ship with Python. But using their package installer, I “think” it would install Python 3.6? :warning:

So.

If you’re -not- running Frappe/ERPNext with Docker…
and you’re -not- running Ubuntu 22.04…
then be prepared to install Python 3.10 manually.

This may (or may not) be a challenge for you, depending on your comfort-level with Linux and Python.

Finally, for Ubuntu and Debian users, this means you’re going to have two(2) different Python versions co-existing on your host. So please be careful with that, and give thought and consideration to your Python Virtual Environments.

6 Likes

I’d recommend this in order of simplicity:

  1. Frappe Docker (once you get docker right you won’t need to bother with any of the system dependencies yourselves… ever)
  2. Ubuntu 22.04 - ships out of the box with required version
  3. Ubuntu 20.04 with deadsnakes PPA to install a newer version: New Python Versions : “deadsnakes” team
  4. Use Pyenv for simpler multiple python version installs: GitHub - pyenv/pyenv: Simple Python version management

CentOS 8 is already EOL. Moreover, it’s best to not use CentOS now because it won’t be the same as RHEL. CentOS Linux is dead—and Red Hat says Stream is “not a replacement” | Ars Technica

Rocky Linux is the true alternative to CentOS/RHEL: https://rockylinux.org/

For other distro users(Debian, RHEL, Arch etc), I’d expect them to know how to install packages :stuck_out_tongue:

3 Likes

I have successful installations using AlmaLinux 8 (having Python 3.6.8) - and for me this is easier than using Ubuntu :wink:
I am going to try AlmaLinux 9 (Python 3.9.10) in the next few days.

For version 12 and 13, what is expected to break, if any, when using Python 3.9 or 3.10?

Today I did this and the result is a failure:

bench init frappe-bench --frappe-branch version-12 --python python3.9
Setting Up Environment
$ /usr/bin/python3 -m venv env
$ /home/usradmin/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-12 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 2665, done.
remote: Counting objects: 100% (2665/2665), done.
remote: Compressing objects: 100% (2464/2464), done.
remote: Total 2665 (delta 348), reused 1133 (delta 151), pack-reused 0
Receiving objects: 100% (2665/2665), 12.43 MiB | 2.68 MiB/s, done.
Resolving deltas: 100% (348/348), done.
Installing frappe
$ /home/usradmin/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/asradmin/frappe-bench/apps/frappe
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running egg_info
      creating /tmp/pip-pip-egg-info-jcbyy4h4/psycopg2_binary.egg-info
      writing /tmp/pip-pip-egg-info-jcbyy4h4/psycopg2_binary.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-jcbyy4h4/psycopg2_binary.egg-info/dependency_links.txt
      writing top-level names to /tmp/pip-pip-egg-info-jcbyy4h4/psycopg2_binary.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-jcbyy4h4/psycopg2_binary.egg-info/SOURCES.txt'

      Error: pg_config executable not found.

      pg_config is required to build psycopg2 from source.  Please add the directory
      containing pg_config to the $PATH or specify the full executable path with the
      option:

          python setup.py build_ext --pg-config /path/to/pg_config build ...

      or with the pg_config option in 'setup.cfg'.

      If you prefer to avoid building psycopg2 from source, please install the PyPI
      'psycopg2-binary' package instead.

      For further information please check the 'doc/src/install.rst' file (also at
      <http://initd.org/psycopg/docs/install.html>).

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/bench/commands/make.py", line 70, in init
    init(
  File "/usr/local/lib/python3.9/site-packages/bench/utils/render.py", line 95, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bench/utils/system.py", line 79, in init
    get_app(
  File "/usr/local/lib/python3.9/site-packages/bench/app.py", line 433, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.9/site-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bench/app.py", line 232, in install
    install_app(
  File "/usr/local/lib/python3.9/site-packages/bench/app.py", line 553, in install_app
    bench.run(f"{bench.python} -m pip install {quiet_flag} --upgrade -e {app_path} {cache_flag}")
  File "/usr/local/lib/python3.9/site-packages/bench/bench.py", line 47, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.9/site-packages/bench/utils/__init__.py", line 153, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-bench"

Failed for version 12 and 13.
And explicitly using option --python python3 or python3.9 or not using at all.

I have the same issue

I have also faced the same issue in develop branch when installing the erpnext app.

Frappe installed successfully and it’s worked fine but when I get the erpnext app then

bench get-app erpnext https://github.com/frappe/erpnext
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

Getting erpnext
$ git clone https://github.com/frappe/erpnext --depth 1 --origin upstream
Cloning into 'erpnext'...
remote: Enumerating objects: 5932, done.
remote: Counting objects: 100% (5932/5932), done.
remote: Compressing objects: 100% (4958/4958), done.
remote: Total 5932 (delta 1213), reused 2853 (delta 695), pack-reused 0
Receiving objects: 100% (5932/5932), 18.28 MiB | 152.00 KiB/s, done.
Resolving deltas: 100% (1213/1213), done.
Ignoring dependencies of https://github.com/frappe/erpnext. To install dependencies use --resolve-deps
Installing erpnext
$ /home/scs/ERPNext_Develop/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/scs/ERPNext_Develop/frappe-bench/apps/erpnext
 error: subprocess-exited-with-error
 
 × python setup.py bdist_wheel did not run successfully.
 │ exit code: 1
 ╰─> [26 lines of output]
   /tmp/pip-install-i7se33_q/hiredis_b40174a4d351454e90e7d1b1a01dcc51/setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
    import sys, imp, os, glob, io
   /home/scs/ERPNext_Develop/frappe-bench/env/lib/python3.10/site-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    warnings.warn(
   running bdist_wheel
   running build
   running build_py
   creating build
   creating build/lib.linux-x86_64-3.10
   creating build/lib.linux-x86_64-3.10/hiredis
   copying hiredis/__init__.py -> build/lib.linux-x86_64-3.10/hiredis
   copying hiredis/version.py -> build/lib.linux-x86_64-3.10/hiredis
   copying hiredis/hiredis.pyi -> build/lib.linux-x86_64-3.10/hiredis
   copying hiredis/py.typed -> build/lib.linux-x86_64-3.10/hiredis
   running build_ext
   creating build/temp.linux-x86_64-3.10
   creating build/temp.linux-x86_64-3.10/src
   creating build/temp.linux-x86_64-3.10/vendor
   creating build/temp.linux-x86_64-3.10/vendor/hiredis
   x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Ivendor -I/home/scs/ERPNext_Develop/frappe-bench/env/include -I/usr/include/python3.10 -c src/hiredis.c -o build/temp.linux-x86_64-3.10/src/hiredis.o
   In file included from src/hiredis.c:1:
   src/hiredis.h:4:10: fatal error: Python.h: No such file or directory
     4 | #include <Python.h>
      |     ^~~~~~~~~~
   compilation terminated.
   error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
   [end of output]
 
 note: This error originates from a subprocess, and is likely not a problem with pip.
 ERROR: Failed building wheel for hiredis
 error: subprocess-exited-with-error
 
 × python setup.py bdist_wheel did not run successfully.
 │ exit code: 1
 ╰─> [23 lines of output]
   You are running without Cython installed. It is highly recommended to run
    pip install cython>=0.29.21,<1.0.0
   before you continue
   /home/scs/ERPNext_Develop/frappe-bench/env/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
    warnings.warn(
   Warning: 'classifiers' should be a list, got type 'tuple'
   running bdist_wheel
   running build
   running build_py
   creating build
   creating build/lib.linux-x86_64-3.10
   creating build/lib.linux-x86_64-3.10/jsonobject
   copying jsonobject/__init__.py -> build/lib.linux-x86_64-3.10/jsonobject
   copying jsonobject/exceptions.py -> build/lib.linux-x86_64-3.10/jsonobject
   running build_ext
   creating build/temp.linux-x86_64-3.10
   creating build/temp.linux-x86_64-3.10/jsonobject
   x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/scs/ERPNext_Develop/frappe-bench/env/include -I/usr/include/python3.10 -c jsonobject/api.c -o build/temp.linux-x86_64-3.10/jsonobject/api.o
   jsonobject/api.c:18:10: fatal error: Python.h: No such file or directory
    18 | #include "Python.h"
      |     ^~~~~~~~~~
   compilation terminated.
   error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
   [end of output]
 
 note: This error originates from a subprocess, and is likely not a problem with pip.
 ERROR: Failed building wheel for jsonobject
 error: subprocess-exited-with-error
 
 × Running setup.py install for jsonobject did not run successfully.
 │ exit code: 1
 ╰─> [25 lines of output]
   You are running without Cython installed. It is highly recommended to run
    pip install cython>=0.29.21,<1.0.0
   before you continue
   /home/scs/ERPNext_Develop/frappe-bench/env/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
    warnings.warn(
   Warning: 'classifiers' should be a list, got type 'tuple'
   running install
   /home/scs/ERPNext_Develop/frappe-bench/env/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
   running build
   running build_py
   creating build
   creating build/lib.linux-x86_64-3.10
   creating build/lib.linux-x86_64-3.10/jsonobject
   copying jsonobject/__init__.py -> build/lib.linux-x86_64-3.10/jsonobject
   copying jsonobject/exceptions.py -> build/lib.linux-x86_64-3.10/jsonobject
   running build_ext
   creating build/temp.linux-x86_64-3.10
   creating build/temp.linux-x86_64-3.10/jsonobject
   x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/scs/ERPNext_Develop/frappe-bench/env/include -I/usr/include/python3.10 -c jsonobject/api.c -o build/temp.linux-x86_64-3.10/jsonobject/api.o
   jsonobject/api.c:18:10: fatal error: Python.h: No such file or directory
    18 | #include "Python.h"
      |     ^~~~~~~~~~
   compilation terminated.
   error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
   [end of output]
 
 note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> jsonobject

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

How to resolve issue @ankush.

Experiencing the same problem while installing Frappe and ERPNext version 13

Using Python 3.10

@NCP that appears to be due to missing development libraries.

If you’re running python you need to install python{version-string}-dev package too, that’s complete python distribution; by default ubuntu might not be installing development packages.

2 Likes

Resolved by installing python{version-string}-dev

Ohh great @ankush :partying_face:

I resolved the issue for develop branch by python{version-string}-dev

sudo apt install python3.10-dev

I was stuck for two days then after resolved.

Thank You!

2 Likes

@ankush I already have Python 3.8.10 . If I install sudo apt install python3.10-dev this any problem raised in future when gaving bench start. Please let me know

Thanks In Advance!

I am also having the same challenge, I installed python3.10 manually and I now have both versions 3.8.10 and 3.10 and also ran also sudo apt install python3.10-dev and installed the packages but am still getting >> ERROR: Package ‘frappe’ requires a different Python: 3.8.10 not in ‘>=3.10’

1 Like
2 Likes