Unable to install ERPnext v8 due to pip v19

Hello, I cannot install ERPnext v8 for database restore purpose. I cannot upgrade previous instance because of bad install procedure (therefore cannot do $ bench switch-to-branch v9.x.x) and some dependencies are not available on ubuntu 14.04.
My previous instance is:
ERPNext: v8.11.0 (master)
Frappe Framework: v8.10.1 (master)
and I believe it is still on bench v3.x based on README.md

I install new instance using easy-install script and able to access ERPnext normally on v11. To go to v8.x.x I did

$ cd ~/frappe-bench
$ bench switch-to-branch v8.x.x

and here is the result:

remote: Enumerating objects: 158, done.
remote: Counting objects: 100% (103/103), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 24 (delta 21), reused 13 (delta 12), pack-reused 0
Unpacking objects: 100% (24/24), done.
From https://github.com/frappe/erpnext
   c90364f94d..033b1babe8  develop    -> upstream/develop
Branch v8.x.x does not exist in Upstream for erpnext
Switching for frappe
INFO:bench.utils:git config --unset-all remote.upstream.fetch
INFO:bench.utils:git config --add remote.upstream.fetch '+refs/heads/*:refs/remotes/upstream/*'
INFO:bench.utils:git fetch upstream 
INFO:bench.utils:git checkout v8.x.x
Checking out files: 100% (22587/22587), done.
Switched to branch 'v8.x.x'
Your branch is ahead of 'upstream/v8.x.x' by 1 commit.
  (use "git push" to publish your local commits)
INFO:bench.utils:git merge upstream/v8.x.x
Already up to date.
Successfully switched branches for:
frappe
Switched to v8.x.x
Please run `bench update --patch` to be safe from any differences in database schema

this takes my attention: Branch v8.x.x does not exist in Upstream for erpnext
then when I do $ bench update --hard
For some reason of trying to install bench using manual install for trying to resolve it myself, it didn’t work and the error message is same, I cannot do bench update normally, will wipe disk tomorrow to fresh install again.
this is the result:

INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (6.0.0)
INFO:bench.app:pulling frappe
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/v8.x.x
HEAD is now at e8f9fbb7f Prevent duplicate sidebar display in mobile view (#4585)
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/develop
HEAD is now at 033b1babe8 Merge pull request #17186 from rohitwaghchaure/bank_account_in_bank_reconcilliation
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages (19.0.3)
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/bench-repo/requirements.txt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/frappe 
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Command "python setup.py egg_info" failed with error code 1 in /home/frappe/frappe-bench/apps/frappe/
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-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 76, in _update
    update_requirements(bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 435, in update_requirements
    install_app(app, bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/app.py", line 171, in install_app
    find_links=find_links))
  File "/home/frappe/bench-repo/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q  -e ./apps/frappe 

In my opinion, the problem is these two lines:

INFO:bench.utils:updating bench
   .... skip many lines
Command "python setup.py egg_info" failed with error code 1 in /home/frappe/frappe-bench/apps/frappe/
  1. Bench update forces to update bench to latest version, therefore installing latest pip: version 19.x.x
  2. when I search for “Command “python setup.py egg_info” failed with error code 1” in this forum, mostly about custom apps, but all tells that it is not compatible with pip version 10 and have to modify setup.py file on specified app.

Doing $ bench update means pulling ~/.bench (I replaced it with ~/bench-repo) ./apps/frappe and ./apps/erpnext so any modifications prior updating is repleaced from branch. Is there any way to install previous versions?

I downgraded to pip to 9.0.3 and things worked for me. Command for downgrading pip is

python -m pip install –user pip==9.0.3
1 Like

Thank you for replying, I am aware that installing pip manually able to install erpnext and frappe. But executing

bench update

is updating bench, pip to 19.x, then updating each apps using pip 19.x therefore

I need database from v11 to be modified to match v8 field names, and I do not know any other way to make it match v8 field names other than $ bench update --reset

I can’t remember offhand how to do it, but you can prevent the pip upgrade in bench update. Possibly in the requirements.txt file, or patches.txt, but I am not 100% sure.
Hopefully one of the proper experts will see this note and enlighten us :slight_smile:

if you run a

bench --site site1.local migrate

it will match the DB schemas up to the right version

1 Like

this is the result:

frappe@localhost:~/frappe-bench$ bench --site site1.local migrate
Migrating site1.local
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 217, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 24, in run_all
executed = [p[0] for p in frappe.db.sql(“”“select patch from tabPatch Log”“”)]
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 165, in sql
self._cursor.execute(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 250, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 50, in defaulterrorhandler
raise errorvalue
_mysql_exceptions.ProgrammingError: (1146, “Table ‘_158573b6e7941dc5.tabPatch Log’ doesn’t exist”)

I think Backup and restore become nuisance because of forced bench update to latest version

You could try this

bench update --patch

but beyond that I’m not sure what else to suggest

I solved the problem. I have to do this in order to be able to install v8.x.x

cd /home/frappe/frappe-bench
bench switch-to-branch v8.x.x
bench update
.env/bin/pip install --upgrade pip==9.0.3
.env/bin/pip -q -e ./apps/frappe
.env/bin/pip -q -e ./apps/erpnext
bench migrate

I have to do that for v8.x.x and v9.x.x. For v10.x.x is compatible with pip 19.x
How do I change this thread to solved?

2 Likes