Try ERPNext Buy Support Partners Foundation

Bench migrate Return error

I have a problem I have python 3.5 installed I have a problem when I do bench migrate :
*the Error:
halloula@guesmi-X555LD:~/frappe-bench$ bench migrate
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

Migrating contrat.partenaire
Updating DocTypes for frappe : [========================================]
Generating Website Theme Files…
Compiling Python Files…
*** Error compiling ‘…/apps/frappe/frappe/utils/commands.py’…
File “…/apps/frappe/frappe/utils/commands.py”, line 11
req = requests.get(f"https://api.github.com/users/{org}/repos", {“type”: “sources”, “per_page”: 200})
^
SyntaxError: invalid syntax

I try to change version python from SyntaxError: invalid syntax during updating

so I change to python 3.6
sudo update-alternatives --config python3 .
but now when I do any command bench :start,update,migrate …it return :
*the Error:
halloula@guesmi-X555LD:~/frappe-bench$ bench update --requirements
Traceback (most recent call last):
File “/home/halloula/.local/bin/bench”, line 6, in
from pkg_resources import load_entry_point
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2927, in
@_call_aside
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2913, in _call_aside
f(*args, **kwargs)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2940, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 635, in _build_master
ws.require(requires)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 943, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 829, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘frappe-bench’ distribution was not found and is required by the application
I don’t know what is the problem please help

Try this

bench --site all migrate

Also see this post

I also do bench --site all migrate but same it return error

bench --site all migrate return error
return self.main(*args, **kwargs)
File “/home/halloula/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/halloula/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/halloula/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/halloula/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/halloula/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/halloula/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/commands/init.py”, line 26, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/commands/site.py”, line 266, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/halloula/frappe-bench/apps/frappe/frappe/migrate.py”, line 65, in migrate
frappe.get_single(‘Installed Applications’).update_versions()
File “/home/halloula/frappe-bench/apps/frappe/frappe/core/doctype/installed_applications/installed_applications.py”, line 18, in update_versions
self.save()

Do you have any custom apps? and is this production or development mode?
Have you tried clearing cache?

it work by
bench migrate-env python3.6
bench clear-cache
bench clear-website-cache
bench migrate
but now I can’t see Doctypes created in the DoctypeList

Just run a

bench update --reset

and you should be OK

still not working and can’t show no Doctypes no Module no tabDoctype I only show it in the directory
Error return by bench update --reset
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
error: Could not fetch upstream
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/halloula/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/home/halloula/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/commands/init.py”, line 26, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/commands/site.py”, line 266, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/halloula/frappe-bench/apps/frappe/frappe/migrate.py”, line 65, in migrate
frappe.get_single(‘Installed Applications’).update_versions()
File “/home/halloula/frappe-bench/apps/frappe/frappe/core/doctype/installed_applications/installed_applications.py”, line 18, in update_versions
self.save()
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 273, in save
return self._save(*args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 312, in _save
self._validate()
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 461, in _validate
self._validate_mandatory()
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 750, in _validate_mandatory
name=self.name))
frappe.exceptions.MandatoryError: [Installed Applications, Installed Applications]: git_branch

try bench update --patch Maybe it would work.

same error
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/halloula/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/home/halloula/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/halloula/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/commands/init.py”, line 26, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/commands/site.py”, line 266, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/halloula/frappe-bench/apps/frappe/frappe/migrate.py”, line 65, in migrate
frappe.get_single(‘Installed Applications’).update_versions()
File “/home/halloula/frappe-bench/apps/frappe/frappe/core/doctype/installed_applications/installed_applications.py”, line 18, in update_versions
self.save()
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 273, in save
return self._save(*args, **kwargs)
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 312, in _save
self._validate()
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 461, in _validate
self._validate_mandatory()
File “/home/halloula/frappe-bench/apps/frappe/frappe/model/document.py”, line 750, in _validate_mandatory
name=self.name))
frappe.exceptions.MandatoryError: [Installed Applications, Installed Applications]: git_branch

From what I see, the library management app may be the culprit?

The clue is in Not a git repository error message.

Do you have any app which doesn’t have git initialized and may be that’s causing the problem?

1 Like

I’am new at ERPNEXT , I d’ont know what you mean by app which doesn’t have git initialized
After frappe installation I just do
bench new-app library_management
bench new-site library
bench --site library install-app library_management
bench start
then set developer_mode as 1 in the site_config.json
and create the DocTypes
bench use library
bench migrate
that’s it I d’ont initilized git

Please solve this problem with :expressionless:

Perhaps remove the library_management app and try again.
I can confirm what kenneth says above - I have another instance where removing custom apps fixed the .git problem after a lot of struggling

please create branch for your app and then try to migrate it will get solved