Trying to install ERPNext on June 24, 2022 [Ansible and Jinja2 problem]

What content on scaleway.com/en/docs is affected?

What part(s) of the content would you like to see updated?

Install MariaDB
Installing the Frappe Framework
Getting production-ready

Problem 1 - Install MariaDB section

On Install MariaDB section, I ran into an issue regarding 404 Not Found Mirror Repository.

Error Output:

Ign:1 https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu focal/main arm64 mysql-common all 1:10.6.8+maria~focal
Ign:1 https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu focal/main arm64 mysql-common all 1:10.6.8+maria~focal
Err:1 https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu focal/main arm64 mysql-common all 1:10.6.8+maria~focal
  404  Not Found [IP: 197.155.77.1 443]
E: Failed to fetch https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu/pool/main/m/mariadb-10.6/mysql-common_10.6.8+maria~focal_all.deb  404  Not Found [IP: 197.155.77.1 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Temporary solution: I replaced https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu to https://mirrors.gigenet.com/mariadb/repo/10.6/ubuntu

Problem 2 - Installing the Frappe Framework Section

On Installing the Frappe Framework section, I ran into an issue regarding soft_unicode and markupsafe.

Error Output:

lance@erpnext-arm64v8:~$ bench init /home/lance/frappe-bench --frappe-path https://github.com/frappe/frappe --frappe-branch version-13 --python python3
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/lance/.bench/bench/__init__.py", line 1, in <module>
    from jinja2 import Environment, PackageLoader
  File "/usr/local/lib/python3.8/dist-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/usr/local/lib/python3.8/dist-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/usr/local/lib/python3.8/dist-packages/jinja2/utils.py", line 642, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/dist-packages/markupsafe/__init__.py)

Temporary solution: I attempted to fix it by running this command: sudo pip3 install markupsafe==2.0.1. Luckily, it worked.

Problem 3 - Getting production-ready

On Getting production-ready section, when I run the command sudo bench setup production <name>, it ran into an issue regarding Jinja2.

Error output:

lance@erpnext-arm64v8:~/frappe-bench$ sudo bench setup production lance
[sudo] password for lance: 
$ sudo -H /usr/bin/python3 -m pip install ansible
/usr/local/lib/python3.8/dist-packages/cryptography/hazmat/backends/openssl/x509.py:14: CryptographyDeprecationWarning: This version of cryptography contains a temporary pyOpenSSL fallback path. Upgrade pyOpenSSL now.
  warnings.warn(
Collecting ansible
  Downloading ansible-6.0.0-py3-none-any.whl (40.3 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 40.3 MB 9.2 MB/s 
Collecting ansible-core~=2.13.0
  Downloading ansible_core-2.13.1-py3-none-any.whl (2.1 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2.1 MB 35.8 MB/s 
Collecting resolvelib<0.9.0,>=0.5.3
  Downloading resolvelib-0.8.1-py2.py3-none-any.whl (16 kB)
Requirement already satisfied: PyYAML>=5.1 in /usr/lib/python3/dist-packages (from ansible-core~=2.13.0->ansible) (5.3.1)
Collecting jinja2>=3.0.0
  Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 133 kB 26.1 MB/s 
Requirement already satisfied: cryptography in /usr/local/lib/python3.8/dist-packages (from ansible-core~=2.13.0->ansible) (37.0.2)
Collecting packaging
  Downloading packaging-21.3-py3-none-any.whl (40 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 40 kB 6.7 MB/s 
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.8/dist-packages (from jinja2>=3.0.0->ansible-core~=2.13.0->ansible) (2.0.1)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.8/dist-packages (from cryptography->ansible-core~=2.13.0->ansible) (1.15.0)
Collecting pyparsing!=3.0.5,>=2.0.2
  Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 98 kB 7.5 MB/s 
Requirement already satisfied: pycparser in /usr/local/lib/python3.8/dist-packages (from cffi>=1.12->cryptography->ansible-core~=2.13.0->ansible) (2.21)
ERROR: bench 5.0.0 has requirement Jinja2==2.10.3, but you'll have jinja2 3.1.2 which is incompatible.
Installing collected packages: resolvelib, jinja2, pyparsing, packaging, ansible-core, ansible
  Attempting uninstall: jinja2
    Found existing installation: Jinja2 2.10.3
    Uninstalling Jinja2-2.10.3:
      Successfully uninstalled Jinja2-2.10.3
Successfully installed ansible-6.0.0 ansible-core-2.13.1 jinja2-3.1.2 packaging-21.3 pyparsing-3.0.9 resolvelib-0.8.1
$ bench setup role fail2ban
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 3.1.2 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('Jinja2==2.10.3'), {'bench'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3192, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Jinja2==2.10.3' distribution was not found and is required by bench
$ bench setup role nginx
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 3.1.2 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('Jinja2==2.10.3'), {'bench'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3192, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Jinja2==2.10.3' distribution was not found and is required by bench
$ bench setup role supervisor
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 3.1.2 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('Jinja2==2.10.3'), {'bench'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3192, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Jinja2==2.10.3' distribution was not found and is required by bench
Port configuration list:

Site skintalk.prod assigned port: 80
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/lance/.bench/bench/cli.py", line 41, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/lance/.bench/bench/commands/setup.py", line 73, in setup_production
    setup_production(user=user, yes=yes)
  File "/home/lance/.bench/bench/config/production_setup.py", line 25, in setup_production
    supervisor_conf = os.path.join(get_supervisor_confdir(), '{bench_name}.{extn}'.format(
  File "/usr/lib/python3.8/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

No solution was found on Problem 3 - Getting production-ready. I’m still stuck in this. Please help me. Thank you.

Comment: It seems the Ansible update June 22, 2022 broke the documentation.

1 Like

Stuck on the same point… Ansible requires jinga 3.0 while bench requires 2.10.3 is there a fix for this conflict?

1 Like

You need to setup supervisor and nginx manually.
.
Replace β€œsudo bench setup production ” with following commands (change amadeus to you non-root sudo username)


cd /home/amadeus/frappe-bench

pip install ansible==5.4.0 ansible-core==2.12.2 jinja2==2.10.3

sudo apt-get install supervisor nginx

bench setup supervisor
bench setup nginx

sudo ln -s /home/amadeus/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
sudo ln -s /home/amadeus/frappe-bench/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf

sudo shutdown -r now


Hope this help
I followed this tutorial.

1 Like

A simple solution Just fork any frappe/erpnext release between 13.11.x - <13.25.x , run bench update --reset to force version change then you’d be good to go.

Thes problems will be sorted in no time and you’ll be able to move to that new version.