ImportError: cannot import name ‘get_zip_file’

I am trying to use a backup of a server tryton , i created a virtual environement and i installed some packages to make the tryton work with the postgresql , i created my database “test-tryton” but when i typed: trytond/bin/trytond-admin -c trytond.conf --all -d test-tryton -vv
there is an error tell me cannot import name 'get_zip_file' from 'relatorio.templates.opendocument'
this is the full response when i typed the command (-a):

1943 140149218940736 [2021-01-08 18:47:05,426] MainProcess INFO trytond.backend.postgresql.database connect to "test-tryton"
1943 140149218940736 [2021-01-08 18:47:07,870] MainProcess WARNING py.warnings /home/lenovor/.virtualenvs/mynewproject/lib/python3.7/site-packages/relatorio/templates/__init__.py:29: UserWarning: Unable to load plugin 'chart'
  warnings.warn("Unable to load plugin '%s'" % name)

Traceback (most recent call last):
  File "trytond/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/admin.py", line 53, in run
    activatedeps=options.activatedeps)
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/pool.py", line 149, in init
    self.start()
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/pool.py", line 102, in start
    register_classes()
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/modules/__init__.py", line 318, in register_classes
    import trytond.ir
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/ir/__init__.py", line 5, in <module>
    from .translation import *
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/ir/translation.py", line 19, in <module>
    from relatorio.templates.opendocument import get_zip_file
ImportError: cannot import name 'get_zip_file' from 'relatorio.templates.opendocument' (/home/lenovor/.virtualenvs/mynewproject/lib/python3.7/site-packages/relatorio/templates/opendocument.py)

help me please and thanks in advance , am using debian 10

This is because you have a too old version of Relatorio installed. You need at least version 0.7.0.

thanks for your response ,after that when i typed when more time the command: (-a) trytond/bin/trytond-admin -c trytond.conf --all -d test-tryton -vv
the response was:

UserWarning: Unable to load plugin 'chart'  warnings.warn("Unable to load plugin '%s'" % name)
ImportError: cannot import name 'Response' from 'werkzeug.exceptions'

this is the full response on my debian 10 when i typed the command (-a)

7851 140478579705664 [2021-01-09 11:00:08,205] MainProcess INFO trytond.backend.postgresql.database connect to "test-tryton"
7851 140478579705664 [2021-01-09 11:00:08,706] MainProcess WARNING py.warnings /home/lenovor/.virtualenvs/mynewproject/lib/python3.7/site-packages/relatorio/templates/__init__.py:29: UserWarning: Unable to load plugin 'chart'
  warnings.warn("Unable to load plugin '%s'" % name)

7851 140478579705664 [2021-01-09 11:00:09,808] MainProcess INFO trytond.modules ir:registering classes
7851 140478579705664 [2021-01-09 11:00:09,808] MainProcess INFO trytond.modules jasper_reports:registering classes
7851 140478579705664 [2021-01-09 11:00:09,814] MainProcess INFO trytond.modules res:registering classes
7851 140478579705664 [2021-01-09 11:00:09,814] MainProcess INFO trytond.modules web_shortener:registering classes
7851 140478579705664 [2021-01-09 11:00:09,822] MainProcess INFO trytond.modules audit_log:registering classes
7851 140478579705664 [2021-01-09 11:00:09,855] MainProcess INFO trytond.modules audit_trail:registering classes
7851 140478579705664 [2021-01-09 11:00:09,858] MainProcess INFO trytond.modules authentication_sms:registering classes
7851 140478579705664 [2021-01-09 11:00:09,861] MainProcess INFO trytond.modules country:registering classes
7851 140478579705664 [2021-01-09 11:00:09,865] MainProcess INFO trytond.modules currency:registering classes
7851 140478579705664 [2021-01-09 11:00:09,870] MainProcess INFO trytond.modules dashboard:registering classes
7851 140478579705664 [2021-01-09 11:00:09,874] MainProcess INFO trytond.modules file_format:registering classes
7851 140478579705664 [2021-01-09 11:00:09,938] MainProcess INFO trytond.modules imap:registering classes
7851 140478579705664 [2021-01-09 11:00:09,953] MainProcess INFO trytond.modules ldap_authentication:registering classes
7851 140478579705664 [2021-01-09 11:00:10,188] MainProcess INFO trytond.modules marketing:registering classes
7851 140478579705664 [2021-01-09 11:00:10,190] MainProcess INFO trytond.modules mass_editing:registering classes
7851 140478579705664 [2021-01-09 11:00:10,194] MainProcess INFO trytond.modules printer_cups:registering classes
7851 140478579705664 [2021-01-09 11:00:10,214] MainProcess INFO trytond.modules smtp:registering classes
7851 140478579705664 [2021-01-09 11:00:10,220] MainProcess INFO trytond.modules tests:registering classes
7851 140478579705664 [2021-01-09 11:00:10,220] MainProcess INFO trytond.modules user_role:registering classes
7851 140478579705664 [2021-01-09 11:00:10,227] MainProcess INFO trytond.modules whooshsearch:registering classes
7851 140478579705664 [2021-01-09 11:00:10,429] MainProcess INFO trytond.modules party:registering classes
7851 140478579705664 [2021-01-09 11:00:10,456] MainProcess INFO trytond.modules bank:registering classes
7851 140478579705664 [2021-01-09 11:00:10,482] MainProcess INFO trytond.modules company:registering classes
7851 140478579705664 [2021-01-09 11:00:10,656] MainProcess INFO trytond.modules country_zip:registering classes
7851 140478579705664 [2021-01-09 11:00:10,660] MainProcess INFO trytond.modules country_zip_es:registering classes
7851 140478579705664 [2021-01-09 11:00:10,665] MainProcess INFO trytond.modules google_maps:registering classes
7851 140478579705664 [2021-01-09 11:00:10,672] MainProcess INFO trytond.modules party_alternative_reports:registering classes
7851 140478579705664 [2021-01-09 11:00:10,676] MainProcess INFO trytond.modules party_camerdata:registering classes
7851 140478579705664 [2021-01-09 11:00:10,679] MainProcess INFO trytond.modules party_categories:registering classes
7851 140478579705664 [2021-01-09 11:00:10,682] MainProcess INFO trytond.modules party_cnae:registering classes
7851 140478579705664 [2021-01-09 11:00:10,688] MainProcess INFO trytond.modules party_comment:registering classes
7851 140478579705664 [2021-01-09 11:00:10,690] MainProcess INFO trytond.modules party_edi:registering classes
7851 140478579705664 [2021-01-09 11:00:10,693] MainProcess INFO trytond.modules party_iae:registering classes
7851 140478579705664 [2021-01-09 11:00:10,697] MainProcess INFO trytond.modules party_identifier:registering classes
7851 140478579705664 [2021-01-09 11:00:10,700] MainProcess INFO trytond.modules party_lang:registering classes
7851 140478579705664 [2021-01-09 11:00:10,704] MainProcess INFO trytond.modules party_manufacturer:registering classes
7851 140478579705664 [2021-01-09 11:00:10,707] MainProcess INFO trytond.modules party_maps:registering classes
7851 140478579705664 [2021-01-09 11:00:10,861] MainProcess INFO trytond.modules party_relationship:registering classes
7851 140478579705664 [2021-01-09 11:00:10,865] MainProcess INFO trytond.modules party_search:registering classes
7851 140478579705664 [2021-01-09 11:00:10,867] MainProcess INFO trytond.modules party_siret:registering classes
7851 140478579705664 [2021-01-09 11:00:10,877] MainProcess INFO trytond.modules party_social_contact:registering classes
7851 140478579705664 [2021-01-09 11:00:10,880] MainProcess INFO trytond.modules party_tradename:registering classes
7851 140478579705664 [2021-01-09 11:00:10,882] MainProcess INFO trytond.modules party_vat_unique:registering classes
7851 140478579705664 [2021-01-09 11:00:10,887] MainProcess INFO trytond.modules party_zip:registering classes
7851 140478579705664 [2021-01-09 11:00:10,891] MainProcess INFO trytond.modules web_user:registering classes
7851 140478579705664 [2021-01-09 11:00:10,898] MainProcess INFO trytond.modules account:registering classes
7851 140478579705664 [2021-01-09 11:00:11,153] MainProcess INFO trytond.modules activity:registering classes
7851 140478579705664 [2021-01-09 11:00:11,161] MainProcess INFO trytond.modules asterisk:registering classes
7851 140478579705664 [2021-01-09 11:00:11,174] MainProcess INFO trytond.modules bank_es:registering classes
7851 140478579705664 [2021-01-09 11:00:11,177] MainProcess INFO trytond.modules company_bank:registering classes
7851 140478579705664 [2021-01-09 11:00:11,184] MainProcess INFO trytond.modules company_logo:registering classes
7851 140478579705664 [2021-01-09 11:00:11,188] MainProcess INFO trytond.modules company_user:registering classes
7851 140478579705664 [2021-01-09 11:00:11,191] MainProcess INFO trytond.modules company_work_time:registering classes
7851 140478579705664 [2021-01-09 11:00:11,195] MainProcess INFO trytond.modules employee_leave:registering classes
7851 140478579705664 [2021-01-09 11:00:11,203] MainProcess INFO trytond.modules galatea:registering classes
7851 140478579705664 [2021-01-09 11:00:11,321] MainProcess INFO trytond.modules html_report:registering classes
7851 140478579705664 [2021-01-09 11:00:11,325] MainProcess INFO trytond.modules incoterm:registering classes
7851 140478579705664 [2021-01-09 11:00:11,340] MainProcess INFO trytond.modules jasper_reports_options:registering classes
7851 140478579705664 [2021-01-09 11:00:11,343] MainProcess INFO trytond.modules notification_email:registering classes
7851 140478579705664 [2021-01-09 11:00:11,350] MainProcess INFO trytond.modules product:registering classes
7851 140478579705664 [2021-01-09 11:00:11,372] MainProcess INFO trytond.modules quiz:registering classes
7851 140478579705664 [2021-01-09 11:00:11,380] MainProcess INFO trytond.modules welding_certification:registering classes
7851 140478579705664 [2021-01-09 11:00:11,932] MainProcess INFO trytond.modules working_shift:registering classes
7851 140478579705664 [2021-01-09 11:00:11,940] MainProcess INFO trytond.modules account_bank_statement:registering classes
7851 140478579705664 [2021-01-09 11:00:11,960] MainProcess INFO trytond.modules account_code_digits:registering classes
7851 140478579705664 [2021-01-09 11:00:11,965] MainProcess INFO trytond.modules account_de_skr03:registering classes
7851 140478579705664 [2021-01-09 11:00:11,966] MainProcess INFO trytond.modules account_dunning:registering classes
7851 140478579705664 [2021-01-09 11:00:11,976] MainProcess INFO trytond.modules account_financial_statement:registering classes
7851 140478579705664 [2021-01-09 11:00:11,985] MainProcess INFO trytond.modules account_move_draft:registering classes
7851 140478579705664 [2021-01-09 11:00:11,987] MainProcess INFO trytond.modules account_move_line_related:registering classes
7851 140478579705664 [2021-01-09 11:00:11,990] MainProcess INFO trytond.modules account_move_renumber:registering classes
7851 140478579705664 [2021-01-09 11:00:11,996] MainProcess INFO trytond.modules account_reconcile:registering classes
7851 140478579705664 [2021-01-09 11:00:12,000] MainProcess INFO trytond.modules account_reconcile_different_party:registering classes
7851 140478579705664 [2021-01-09 11:00:12,019] MainProcess INFO trytond.modules account_search_with_dot:registering classes
7851 140478579705664 [2021-01-09 11:00:12,022] MainProcess INFO trytond.modules activity_contact:registering classes
7851 140478579705664 [2021-01-09 11:00:12,026] MainProcess INFO trytond.modules analytic_account:registering classes
7851 140478579705664 [2021-01-09 11:00:12,038] MainProcess INFO trytond.modules asset:registering classes
7851 140478579705664 [2021-01-09 11:00:12,045] MainProcess INFO trytond.modules babi:registering classes
7851 140478579705664 [2021-01-09 11:00:14,775] MainProcess INFO trytond.modules carrier:registering classes
7851 140478579705664 [2021-01-09 11:00:14,781] MainProcess INFO trytond.modules company_account_sync:registering classes
7851 140478579705664 [2021-01-09 11:00:14,806] MainProcess INFO trytond.modules customs:registering classes
7851 140478579705664 [2021-01-09 11:00:14,825] MainProcess INFO trytond.modules edocument_unece:registering classes
7851 140478579705664 [2021-01-09 11:00:14,830] MainProcess INFO trytond.modules electronic_mail:registering classes
7851 140478579705664 [2021-01-09 11:00:14,849] MainProcess INFO trytond.modules employee_vacancy:registering classes
7851 140478579705664 [2021-01-09 11:00:14,875] MainProcess INFO trytond.modules galatea_cms:registering classes
7851 140478579705664 [2021-01-09 11:00:14,888] MainProcess INFO trytond.modules party_asterisk:registering classes
7851 140478579705664 [2021-01-09 11:00:14,899] MainProcess INFO trytond.modules product_attachments:registering classes
7851 140478579705664 [2021-01-09 11:00:14,958] MainProcess INFO trytond.modules product_attribute:registering classes
7851 140478579705664 [2021-01-09 11:00:15,021] MainProcess INFO trytond.modules product_barcode:registering classes
7851 140478579705664 [2021-01-09 11:00:15,093] MainProcess ERROR trytond.modules.product_barcode.product Unable to import barcodenumber. Install barcodenumber package.
7851 140478579705664 [2021-01-09 11:00:15,096] MainProcess INFO trytond.modules product_brand:registering classes
7851 140478579705664 [2021-01-09 11:00:15,151] MainProcess INFO trytond.modules product_categories:registering classes
7851 140478579705664 [2021-01-09 11:00:15,213] MainProcess INFO trytond.modules product_category:registering classes
7851 140478579705664 [2021-01-09 11:00:15,268] MainProcess INFO trytond.modules product_classification:registering classes
7851 140478579705664 [2021-01-09 11:00:15,321] MainProcess INFO trytond.modules product_code_unique:registering classes
7851 140478579705664 [2021-01-09 11:00:15,395] MainProcess INFO trytond.modules product_cost_history:registering classes
7851 140478579705664 [2021-01-09 11:00:15,457] MainProcess INFO trytond.modules product_groups:registering classes
7851 140478579705664 [2021-01-09 11:00:15,503] MainProcess INFO trytond.modules product_images:registering classes
7851 140478579705664 [2021-01-09 11:00:15,569] MainProcess INFO trytond.modules product_kit:registering classes
7851 140478579705664 [2021-01-09 11:00:15,638] MainProcess INFO trytond.modules product_measurements:registering classes
7851 140478579705664 [2021-01-09 11:00:15,703] MainProcess INFO trytond.modules product_package:registering classes
7851 140478579705664 [2021-01-09 11:00:16,087] MainProcess INFO trytond.modules product_price_list:registering classes
7851 140478579705664 [2021-01-09 11:00:16,175] MainProcess INFO trytond.modules product_review:registering classes
7851 140478579705664 [2021-01-09 11:00:16,253] MainProcess INFO trytond.modules product_rohs:registering classes
7851 140478579705664 [2021-01-09 11:00:16,403] MainProcess INFO trytond.modules product_search_code:registering classes
7851 140478579705664 [2021-01-09 11:00:16,458] MainProcess INFO trytond.modules quality_control:registering classes
7851 140478579705664 [2021-01-09 11:00:16,686] MainProcess INFO trytond.modules stock:registering classes
7851 140478579705664 [2021-01-09 11:00:17,469] MainProcess INFO trytond.modules timesheet:registering classes
Traceback (most recent call last):
  File "trytond/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/admin.py", line 53, in run
    activatedeps=options.activatedeps)
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/pool.py", line 149, in init
    self.start()
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/pool.py", line 102, in start
    register_classes()
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/modules/__init__.py", line 333, in register_classes
    the_module = import_module(module)
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/modules/__init__.py", line 53, in import_module
    module = importlib.import_module(fullname)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/modules/timesheet/__init__.py", line 8, in <module>
    from . import routes
  File "/home/lenovor/.virtualenvs/mynewproject/trytond/trytond/modules/timesheet/routes.py", line 5, in <module>
    from werkzeug.exceptions import abort, Response
ImportError: cannot import name 'Response' from 'werkzeug.exceptions' (/home/lenovor/.virtualenvs/mynewproject/lib/python3.7/site-packages/werkzeug/exceptions.py)

This looks like ImportError: cannot import name Response (#8671) · Issues · Tryton / Tryton · GitLab, which was fixed quite some time ago.

Are you sure your Tryton installation is up to date?

am using a back up of tryton of another person , who already worked with this tryton on his debian , i just create a virtual environement on my linux then i installed some packages on my debian 10 and i copied the files of the backup into the virtual environement i created , i created the database postgresql then i typed the command (-a) .
but there is something i want to know it everytime i typed the command (-a) , the response was also a warning on the response of linux :
UserWarning: Unable to load plugin ‘chart’ warnings.warn(“Unable to load plugin ‘%s’” % name)

is it normal !!

Does the backup contain only the data, or the whole Tryton installation?

Is it possible that, in the virtual environment you created, you have a newer version of Werkzerg than they had on their system?

This may be because you need some additional Python packages installed for the chart plugin (pycha >= 0.4.0 and pyyaml)?

i did “pip install pycha “then “” pip install pyyaml” , the same warning happen , is this warning causes the error"cannot import name ‘Response’ from ‘werkzeug.exceptions’ (/home/lenovor/.virtualenvs/mynewproject/lib/python3.7/site-packages/werkzeug/exceptions.py)”!?

No, I don’t think they are related.

I believe the warning is because relatorio can’t load the chart plugin (which is probably not going to be a problem for you).

I think the error is because the version of Werkzeug is newer than the version supported by the release of Tryton that you are running.

1 Like

am a beginner on those things , i see this link that u mentionned to solve the problem of the werkzeug
[Issue 8671: ImportError: cannot import name Response - Tryton issue tracker]
but i do no how to use it to solve my problem , can u guide me please what i should d !o

If Issue 8671: ImportError: cannot import name Response - Tryton issue tracker is the cause of your problem you should update the trytond package to a release that has that fix already applied. You should also pick a release in the same series as you are already running (the series is the first 2 parts of the version number, so for version X.Y.Z ensure the X.Y part stays the same).

i update the trytond using the command
pip3 install trytond==5.6.
but always when i type the command (-a) it tell me the same error “cannot import name Response”

What is the output when you type:

trytond/bin/trytond-admin --version

the response when typed is :
trytond-admin 5.2.1

With your virtual environment active do a

pip list installed

And look for the package Werkzeug. For your version is should be 0.16.1. If not do

pip install --upgrade Werkzeug==0.16.1

i fixed it with the version 0.15 from werkeug , and now it tell me there is no module named “edifact” , i tried with pip install edifact , but it tell me give the version !! , what’s the version od edifact i should put to install “edifact”

No standard module depends on edifact.

when i type the command : trytond/bin/trytond-admin -c trytond.conf --all -d test-tryton -vv
it tell me :

from edifact.message import Message
ModuleNotFoundError: No module named ‘edifact’
so what i should do , thanks in advance .

Ask the question to the author of this module. It is not a standard Tryton module so nobody here can know what you have installed and what are the dependencies of this unknown module.

1 Like

yeah thanks i deleted the module depends on , but after that when i typed the command : trytond/bin/trytond -c trytond.conf --dev
to launch the tryton , there is on error : 3033 139947999958848 [2021-01-11 11:10:42,122] MainProcess ERROR trytond.modules.product_barcode.product Unable to import barcodenumber. Install barcodenumber package.

3033 139947999958848 [2021-01-11 11:11:24,673] MainProcess INFO werkzeug * Running on http://localhost:8000/ (Press CTRL+C to quit)
3033 139947999958848 [2021-01-11 11:11:24,786] MainProcess INFO werkzeug * Restarting with stat
3073 140498425968448 [2021-01-11 11:11:53,437] MainProcess ERROR trytond.modules.product_barcode.product Unable to import barcodenumber. Install barcodenumber package.
3073 140498004387584 [2021-01-11 11:13:15,538] MainProcess INFO werkzeug 127.0.0.1 - - [11/Jan/2021 11:13:15] “GET / HTTP/1.1” 405 -
3073 140498004387584 [2021-01-11 11:13:56,405] MainProcess INFO werkzeug 127.0.0.1 - - [11/Jan/2021 11:13:56] “GET /favicon.ico HTTP/1.1” 405 -

This is another non-standard module, so again you need to talk to the author of this module.