Bench init : IOError: [Errno 2] No such file or directory: './apps/frappe/frappe/__init__.py'

On fresh install debian 9 :

bench init frappe-bench
INFO:bench.utils:virtualenv -q env -p /usr/bin/python
Already using interpreter /usr/bin/python
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: Counting objects: 141426, done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 141426 (delta 27), reused 28 (delta 15), pack-reused 141362
Receiving objects: 100% (141426/141426), 132.10 MiB | 3.08 MiB/s, done.
Resolving deltas: 100% (106504/106504), done.
(‘installing’, u’frappe’)
INFO:bench.app:installing frappe
INFO:bench.utils:frappe-bench/env/bin/pip install -q -e frappe-bench/apps/frappe --no-cache-dir
Updating node packages…
Traceback (most recent call last):
File “/home/frappe/.local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/home/frappe/.local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/.local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/.local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/.local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/.local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/make.py”, line 28, in init
python = python)
File “/home/frappe/bench-repo/bench/utils.py”, line 75, in init
update_node_packages(bench_path=path)
File “/home/frappe/bench-repo/bench/utils.py”, line 436, in update_node_packages
v = semantic_version.Version(get_current_version(‘frappe’))
File “/home/frappe/bench-repo/bench/app.py”, line 257, in get_current_version
with open(os.path.join(repo_dir, os.path.basename(repo_dir), ‘init.py’)) as f:
IOError: [Errno 2] No such file or directory: ‘./apps/frappe/frappe/init.py’

file frappe-bench/apps/frappe/frappe/init.py exists and is owned by the user who launch the bench init

I have the same issue. Tried with Ubuntu 16.04.3 x64 with easy install scritps:

wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
python install.py --develop --user frappe

Do you use the same easy install script? There might be a problem with the script

TASK [init bench] **************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bench", "init", "/home/frappe/frappe-bench", "--frappe-branch", "develop"], "delta": "0:02:27.106953", "end": "2018-02-25 10:37:30.124451", "failed": true, "rc": 1, "start": "2018-02-25 10:35:03.017498", "stderr": "INFO:bench.utils:virtualenv -q env -p /usr/bin/python\nINFO:bench.utils:./env/bin/pip -q install --upgrade pip\nINFO:bench.utils:./env/bin/pip -q install wheel\nINFO:bench.utils:./env/bin/pip -q install six\nINFO:bench.utils:./env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit\nINFO:bench.app:getting app frappe\nINFO:bench.utils:git clone https://github.com/frappe/frappe.git --branch develop  --origin upstream\nCloning into 'frappe'...\nINFO:bench.app:installing frappe\nINFO:bench.utils:/home/frappe/frappe-bench/env/bin/pip install -q  -e /home/frappe/frappe-bench/apps/frappe --no-cache-dir\nTraceback (most recent call last):\n  File \"/usr/local/bin/bench\", line 11, in <module>\n    load_entry_point('bench', 'console_scripts', 'bench')()\n  File \"/home/frappe/.bench/bench/cli.py\", line 40, in cli\n    bench_command()\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 722, in __call__\n    return self.main(*args, **kwargs)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 697, in main\n    rv = self.invoke(ctx)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 1066, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 895, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 535, in invoke\n    return callback(*args, **kwargs)\n  File \"/home/frappe/.bench/bench/commands/make.py\", line 28, in init\n    python \t\t = python)\n  File \"/home/frappe/.bench/bench/utils.py\", line 75, in init\n    update_node_packages(bench_path=path)\n  File \"/home/frappe/.bench/bench/utils.py\", line 436, in update_node_packages\n    v = semantic_version.Version(get_current_version('frappe'))\n  File \"/home/frappe/.bench/bench/app.py\", line 257, in get_current_version\n    with open(os.path.join(repo_dir, os.path.basename(repo_dir), '__init__.py')) as f:\nIOError: [Errno 2] No such file or directory: './apps/frappe/frappe/__init__.py'", "stderr_lines": ["INFO:bench.utils:virtualenv -q env -p /usr/bin/python", "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 --branch develop  --origin upstream", "Cloning into 'frappe'...", "INFO:bench.app:installing frappe", "INFO:bench.utils:/home/frappe/frappe-bench/env/bin/pip install -q  -e /home/frappe/frappe-bench/apps/frappe --no-cache-dir", "Traceback (most recent call last):", "  File \"/usr/local/bin/bench\", line 11, in <module>", "    load_entry_point('bench', 'console_scripts', 'bench')()", "  File \"/home/frappe/.bench/bench/cli.py\", line 40, in cli", "    bench_command()", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 722, in __call__", "    return self.main(*args, **kwargs)", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 697, in main", "    rv = self.invoke(ctx)", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 1066, in invoke", "    return _process_result(sub_ctx.command.invoke(sub_ctx))", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 895, in invoke", "    return ctx.invoke(self.callback, **ctx.params)", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 535, in invoke", "    return callback(*args, **kwargs)", "  File \"/home/frappe/.bench/bench/commands/make.py\", line 28, in init", "    python \t\t = python)", "  File \"/home/frappe/.bench/bench/utils.py\", line 75, in init", "    update_node_packages(bench_path=path)", "  File \"/home/frappe/.bench/bench/utils.py\", line 436, in update_node_packages", "    v = semantic_version.Version(get_current_version('frappe'))", "  File \"/home/frappe/.bench/bench/app.py\", line 257, in get_current_version", "    with open(os.path.join(repo_dir, os.path.basename(repo_dir), '__init__.py')) as f:", "IOError: [Errno 2] No such file or directory: './apps/frappe/frappe/__init__.py'"], "stdout": "Already using interpreter /usr/bin/python\n('installing', u'frappe')\nUpdating node packages...", "stdout_lines": ["Already using interpreter /usr/bin/python", "('installing', u'frappe')", "Updating node packages..."]}

Hi @JoEz, thank you for your answer.

I’m not sure it’s the same bug, why do you think it’s the same problem ?

Regards.

Notice your traceback and this one are identical 22.02 yarn errors on build in develop branch?

Problem found and the correction works for me

As JoEz mentioned, we have faced the same bug repoted earlier

There is a parameter missing (bench_path) in get_current_version function call in update_node_packages function in the utils.py in .bench repo
.bench/bench/utils.py

Correct the function call like this:
v = semantic_version.Version(get_current_version('frappe', bench_path))

And re-run installation

1 Like

Hi, thanks for finding that out. Can you please open a PR with the fix?

Unfortunately that’s one of the problems, there are errors on rollup so that are not packing javascript and css correctly …and another one on honcho that I’m not able to find out a solution.

Have a look at:

Can u please double check?