# Error while installation: CryptContext object has no attribute

**URL:** https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264
**Category:** User
**Created:** [September 22, 2020, 10:51pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264 "2020-09-22T22:51:47Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![bechri](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@bechri](https://discuss.tryton.org/u/bechri)
#### Post date: [September 22, 2020, 10:51pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/1 "2020-09-22T22:51:47Z")

</div>

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:

```auto
Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 23, in <module>
    admin.run(options)
  File "/usr/local/lib/python3.5/dist-packages/trytond/admin.py", line 114, in run
    admin.save()
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/descriptors.py", line 31, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/modelstorage.py", line 1714, in save
    (([r], save_values[r]) for r in to_write), ()))
  File "/usr/local/lib/python3.5/dist-packages/trytond/res/user.py", line 379, in write
    super(User, cls).write(*args)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/modelsql.py", line 159, in wrapper
    return func(cls, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/modelsql.py", line 1013, in write
    field.set(cls, fname, *fargs)
  File "/usr/local/lib/python3.5/dist-packages/trytond/model/fields/function.py", line 122, in set
    setter(Model.browse(ids), name, value)
  File "/usr/local/lib/python3.5/dist-packages/trytond/res/user.py", line 255, in set_password
    'password_hash': cls.hash_password(value),
  File "/usr/local/lib/python3.5/dist-packages/trytond/res/user.py", 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  
–Chris

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 22, 2020, 11:11pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/2 "2020-09-22T23:11:25Z")

</div>

You do not seem to have the proper [passlib](https://pypi.org/project/passlib/) library which contains [`CryptContext.hash`](https://passlib.readthedocs.io/en/stable/lib/passlib.context.html#passlib.context.CryptContext.hash).

---

<div class="post-metadata">

### Author: ![edbo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/e/f14d63/32.png) [@edbo](https://discuss.tryton.org/u/edbo)
#### Post date: [September 23, 2020, 9:28am UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/3 "2020-09-23T09:28:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bechri](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@bechri](https://discuss.tryton.org/u/bechri)
#### Post date: [September 23, 2020, 4:20pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/4 "2020-09-23T16:20:09Z")

</div>

Thank you so far for your responses. Did the installation of tryton as described [here](https://pyodoo.com/article/how-install-tryton-56-ubuntu-1804-pycharm-configuration-and-install-modules/).

The command  
`pip3 install passlib`

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

same output when using pip3.5 install

–Chris

---

<div class="post-metadata">

### Author: ![edbo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/e/f14d63/32.png) [@edbo](https://discuss.tryton.org/u/edbo)
#### Post date: [September 23, 2020, 5:20pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/5 "2020-09-23T17:20:57Z")

</div>

Have you tried `pip3 install passlib --upgrade`?

---

<div class="post-metadata">

### Author: ![bechri](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@bechri](https://discuss.tryton.org/u/bechri)
#### Post date: [September 23, 2020, 6:22pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/6 "2020-09-23T18:22:22Z")

</div>

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

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

–Chris

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 23, 2020, 9:07pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/7 "2020-09-23T21:07:04Z")

</div>

Indeed the [`hash` method was added on version 1.7.0](https://foss.heptapod.net/python-libs/passlib/-/commit/e0e8567d2072ab70d68626b1c3a2c38df68f295f). So I created [Required passlib \>=1.7.0 (#9631) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue9631).

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [October 23, 2020, 9:07pm UTC](https://discuss.tryton.org/t/error-while-installation-cryptcontext-object-has-no-attribute/3264/8 "2020-10-23T21:07:06Z")

</div>

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