ImportError: No module named bcrypt
Question:
I am trying to have my Python application encrypt passwords before storing them in an SQLite3 table.I have installed bcrypt on my Flask VirtualEnvironment. However, whenever i run my script i get the error:
File "./run.py", line 2, in <module>
from app import app
File "/home/test/app/__init__.py", line 12, in <module>
from app import views
File "/home/test/app/views.py", line 8, in <module>
from flask_bcrypt import Bcrypt
File "/home/test/flask/local/lib/python2.7/site-packages/flask_bcrypt.py", line 27, in <module>
raise e
ImportError: No module named bcrypt
line 8 on views.py looks like this:
from flask_bcrypt import Bcrypt
What can i be possibly be doing wrong?
Answers:
make sure you’re installing bcrypt under your venv. first source your venv setup file and check by which pip
if pip points to the right location, then do pip install bcrypt (not sure what the library is exactly called – could be py-bcypt as said above).
pip install py-bcrypt --user
there is a typo in comment above.
You need to install bcrypt
.
- You can use :
pip install bcrypt
- Or you can use
flask_bcrypt
:
pip install flask-bcrypt
or pip install flask_bcrypt
Then all you need is to import either one of them.
NONE of them worked in my case…
I am using mac, bcrypt works perfect on my server but not in my mac!
I am trying to have my Python application encrypt passwords before storing them in an SQLite3 table.I have installed bcrypt on my Flask VirtualEnvironment. However, whenever i run my script i get the error:
File "./run.py", line 2, in <module>
from app import app
File "/home/test/app/__init__.py", line 12, in <module>
from app import views
File "/home/test/app/views.py", line 8, in <module>
from flask_bcrypt import Bcrypt
File "/home/test/flask/local/lib/python2.7/site-packages/flask_bcrypt.py", line 27, in <module>
raise e
ImportError: No module named bcrypt
line 8 on views.py looks like this:
from flask_bcrypt import Bcrypt
What can i be possibly be doing wrong?
make sure you’re installing bcrypt under your venv. first source your venv setup file and check by which pip
if pip points to the right location, then do pip install bcrypt (not sure what the library is exactly called – could be py-bcypt as said above).
pip install py-bcrypt --user
there is a typo in comment above.
You need to install bcrypt
.
- You can use :
pip install bcrypt
- Or you can use
flask_bcrypt
:
pip install flask-bcrypt
or pip install flask_bcrypt
Then all you need is to import either one of them.
NONE of them worked in my case…
I am using mac, bcrypt works perfect on my server but not in my mac!