Issue installing bench on Mac M1

Hi all,
I’m new here, started a fresh bench env setup trying to install it using Rosetta terminal however I keep falling into the same issue.

/Users/medzarroug/Dev/frappe-bench/env/bin/python: Error while finding module specification for ‘frappe.utils.bench_helper’ (ModuleNotFoundError: No module named ‘frappe’)

Traceback (most recent call last):
File “/opt/homebrew/bin/bench”, line 8, in
sys.exit(cli())
File “/opt/homebrew/lib/python3.9/site-packages/bench/cli.py”, line 48, in cli
if sys.argv[1] in get_frappe_commands() + [“–site”, “–verbose”, “–force”, “–profile”]:
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘list’

Could you specify the command for which the errors have been pasted for?

bench start

however, any bench command returns the same error even “bench --version”
nothing seems to work after I cd to the “frappe-bench” folder

but when I leave the folder bench seems to work and “bench --version” returns:


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

WARN: Command not being executed in bench directory

5.5.0

INFO: A newer version of bench is available: 5.5.0 → 5.6.0

Other details:
Running terminal rosetta

medzarroug@Meds-Air dev % python --version
Python 2.7.16

medzarroug@Meds-Air dev % python3 --version
Python 3.9.7

medzarroug@Meds-Air dev % node --version
v16.9.1

medzarroug@Meds-Air dev % brew --version
Homebrew 3.2.11
Homebrew/homebrew-core (git revision 14aafc760f; last commit 2021-09-13)
Homebrew/homebrew-cask (git revision 6605195288; last commit 2021-09-13)

Firstly, I would recommend using Node version 14. I think this should fix things for you. There must be some errors when you first created the bench directory.

Try this again - pip3 install frappe-bench
and post the errors

Were there any errors when you created the frappe-bench folder?

On using bench init frappe-bench Command ?

I installed node 14

medzarroug@Meds-Air dev % pip3 install frappe-bench

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https ://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: frappe-bench in /opt/homebrew/lib/python3.9/site-packages (5.5.0)
Requirement already satisfied: python-crontab==2.4.0 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (2.4.0)
Requirement already satisfied: setuptools in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (57.4.0)
Requirement already satisfied: virtualenv in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (20.7.2)
Requirement already satisfied: GitPython==2.1.15 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (2.1.15)
Requirement already satisfied: honcho==1.0.1 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (1.0.1)
Requirement already satisfied: Click==7.0 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (7.0)
Requirement already satisfied: requests==2.22.0 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (2.22.0)
Requirement already satisfied: semantic-version==2.8.2 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (2.8.2)
Requirement already satisfied: Jinja2==2.11.3 in /opt/homebrew/lib/python3.9/site-packages (from frappe-bench) (2.11.3)
Requirement already satisfied: gitdb2<3,>=2 in /opt/homebrew/lib/python3.9/site-packages (from GitPython==2.1.15->frappe-bench) (2.0.6)
Requirement already satisfied: MarkupSafe>=0.23 in /opt/homebrew/lib/python3.9/site-packages (from Jinja2==2.11.3->frappe-bench) (2.0.1)
Requirement already satisfied: python-dateutil in /opt/homebrew/lib/python3.9/site-packages (from python-crontab==2.4.0->frappe-bench) (2.8.2)
Requirement already satisfied: certifi>=2017.4.17 in /opt/homebrew/lib/python3.9/site-packages (from requests==2.22.0->frappe-bench) (2021.5.30)
Requirement already satisfied: idna<2.9,>=2.5 in /opt/homebrew/lib/python3.9/site-packages (from requests==2.22.0->frappe-bench) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /opt/homebrew/lib/python3.9/site-packages (from requests==2.22.0->frappe-bench) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/homebrew/lib/python3.9/site-packages (from requests==2.22.0->frappe-bench) (1.25.11)
Requirement already satisfied: smmap2>=2.0.0 in /opt/homebrew/lib/python3.9/site-packages (from gitdb2<3,>=2->GitPython==2.1.15->frappe-bench) (3.0.1)
Requirement already satisfied: smmap>=3.0.1 in /opt/homebrew/lib/python3.9/site-packages (from smmap2>=2.0.0->gitdb2<3,>=2->GitPython==2.1.15->frappe-bench) (4.0.0)
Requirement already satisfied: six>=1.5 in /opt/homebrew/lib/python3.9/site-packages (from python-dateutil->python-crontab==2.4.0->frappe-bench) (1.16.0)
Requirement already satisfied: filelock<4,>=3.0.0 in /opt/homebrew/lib/python3.9/site-packages (from virtualenv->frappe-bench) (3.0.12)
Requirement already satisfied: backports.entry-points-selectable>=1.0.4 in /opt/homebrew/lib/python3.9/site-packages (from virtualenv->frappe-bench) (1.1.0)
Requirement already satisfied: distlib<1,>=0.3.1 in /opt/homebrew/lib/python3.9/site-packages (from virtualenv->frappe-bench) (0.3.2)
Requirement already satisfied: platformdirs<3,>=2 in /opt/homebrew/lib/python3.9/site-packages (from virtualenv->frappe-bench) (2.3.0)
medzarroug@Meds-Air dev % bench --version

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

WARN: Command not being executed in bench directory
5.5.0
INFO: A newer version of bench is available: 5.5.0 → 5.6.0
medzarroug@Meds-Air dev % bench init frappe-bench

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

$ /opt/homebrew/bin/virtualenv -q env -p python3

Getting frappe
$ git clone https ://github.com/frappe/frappe.git --depth 1 --origin upstream
Cloning into ‘frappe’…
remote: Enumerating objects: 3037, done.
remote: Counting objects: 100% (3037/3037), done.
remote: Compressing objects: 100% (2709/2709), done.
remote: Total 3037 (delta 440), reused 1090 (delta 244), pack-reused 0
Receiving objects: 100% (3037/3037), 16.45 MiB | 1.93 MiB/s, done.
Resolving deltas: 100% (440/440), done.

Installing frappe
$ frappe-bench/env/bin/python -m pip install -q -U -e frappe-bench/apps/frappe
ERROR: Command errored out with exit status 1:
command: /Users/medzarroug/Dev/frappe-bench/env/bin/python -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-install-plm96mnk/psycopg2-binary_05f84d65750042b38ddffd248b46936a/setup.py’“'”‘; file=’“'”‘/private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-install-plm96mnk/psycopg2-binary_05f84d65750042b38ddffd248b46936a/setup.py’“'”‘;f = getattr(tokenize, ‘"’“‘open’”’“‘, open)(file) if os.path.exists(file) else io.StringIO(’”‘“‘from setuptools import setup; setup()’”’“‘);code = f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ egg_info --egg-base /private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-pip-egg-info-yhfnrhei
cwd: /private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-install-plm96mnk/psycopg2-binary_05f84d65750042b38ddffd248b46936a/
Complete output (23 lines):
running egg_info
creating /private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-pip-egg-info-yhfnrhei/psycopg2_binary.egg-info
writing /private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-pip-egg-info-yhfnrhei/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-pip-egg-info-yhfnrhei/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-pip-egg-info-yhfnrhei/psycopg2_binary.egg-info/top_level.txt
writing manifest file ‘/private/var/folders/vg/gwc0jlcn035gh1jlrgp_1wk40000gn/T/pip-pip-egg-info-yhfnrhei/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
<https://www.psycopg.org/docs/install.html>).

----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/fc/51/0f2c6aec5c59e5640f507b59567f63b9d73a9317898810b4db311da32dfc/psycopg2-binary-2.8.6.tar.gz#sha256=11b9c0ebce097180129e422379b824ae21c8f2a6596b159c7659e2e5a00e1aa0 (from Links for psycopg2-binary) (requires-python:>=2.7,!=3.0.,!=3.1.,!=3.2.,!=3.3.). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement psycopg2-binary~=2.8.6 (from frappe) (from versions: 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1)
ERROR: No matching distribution found for psycopg2-binary~=2.8.6
$ yarn install
yarn install v1.22.11
[1/5] :mag: Validating package.json…
[2/5] :mag: Resolving packages…
[3/5] :truck: Fetching packages…
[4/5] :link: Linking dependencies…
warning " > cssnano@5.0.4" has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default@5.1.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > css-declaration-sorter@6.0.3” has unmet peer dependency “postcss@^8.0.9”.
warning “cssnano > cssnano-preset-default > cssnano-utils@2.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-calc@8.0.0” has unmet peer dependency “postcss@^8.2.2”.
warning “cssnano > cssnano-preset-default > postcss-colormin@5.1.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-convert-values@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-discard-comments@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-discard-duplicates@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-discard-empty@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-discard-overridden@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-merge-longhand@5.0.2” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-merge-rules@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-minify-font-values@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-minify-gradients@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-minify-params@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-minify-selectors@5.1.0” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-charset@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-display-values@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-positions@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-repeat-style@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-string@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-timing-functions@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-unicode@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-url@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-normalize-whitespace@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-ordered-values@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-reduce-initial@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-reduce-transforms@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-svgo@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-unique-selectors@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning “cssnano > cssnano-preset-default > postcss-merge-longhand > stylehacks@5.0.1” has unmet peer dependency “postcss@^8.2.15”.
warning " > esbuild-plugin-postcss2@0.0.9" has unmet peer dependency “less@^4.x”.
warning " > esbuild-plugin-postcss2@0.0.9" has unmet peer dependency “postcss@8.x”.
warning " > esbuild-plugin-postcss2@0.0.9" has unmet peer dependency “sass@^1.x”.
warning " > esbuild-plugin-postcss2@0.0.9" has unmet peer dependency “stylus@^0.x”.
warning “esbuild-vue > @vue/component-compiler@4.2.3” has unmet peer dependency “postcss@>=6.0”.
warning " > rtlcss@3.2.1" has unmet peer dependency “postcss@^8.2.4”.
warning Workspaces can only be enabled in private projects.
[5/5] :hammer: Building fresh packages…
:sparkles: Done in 14.22s.
Updating node packages…

Installing node dependencies for frappe
$ yarn install
yarn install v1.22.11
[1/5] :mag: Validating package.json…
[2/5] :mag: Resolving packages…
success Already up-to-date.
:sparkles: Done in 0.32s.
$ bench build
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

/Users/medzarroug/Dev/frappe-bench/env/bin/python: Error while finding module specification for ‘frappe.utils.bench_helper’ (ModuleNotFoundError: No module named ‘frappe’)

Traceback (most recent call last):
File “/opt/homebrew/bin/bench”, line 8, in
sys.exit(cli())
File “/opt/homebrew/lib/python3.9/site-packages/bench/cli.py”, line 48, in cli
if sys.argv[1] in get_frappe_commands() + [“–site”, “–verbose”, “–force”, “–profile”]:
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘list’
SUCCESS: Bench frappe-bench initialized
INFO: A newer version of bench is available: 5.5.0 → 5.6.0
medzarroug@Meds-Air dev % cd frappe-bench
medzarroug@Meds-Air frappe-bench % bench start

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

/Users/medzarroug/Dev/frappe-bench/env/bin/python: Error while finding module specification for ‘frappe.utils.bench_helper’ (ModuleNotFoundError: No module named ‘frappe’)

Traceback (most recent call last):
File “/opt/homebrew/bin/bench”, line 8, in
sys.exit(cli())
File “/opt/homebrew/lib/python3.9/site-packages/bench/cli.py”, line 48, in cli
if sys.argv[1] in get_frappe_commands() + [“–site”, “–verbose”, “–force”, “–profile”]:
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘list’
medzarroug@Meds-Air frappe-bench %

You are getting this error because frappe was not installed properly while running bench init frappe-bench due to postgres.

Try running brew install postgresql and then run bench init command again

1 Like

if someone Can list out the tested set of steps for installation.
would be helpful.

which version of python are you using? @LarryDevops

Got the same problem, please share the solution if you got

Which python version are you using? @Dipanshu_Gupta

You can run $ python --version to check the version.

python 2.7
python3 3.8

With Python3.8, it should work.

$ brew install postgresql

Ensure postgres is installed.

export PATH="/Applications/Postgres.app/Contents/Versions/<version>/bin:$PATH"

Ensure pg_config is in system path. If not locate the path and add it to path.

python3 -m pip install psycopg2-binary

Install psycopg2-binary seperately to check if installation is working fine without any errors.

Once it is done, you can try re-installing it.

Docker is the best way to develop and run Frappe Framework Apps on Mac or any platform really.

1 Like