Upgrade from Ubuntu 14.04 to 16.04, bench update error

Hi,

I upgraded my server Ubuntu from 14.04 to 16.04. After that when I ran bench update I got the following error:

frappe@physiotouch:~/frappe-bench$ bench update INFO:bench.utils:updating bench Already up-to-date. Traceback (most recent call last): File "./env/bin/pip", line 7, in from pip import main File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/__init__.py", line 21, in from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 62, in from .packages.urllib3.exceptions import DependencyWarning File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in import urllib3 File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/urllib3/__init__.py", line 8, in from .connectionpool import ( File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 35, in from .connection import ( File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/urllib3/connection.py", line 2, in import datetime ImportError: No module named datetime Please install these dependencies using the command: sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk Traceback (most recent call last): File "/usr/local/bin/bench", line 9, in load_entry_point('bench==0.1', 'console_scripts', 'bench')() File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli bench_command() File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/home/frappe/bench-repo/bench/commands/update.py", line 62, in update _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset) File "/home/frappe/bench-repo/bench/commands/update.py", line 75, in _update before_update(bench_path=bench_path, requirements=requirements) File "/home/frappe/bench-repo/bench/utils.py", line 637, in before_update validate_pillow_dependencies(bench_path, requirements) File "/home/frappe/bench-repo/bench/utils.py", line 645, in validate_pillow_dependencies exec_cmd("{pip} install Pillow".format(pip=pip)) File "/home/frappe/bench-repo/bench/utils.py", line 127, in exec_cmd raise CommandFailedError(cmd) bench.utils.CommandFailedError: ./env/bin/pip install Pillow frappe@physiotouch:~/frappe-bench$

I did try to install the recommended packages:
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

I had already those installed. Could this be due to problem with pip? Any ideas how to fix this?
Appreciate any help, thanks.

BR,
Juho

Please install these dependencies

Hi,

Thanks for the reply.
I did try that and I had everything up-to-date.
Could this be something to do with python2 vs python3?

BR,
Juho

Hi,

Could any one help me on this issue?

BR,
Juho

This seems to an be issue relevant to the virtual environment setup, caused by it not finding datetime after the upgrade.
Try running
$ cp /usr/bin/python2.7 $(which python2.7)
to fix it.

More info: Python: no module named datetime? - Ask Ubuntu
python - ImportError: No module named datetime - Stack Overflow

same error here…
tried to fix with

cp /usr/bin/python2.7 $(which python2.7)

got message “are the same file”

Another probable way would be to reinitialise the virtualenv by:
$ cd /home/frappe/frappe-bench/env/ $ virtualenv .

2 Likes

This did the trick! Thank you very much for the help!

perfekt!
bench update is running, next step, get nginx back to work…

Hi @pratu16x7

I encountered the same errors here but after following the steps outlined above, I’m now getting the error below when trying to run bench update

INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
/bin/sh: 1: ./env/bin/pip: Too many levels of symbolic links
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.92', 'console_scripts', 'bench')()
  File "/home/erpnext/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/bench-repo/bench/commands/update.py", line 62, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
  File "/home/erpnext/bench-repo/bench/commands/update.py", line 75, in _update
    before_update(bench_path=bench_path, requirements=requirements)
  File "/home/erpnext/bench-repo/bench/utils.py", line 646, in before_update
    validate_pillow_dependencies(bench_path, requirements)
  File "/home/erpnext/bench-repo/bench/utils.py", line 654, in validate_pillow_dependencies
    exec_cmd("{pip} install Pillow".format(pip=pip))
  File "/home/erpnext/bench-repo/bench/utils.py", line 130, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow

It says something about “Too many levels of symbolic links”. Any assistance will be much appreciated as the site is currently not accessible

Thanks

Hi @pratu16x7

I solved the issue by doing ‘rm bin/python*’ from the /home/frappe/frappe-bench/env/ folder and then did the ‘virtualenv .’ again and everything worked this time

Cheers!

1 Like