Mac OS Setup failed

Hi All, bech was working properly but after I tried to use python 3 I started to get errors, now when I start from the beginning I got

bench init itmasr-bench --python python3
INFO:bench.utils:virtualenv -q env -p /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
INFO:bench.utils:env/bin/pip -q install --upgrade pip
INFO:bench.utils:env/bin/pip -q install wheel
INFO:bench.utils:env/bin/pip -q install six
INFO:bench.utils:env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit
INFO:bench.app:getting app frappe
INFO:bench.utils:git clone https://github.com/frappe/frappe.git   --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 194613 (delta 10), reused 0 (delta 0), pack-reused 194589
Receiving objects: 100% (194613/194613), 222.83 MiB | 222.00 KiB/s, done.
Resolving deltas: 100% (149201/149201), done.
Updating files: 100% (2474/2474), done.
installing frappe
INFO:bench.app:installing frappe
INFO:bench.utils:itmasr-bench/env/bin/pip install -q  -e itmasr-bench/apps/frappe 
  WARNING: The script chardetect is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts gunicorn and gunicorn_paster are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pybabel is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pygmentize is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts iptest, iptest3, ipython and ipython3 are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script html2text is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script watchmedo is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts rq, rqinfo and rqworker are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script ndg_httpclient is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script zxcvbn is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pyjwt is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts csscapture, csscombine and cssparse are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts futurize and pasteurize are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script google-oauthlib-tool is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script faker is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts coverage, coverage-3.7 and coverage3 are installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script sqlformat is installed in '/Users/a.fathy/development/itmasr-bench/env/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.19.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > bootstrap@4.3.1" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.3.1" has unmet peer dependency "popper.js@^1.14.7".
[4/4] 🔨  Building fresh packages...
✨  Done in 27.03s.
INFO:bench.utils:bench build
/usr/local/Cellar/python/3.7.4_1/bin/python3.7: Error while finding module specification for 'frappe.utils.bench_helper' (ModuleNotFoundError: No module named 'frappe')

Usage: bench [OPTIONS] COMMAND [ARGS]...
Try "bench --help" for help.

Error: No such command "build".
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/a.fathy/development/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/a.fathy/development/bench-repo/bench/commands/make.py", line 31, in init
    python 		 = python)
  File "/Users/a.fathy/development/bench-repo/bench/utils.py", line 88, in init
    build_assets(bench_path=path)
  File "/Users/a.fathy/development/bench-repo/bench/utils.py", line 208, in build_assets
    exec_cmd(command, cwd=bench_path)
  File "/Users/a.fathy/development/bench-repo/bench/utils.py", line 161, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: bench build

Hi the missing bench commands is an environment problem - if you can run bench update that may restore it - these may help with ideas

OTOH I am not Mac literate! So before you go too far, you will want a real Mac user to confirm this is indeed how to specify what python to use?

For example this may give you clues

Be sure to let us know what you determine thanks!

So your issue is here, because you don’t have frappe installed in your virtual env:

To Fix it:

Step 1: Go inside virtual env inside itmasr-bench dir.
Step 2: Activate the virtual environment.
Step 3: execute, pip install -e ./apps/frappe --no-cache-dir

and then execute the bench build command to build the assets inside frappe app.

If bench build command doesn’t work while activation of virtual environment then deactivate the virtual environment and run it from global environment. sometime bench build doesn’t work in virtual env because you’ve installed the bench in global environment.

If you still want to use the bench commands in virtual environment then install the bench in virtual environment using commands below:

Step 1: Clone the bench using: git clone GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps --branch master(If you don’t have bench repository in your system)
Step 2: Install the cloned repo in virtual environment using: ./env/bin/pip3 install -e ./bench or (NOTE: execute this command inside itmasr-bench dir.

1 Like

Thanks navdeepghai good catch and learning - I failed to notice ModuleNotFoundError

You’re welcome.

That’s why we work as community!!:grinning:

thanks for your reply.
I am using virtualenvwrapper
how can I manage to do with this?
thanks for your assistance.

So follow these step to fix the issue:

Step 1: Go to itmasr-bench dir.
Step 2: Install the bench in virtual environment(instructions:GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps) from virtual environment.
Step 3: after installing the bench then install the frappe app in virtual environment using bench or pip command.
Step 4: Install the erpnext app.

For Installing the any frappe app you need to clone it and insert the app name entry in ./sites/apps.txt file manually or use bench get-app [app-name] --branch [branch-name] command to install it automatically.
NOTE:
Don’t use bench init command to intialize the new environment.

After successful installation then execute the following command to fix the dependency issue:

Command 1: bench setup requirements
Command 2: bench setup socketio
Command 3: bench setup redis
Command 4: bench build
Command 5: bench setup procfile to setup development environment.

If you want to use the production environment then execute additional commands:
Command 5: bench setup nginx
Command 6: bench setup supervisor
after executing these command then make symbolic link manually for nginx.conf and supervisor.conf file.

NOTE:
to make symbolic link you’ve to install the nginx and supervisor services.