-1
(trapped) error reading bcrypt version
Traceback (most recent call last):
File "C:\\Users\\User\\Desktop\\lazare\\api practice\\venv\\Lib\\site-packages\\passlib\\handlers\\bcrypt.py", line 620, in \_load_backend_mixin  
version = \_bcrypt.__about__.__version__
^^^^^^^^^^^^^^^^^
AttributeError: module 'bcrypt' has no attribute '__about__'

why that happened? i dont use about attribute at all. all i have from that module is this:

pwd_context = CryptContext(schemes = ["bcrypt"], deprecated = "auto")  
hashed_pass = pwd_context.hash(user.password)
user.password = hashed_pass 

i am learning api and now i am trying to build user registration process properly, so i want to hash the password and this happens.

interesting is that even tho the error appears, it still hashes the password and keep all the info in the database.

can any of you help me why that error happens and how to fix it

i just tried to update modules passlib and bcrypt. but i have the latest version

2
  • 1
    Also FYI github.com/pyca/bcrypt/issues/684 Commented Feb 26 at 10:34
  • I would try following this comment on that Github issue: github.com/pyca/bcrypt/issues/684#issuecomment-2407179110 "I'd strongly recommend using bcrypt directly, and removing passlib altogether. It was pretty much a single line change in my FastAPI project (changing pwd_context.verify to bcrypt.checkpw) as passlib as described in the FastAPI documentation acts purely as a wrapper around bcrypt anyway. Better to remove the redundant dependency and not pin your project to out of date libraries!" Commented Feb 26 at 10:57

1 Answer 1

4

This issue is likely caused by bcrypt 4.1.x removing the about attribute, which passlib still tries to access.

Can you check your bcrypt and passlib versions? Run:

python -c "import bcrypt, passlib; print(bcrypt.__version__, passlib.__version__)"

If bcrypt >= 4.1.0, try downgrading:

pip install "bcrypt==4.0.1"

Let me know what versions you have.

Sign up to request clarification or add additional context in comments.

3 Comments

yes actually i had version of 4.2.something and i installed what you recommended and it does not throws error anymore. thank you. pls can you explain how did you know that this was problem. you use these modules often or what?
I use this library frequently as it's essential for all my projects. I had already looked it up online and found an issue about it on bcrypt's github repository.
"bcrypt==4.0.1" solves the problem thank you !!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.