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 https://github.com/frappe/frappe.git --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 setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      /home/mekatronics/frappe_mekatronics/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(
      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/setup.py", line 10, in <module>
          setup(
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/dist.py", line 459, in __init__
          _Distribution.__init__(
        File "/usr/lib/python3.10/distutils/dist.py", line 292, in __init__
          self.finalize_options()
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/dist.py", line 837, in finalize_options
          ep(self)
        File "/home/mekatronics/frappe_mekatronics/env/lib/python3.10/site-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/tmp/pip-install-dr7q2pbr/cairocffi_62efda939edc42f7b8289e5cf161c565/.eggs/cffi-1.16.0-py3.10-linux-x86_64.egg/cffi/setuptools_ext.py", 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/setuptools_ext.py", 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/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "cairocffi/ffi_build.py", 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/api.py", 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/_cffi_backend.cpython-310-x86_64-linux-gnu.so: 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/make.py", line 68, in init
    init(
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/system.py", line 79, in init
    get_app(
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", 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/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 242, in install
    install_app(
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 573, in install_app
    bench.run(
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", 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/__init__.py", 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 https://stackoverflow.com/questions/34370962/no-module-named-cffi-backend

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