Unable to install application in site

We try to install application in site1(sitename),we got below error, please give suggest me.
it is for development purpose, ubuntu14.04

## bench get-app snaphr https://gitlab.com/vivekn/Snaphr_client.git --branch develop**
( when i run above command, i got below error)

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 40, in get_app
    get_app(git_url, branch=branch)
  File "/home/frappe/.bench/bench/app.py", line 152, in get_app
    restart_supervisor_processes(bench_path=bench_path)
  File "/home/frappe/.bench/bench/utils.py", line 388, in restart_supervisor_processes
    supervisor_status = subprocess.check_output(['sudo', 'supervisorctl', 'status'], cwd=bench_path)
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['sudo', 'supervisorctl', 'status']' returned non-zero exit status 1

===========================================================
frappe@ashok:~/frappe-bench$ bench --site site1.local install-app tenderz

/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
  utils.DeprecatedIn23,

Installing tenderz...
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 303, in db_insert
    ), list(d.values()))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 199, in sql
    self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/connections.py", line 516, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/connections.py", line 727, in _read_query_result
    result.read()
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/connections.py", line 1066, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/connections.py", line 683, in _read_packet
    packet.check_error()
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/frappe/frappe-bench/env/lib/python3.4/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry 'Tenderz' for key 'PRIMARY'")

During handling of the above exception, another exception occurred:

You seem to have an environment problem -

In the first traceback, running python 2.7 the supervisor restart fails.

sudo supervisorctl status all

In the second traceback you are running python 3.4.

You would need to check logs for details.

Yes python version is a problem as suggested by @clarkej.

But at the same time there also an issue with DB Integrity.

So can you do one thing :

  • Either take new bench instance and try this with fresh install of erpnext and given app…
  • Or else: Take the backup, reinstall erpnext, install ur given app, and import ur db which u took backup of.

May be some colums and their data are colliding the integrity constraints, hence asking to wipe the db before installing the app and then restoring the db.

Assess this solution for ur scenario and try if u feel it might help you.

And yeah, the python version also seems to be an issue. Check the virtualenv confs pls.

Regards,

Parth.

1 Like