Error while installation: CryptContext object has no attribute

Hello guys, I’m new at Tryton and trying since hours to get the installation of trytond 5.6 on Ubuntu 20 running.

I’m trying to run the command trytond-admin -c /etc/tryton/trytond.conf -d trytondb --all

After entering the user data, following error appears:

Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 23, in <module>
  File "/usr/local/lib/python3.5/dist-packages/trytond/", line 114, in run
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/", line 31, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/", line 1714, in save
    (([r], save_values[r]) for r in to_write), ()))
  File "/usr/local/lib/python3.5/dist-packages/trytond/res/", line 379, in write
    super(User, cls).write(*args)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/", line 159, in wrapper
    return func(cls, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/", line 1013, in write
    field.set(cls, fname, *fargs)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/fields/", line 122, in set
    setter(Model.browse(ids), name, value)
  File "/usr/local/lib/python3.5/dist-packages/trytond/res/", line 255, in set_password
    'password_hash': cls.hash_password(value),
  File "/usr/local/lib/python3.5/dist-packages/trytond/res/", line 670, in hash_password
    return CRYPT_CONTEXT.hash(password)
AttributeError: 'CryptContext' object has no attribute 'hash'

Already spent hours with looking for a solution. Any ideas how to fix the error?

Thanks in advance

You do not seem to have the proper passlib library which contains CryptContext.hash.

Hello Chris,

I would suggest to install Tryton in a Python virtual environment with pip, so you leave your default system clean and untouched. When you mess up things, you can easily remove the virtual environment and start again with a clean slate.

If you are going with the virtual environment see if it is possible to reinstall Ubuntu as you are getting a lot of trouble because of the globally installed packages.

BTW. I’m in the process of creating a document how to install Tryton within a virtual environment which can be used as a base to build upon.

1 Like

Thank you so far for your responses. Did the installation of tryton as described here.

The command
pip3 install passlib

Requirement already satisfied: passlib in /usr/lib/python3/dist-packages (1.6.5)

same output when using pip3.5 install


Have you tried pip3 install passlib --upgrade?

That’s the solution. After upgrading to passlib-1.7.2 everything works fine.

I’m excited to use Tryton now. Great community!


Indeed the hash method was added on version 1.7.0. So I created Issue 9631: Required passlib >=1.7.0 - Tryton issue tracker.

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