Frappe-bench error on Ubuntu

Getting the following error when I run “bench init frappe-bench”. This is on Ubuntu 14.x

Checking connectivity… done.
installing frappe
Compiling /home/ubuntu/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py …
File “/home/ubuntu/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py”, line 64
yield from self.wsgi.close()
^
SyntaxError: invalid syntax

Command /home/ubuntu/frappe-bench/env/bin/python -c “import setuptools, tokenize;file=’/home/ubuntu/frappe-bench/env/build/mysql-python/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(’\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-fIXX9h-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/frappe-bench/env/include/site/python2.7 failed with error code 1 in /home/ubuntu/frappe-bench/env/build/mysql-python
Storing debug log for failure in /home/ubuntu/.pip/pip.log
Error: None

Highly appreciate any help

Thanks
T

Even I am getting same error:

Compiling /home/aditya/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py ...
  File "/home/aditya/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py", line 64
    yield from self.wsgi.close()
             ^
SyntaxError: invalid syntax

Command /home/aditya/frappe-bench/env/bin/python -c "import setuptools, tokenize;__file__='/home/aditya/frappe-bench/env/build/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-M23F4z-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aditya/frappe-bench/env/include/site/python2.7 failed with error code 1 in /home/aditya/frappe-bench/env/build/mysql-python
Storing debug log for failure in /home/aditya/.pip/pip.log
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/aditya/bench-repo/bench/cli.py", line 29, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/aditya/bench-repo/bench/cli.py", line 68, in init
    no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch)
  File "/home/aditya/bench-repo/bench/utils.py", line 47, in init
    get_app('frappe', frappe_path, branch=frappe_branch, bench=path)
  File "/home/aditya/bench-repo/bench/app.py", line 35, in get_app
    install_app(app, bench=bench)
  File "/home/aditya/bench-repo/bench/app.py", line 53, in install_app
    find_links=find_links))
  File "/home/aditya/bench-repo/bench/utils.py", line 59, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe' returned non-zero exit status 1
1 Like

I have the same problem on DigitalOcean and AWS…

A small patch is required to get MariaDB 5.5.40 running.

Update bench,

bench update --bench
# As root run,
bench patch mariadb-config

If you haven’t setup anything yet,
just remove frappe-bench and run the init command again

Hi,

Ive tried the update but the patch command gives an error
“Error: No such command “patch””

plz advise.

I am getting this error:

aditya@aditya-virtual-ubuntu:~$ bench init
Usage: bench init [OPTIONS] PATH

Error: Missing argument "path".

When I run the bench update --bench from the frappe-bench directory then it tries to update the frappe-bench then the following error is coming:

aditya@aditya-virtual-ubuntu:~/frappe-bench$ bench update --bench
Already up-to-date.
restarting 
Already up-to-date.
restarting 
From https://github.com/frappe/frappe
 * branch            HEAD       -> FETCH_HEAD
Already up-to-date.
Command /home/aditya/frappe-bench/env/bin/python -c "import setuptools, tokenize;__file__='/home/aditya/frappe-bench/env/build/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gs10HO-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aditya/frappe-bench/env/include/site/python2.7 failed with error code 1 in /home/aditya/frappe-bench/env/build/mysql-python
Storing debug log for failure in /home/aditya/.pip/pip.log
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/aditya/bench-repo/bench/cli.py", line 29, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/aditya/bench-repo/bench/cli.py", line 126, in update
    update_requirements()
  File "/home/aditya/bench-repo/bench/utils.py", line 244, in update_requirements
    exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
  File "/home/aditya/bench-repo/bench/utils.py", line 59, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command './env/bin/pip install -q -r ./apps/frappe/requirements.txt' returned non-zero exit status 1

Did you run bench update --bench first?

@adityaduggal What is the output of
tail -n100 ~/.pip/pip.log

   error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/aditya/frappe-bench/env/bin/python -c "import setuptools, tokenize;__file__='/home/aditya/frappe-bench/env/build/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gs10HO-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aditya/frappe-bench/env/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb

creating build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

running build_ext

building '_mysql' extension

creating build/temp.linux-x86_64-2.7

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -fno-omit-frame-pointer -g -pipe -Wno-uninitialized -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing

In file included from _mysql.c:44:0:

/usr/include/mysql/my_config.h:439:0: warning: "HAVE_WCSCOLL" redefined [enabled by default]

 #define HAVE_WCSCOLL

 ^

In file included from /usr/include/python2.7/pyconfig.h:3:0,

                 from /usr/include/python2.7/Python.h:8,

                 from _mysql.c:29:

/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h:911:0: note: this is the location of the previous definition

 #define HAVE_WCSCOLL 1

 ^

In file included from _mysql.c:44:0:

/usr/include/mysql/my_config.h:654:2: error: #error <my_config.h> MUST be included first!

 #error <my_config.h> MUST be included first!

  ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
  Removing temporary dir /home/aditya/frappe-bench/env/build...
Command /home/aditya/frappe-bench/env/bin/python -c "import setuptools, tokenize;__file__='/home/aditya/frappe-bench/env/build/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gs10HO-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aditya/frappe-bench/env/include/site/python2.7 failed with error code 1 in /home/aditya/frappe-bench/env/build/mysql-python
Exception information:
Traceback (most recent call last):
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/home/aditya/frappe-bench/env/local/lib/python2.7/site-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /home/aditya/frappe-bench/env/bin/python -c "import setuptools, tokenize;__file__='/home/aditya/frappe-bench/env/build/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gs10HO-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aditya/frappe-bench/env/include/site/python2.7 failed with error code 1 in /home/aditya/frappe-bench/env/build/mysql-python

Aditya, did you patch Mariadb with bench patch mariadb-config ?

@pdvyas When I run the command bench patch then nothing happens there is no message.

No message is good. Does bench update --requirements work now?

Will add a message to patching script.

yes,i get

hemant@hemant-VB:~$ bench update --bench


https://frappe.io/buy - Donate to help make better free and open source tools

hemant@hemant-VB:~$ bench patch mariadb-config
Usage: bench [OPTIONS] COMMAND [ARGS]…

Error: No such command “patch”.

@hpema108
What is the output of

cd ~/bench-repo  
git pull
sudo bench patch mariadb-config

?

thnx, looks like it installed, but still see some sytax error

hemant@hemant-VB:~$ cd ~/bench-repo/
hemant@hemant-VB:~/bench-repo$ git pull
remote: Counting objects: 21, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 21 (delta 11), reused 10 (delta 0)
Unpacking objects: 100% (21/21), done.
From https://github.com/frappe/bench
a23f944…8818b15 master -> origin/master
Updating a23f944…8818b15
Fast-forward
bench/cli.py | 14 ++++++++++++++
bench/patches/fix-mariadb.sh | 13 +++++++++++++
bench/patches/my_config.h.patch | 22 ++++++++++++++++++++++
install_scripts/setup_frappe.sh | 8 ++++±–
4 files changed, 54 insertions(+), 3 deletions(-)
create mode 100755 bench/patches/fix-mariadb.sh
create mode 100644 bench/patches/my_config.h.patch
hemant@hemant-VB:~/bench-repo$ sudo bench patch mariadb-config
[sudo] password for hemant:
hemant@hemant-VB:~/bench-repo$ cd ~
hemant@hemant-VB:~$ bench init frappe-bench
Already using interpreter /usr/bin/python
Cloning into ‘frappe’…
remote: Counting objects: 60941, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 60941 (delta 7), reused 0 (delta 0)
Receiving objects: 100% (60941/60941), 25.02 MiB | 345.00 KiB/s, done.
Resolving deltas: 100% (43109/43109), done.
Checking connectivity… done.
installing frappe
Compiling /home/hemant/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py …
File “/home/hemant/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py”, line 64
yield from self.wsgi.close()
^
SyntaxError: invalid syntax

Wrote ./assets/js/frappe-web.min.js - 90k
Wrote ./assets/js/print_format_v3.min.js - 18k
Wrote ./assets/css/frappe.css - 224k
Wrote ./assets/css/frappe-web.css - 163k
Wrote ./assets/js/editor.min.js - 26k
Wrote ./assets/js/frappe.min.js - 608k
Wrote ./assets/js/slickgrid.min.js - 102k
Wrote ./assets/js/canvasResize.min.js - 22k
no crontab for hemant
Bench frappe-bench initialized
hemant@hemant-VB:~$

ignore the syntax error

Patch solved the problem… Thanks

Thanks, up and running, got a sort of dummies manual too from all this work :wink:

I know the help of ok, but I put all into one doc from installing bench to getting it hosted on port 80 like production. If any one would like a copy let me know.

thanks

Hi Pdvyas! I don’t know if you will want to help me, maybe is a dumb question, but i have tried to figure out how to fix this syntax error. This error can cause any problems to gunicorn? Where is the source file that create the build directory inside env directory? Thanks!

Will not cause any problems