[Bench Update] libmariadbclient.so.18: cannot open shared object file: No such file or directory

Hi,

While updating with bench update, encountered following error,

 (spos-server)gangadhar@Dev:~/erpnext/spos-server/frappe-bench$ bench update
Already up-to-date.
From https://github.com/frappe/erpnext
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
From https://github.com/frappe/frappe
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
From https://github.com/indictranstech/spos-server
 * branch            master     -> FETCH_HEAD
Already up-to-date.
/home/gangadhar/erpnext/spos-server/frappe-bench/env/bin/python: libmariadbclient.so.18: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/home/gangadhar/erpnext/spos-server/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/gangadhar/erpnext/spos-server/bench-repo/bench/cli.py", line 56, in cli
    bench()
  File "/home/gangadhar/erpnext/spos-server/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/gangadhar/erpnext/spos-server/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/gangadhar/erpnext/spos-server/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gangadhar/erpnext/spos-server/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gangadhar/erpnext/spos-server/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/gangadhar/erpnext/spos-server/bench-repo/bench/cli.py", line 249, in update
    backup_all_sites()
  File "/home/gangadhar/erpnext/spos-server/bench-repo/bench/utils.py", line 331, in backup_all_sites
    backup_site(site, bench=bench)
  File "/home/gangadhar/erpnext/spos-server/bench-repo/bench/utils.py", line 327, in backup_site
    run_frappe_cmd('--site', site, 'backup', bench=bench)
  File "/home/gangadhar/erpnext/spos-server/bench-repo/bench/utils.py", line 437, in run_frappe_cmd
    subprocess.check_call((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('/home/gangadhar/erpnext/spos-server/frappe-bench/env/bin/python', '-m', 'frappe.utils.bench_helper', 'frappe', '--site', 'mobill.indictranstech.com', 'backup')' returned non-zero exit status 1

Regards,

Does the file exist?

Yes file exists…

gangadhar@Dev:/usr/share$ dpkg -L libmariadbclient18
/.
/usr
/usr/lib
/usr/lib/libmysqlclient.so.18.0.0
/usr/lib/mysql
/usr/lib/mysql/plugin
/usr/lib/mysql/plugin/mysql_clear_password.so
/usr/lib/mysql/plugin/dialog.so
/usr/share
/usr/share/doc
/usr/share/doc/libmariadbclient18
/usr/share/doc/libmariadbclient18/copyright
/usr/share/doc/libmariadbclient18/changelog.Debian.gz
/usr/lib/libmysqlclient_r.so.18.0.0
/usr/lib/libmysqlclient.so.18
/usr/lib/libmysqlclient_r.so.18

I googled, found this.
https://github.com/Verlihub/verlihub-1.0.0/issues/18

I ran into this error after an upgrade of mariadb, the problem was mysql-python compiled against previous version of mysql. The fix is to rebuild mysql-python. Tried this in global env and importing MySQLdb worked, but not in the bench env. Had to reinstall mysql-python in each bench instance to resolve.

./env/bin/pip uninstall MySQL-python ./env/bin/pip install MySQL-python --no-cache-dir

Curious why this lib is needed for each bench env. Thought this might help someone, thanks.