Skip to content
Advertisement

Cannot run bcrpyt or werkzeug in my python 3 environment

I am doing a course in flask and python 3. I have set up a python 3.6 environment with the following libraries in a requirement.txt file:

alembic==0.9.9
blinker==1.4
chardet==3.0.4
click==6.7
Flask==1.0.2
Flask-Dance==0.14.0
Flask-DebugToolbar==0.10.1
Flask-Login==0.4.1
Flask-Migrate==2.1.1
Flask-OAuth==0.12
Flask-OAuthlib==0.9.4
Flask-SQLAlchemy==2.3.2
Flask-WTF==0.14.2
httplib2==0.11.3
idna==2.6
itsdangerous==0.24
Jinja2==2.10
lazy==1.3
Mako==1.0.7
MarkupSafe==1.1.1
oauth2==1.9.0.post1
oauthlib==2.0.7
python-dateutil==2.7.2
python-editor==1.0.3
requests==2.18.4
requests-oauthlib==0.8.0
six==1.11.0
SQLAlchemy==1.2.6
SQLAlchemy-Utils==0.33.2
urllib3==1.22
URLObject==2.4.3
Werkzeug==0.14.1
wincertstore==0.2
WTForms==2.1

And I am trying to run this scripts in the environment:

#pip install flask-bcrypt
from flask_bcrypt import Bcrypt

# Create the Hasher
bcrypt = Bcrypt()

hashed_pass = bcrypt.generate_password_hash('mypassword')
print(hashed_pass)
wrong_check = bcrypt.check_password_hash(hashed_pass, 'wrongpass')
print(wrong_check)
right_check = bcrypt.check_password_hash(hashed_pass, 'mypassword')
print(right_check)

but I get this error:

(myflaskenv2) C:UsersdthomasDocumentspython_projectsPython and Flask Bootcampauthentication>bcrypt-attempt.py
Traceback (most recent call last):
  File "C:UsersdthomasDocumentspython_projectsPython and Flask Bootcampauthenticationbcrypt-attempt.py", line 2, in <module>
    from flask_bcrypt import Bcrypt
ModuleNotFoundError: No module named 'flask_bcrypt'

Likewise when I try a werkzeug script:

# pip install Werkzeug
from werkzeug.security import generate_password_hash,check_password_hash

# Can add options to this like salt and method
# For example: method='pbkdf2:sha256', salt_length=8 (these are defaults)
hashed_pass = generate_password_hash('mypassword')
print(hashed_pass)
wrong_check = check_password_hash(hashed_pass,'wrong')
print(wrong_check)
right_check = check_password_hash(hashed_pass,'mypassword')
print(right_check)

I get this error:

Traceback (most recent call last):
  File "C:UsersdthomasDocumentspython_projectsPython and Flask Bootcampauthenticationwerkzeug-attempt.py", line 2, in <module>
    from werkzeug.security import generate_password_hash,check_password_hash
ModuleNotFoundError: No module named 'werkzeug'

I have tried:

  • recreating a new environment
  • uninstalling, installing different
  • versions of werkzeug in pip2 and pip3, both inside and outside the
    environment
  • tried it on different computers

Does anyone have an idea of the issue?

Advertisement

Answer

Wow, this is embarrassing.

I was typing attempt-werkzeug.py instead of python attempt-werkzeug.py

Sorry for the confusion

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement