Can't import scrypt from hashlib

611 Views Asked by At

I have been trying run flask db upgrade but I keep getting this error in one of the files. The import for scrypt in hashlib file does exist so I do not know why this error keeps coming up.

Usage: flask db upgrade [OPTIONS] [REVISION]
Try 'flask db upgrade --help' for help.

Error: While importing 'manage', an ImportError was raised:

Traceback (most recent call last):
  File "/Users/urmm/.local/share/virtualenvs/Backend-rCOuW7xE/lib/python3.8/site-packages/flask/cli.py", line 256, in locate_app
    __import__(module_name)
  File "/Users/urmm/Documents/Something/Backend/manage.py", line 17, in <module>
    app = create_app(os.environ.get('FLASK_ENV') or 'default')  # pylint: disable=invalid-name
  File "/Users/urmm/Documents/Something/Backend/app/__init__.py", line 28, in create_app
    from app.api.v1 import api as api_v1_blueprint
  File "/Users/urmm/Documents/Something/Backend/app/api/v1/__init__.py", line 8, in <module>
    from . import (customers, focus_group, common, auth, tenders_match, buyers, news, bonding, notifications,
  File "/Users/urmm/Documents/Something/Backend/app/api/v1/customers.py", line 17, in <module>
    from app.models import Customer, EmailVerification
  File "/Users/urmm/Documents/Something/Backend/app/models/__init__.py", line 10, in <module>
    from .user_accounts import SomethingUser
  File "/Users/urmm/Documents/Something/Backend/app/models/user_accounts.py", line 6, in <module>
    from modules.crypto import (SALT_LENGTH, SCRYPT_KEY_LENGTH,
  File "/Users/urmm/Documents/Something/Backend/modules/crypto.py", line 3, in <module>
    from hashlib import scrypt
ImportError: cannot import name 'scrypt' from 'hashlib' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/hashlib.py)

I am using python 3.8 and LibreSSL version 2.8.3 (I think this is the latest version).

0

There are 0 best solutions below