ModuleNotFoundError: No module named 'trytond.modules.stock'

After installing few modules, I’ve an error when using

trytond-admin -c /etc/tryton/trytond.conf -d tryton --all

toactivate the modules

trytond-admin -c /etc/tryton/trytond.conf -d tryton --all
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/trytond/modules/__init__.py", line 54, 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 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'trytond.modules.stock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 23, in <module>
    admin.run(options)
  File "/usr/local/lib/python3.7/dist-packages/trytond/admin.py", line 53, in run
    activatedeps=options.activatedeps)
  File "/usr/local/lib/python3.7/dist-packages/trytond/pool.py", line 151, in init
    self.start()
  File "/usr/local/lib/python3.7/dist-packages/trytond/pool.py", line 104, in start
    register_classes()
  File "/usr/local/lib/python3.7/dist-packages/trytond/modules/__init__.py", line 340, in register_classes
    the_module = import_module(module)
  File "/usr/local/lib/python3.7/dist-packages/trytond/modules/__init__.py", line 78, in import_module
    module = spec.loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 907, in load_module
  File "<frozen importlib._bootstrap_external>", line 732, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 696, in _load
  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 "/usr/lib/python3/dist-packages/trytond/modules/stock/__init__.py", line 9, in <module>
    from .product import *
  File "/usr/lib/python3/dist-packages/trytond/modules/stock/product.py", line 20, in <module>
    from trytond.modules.product import TemplateFunction
ImportError: cannot import name 'TemplateFunction' from 'trytond.modules.product' (/usr/local/lib/python3.7/dist-packages/trytond/modules/product/__init__.py)

Module stock has been installed

root@tryton:~# apt install tryton-modules-stock
Reading package lists... Done
Building dependency tree       
Reading state information... Done
tryton-modules-stock is already the newest version (5.0.2-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

and it looks I’m on 5.6

root@tryton:~# trytond --version
trytond 5.6.6

This is on Debian 10, after installing few packages from the distribution
apt install tryton-modules-account tryton-modules-account-be tryton-modules-purchase tryton-modules-sale tryton-modules-bank tryton-modules-analytic-account

It seems I was mixing different versions.
I’ll made a new succesful test using virtualenv.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.