Error Initializing Frappe

While trying to install frappe I face this weird issue

bench init --frappe-branch version-14 frappe_mekatronics
Setting Up Environment
$ python3 -m venv env
$ /home/mekatronics/frappe_mekatronics/env/bin/python -m pip install --quiet --upgrade pip
$ /home/mekatronics/frappe_mekatronics/env/bin/python -m pip install --quiet wheel
Getting frappe
$ git clone --branch version-14 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 3232, done.
remote: Counting objects: 100% (3232/3232), done.
remote: Compressing objects: 100% (2844/2844), done.
remote: Total 3232 (delta 377), reused 2159 (delta 277), pack-reused 0
Receiving objects: 100% (3232/3232), 16.31 MiB | 11.14 MiB/s, done.
Resolving deltas: 100% (377/377), done.
Installing frappe
$ /home/mekatronics/frappe_mekatronics/env/bin/python -m pip install --quiet --upgrade -e /home/mekatronics/frappe_mekatronics/apps/frappe 
  error: subprocess-exited-with-error
  × python egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      /home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/ SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/", line 10, in <module>
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/", line 459, in __init__
        File "/usr/lib/python3.10/distutils/", line 292, in __init__
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/", line 837, in finalize_options
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/", line 858, in _finalize_setup_keywords
          ep.load()(self,, value)
        File "/tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/.eggs/cffi-1.16.0-py3.10-linux-x86_64.egg/cffi/", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/.eggs/cffi-1.16.0-py3.10-linux-x86_64.egg/cffi/", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/.eggs/cffi-1.16.0-py3.10-linux-x86_64.egg/cffi/", line 25, in execfile
          exec(code, glob, glob)
        File "cairocffi/", line 26, in <module>
          ffi = FFI()
        File "/tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/.eggs/cffi-1.16.0-py3.10-linux-x86_64.egg/cffi/", line 48, in __init__
          import _cffi_backend as backend
      ImportError: /tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/.eggs/cffi-1.16.0-py3.10-linux-x86_64.egg/ failed to map segment from shared object
      [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.
subprocess.CalledProcessError: Command '/home/mekatronics/frappe_mekatronics/env/bin/python -m pip install --quiet --upgrade -e /home/mekatronics/frappe_mekatronics/apps/frappe ' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/", line 68, in init
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/", line 105, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/", line 79, in init
  File "/usr/local/lib/python3.10/dist-packages/bench/", line 444, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/", line 242, in install
  File "/usr/local/lib/python3.10/dist-packages/bench/", line 573, in install_app
  File "/usr/local/lib/python3.10/dist-packages/bench/", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/", line 158, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: /home/mekatronics/frappe_mekatronics/env/bin/python -m pip install --quiet --upgrade -e /home/mekatronics/frappe_mekatronics/apps/frappe 

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

Hi @Ameer_Muavia,

Please check the installation step.

I hope this helps.

Thank You!

Hello @NCP
Thanks for replying I have done installations a hundred of times and following this exact guide but I am stuck at this error and not able to resolve it.
Can’t make any sense out of it.

Try Following Things

  1. Uninstall Frappe bench and reinstall it using sudo -H pip3 install frappe-bench
  2. Stack Overflow

Hope it works :slight_smile:

sudo apt-get install python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils

Use this cmd

did that before and now again, the issue persists

Thanks for taking the time to answer. But nope nothing worked