sai
sai

Reputation: 57

No module named flask_bcrypt

python run.py 
Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from flaskblog import create_app
  File "/home/vguggilam/Downloads/Python/Flask_Blog/12-Error-Pages/flaskblog/__init__.py", line 3, in <module>
    from flask_bcrypt import Bcrypt
ImportError: No module named flask_bcrypt

Upvotes: 1

Views: 20728

Answers (4)

Thesonter
Thesonter

Reputation: 300

Install wheel it is a requiremnt for flask_bcrypt

pip install wheel
pip install flask_bcrypt

Upvotes: 0

Srinidhi Bhat
Srinidhi Bhat

Reputation: 11

One of the best ways of doing it that I found was this. (Works only if you're using a virtual env, if not, create a VE and install all your requirements first. I'm using virtualenv)

1)(in your virtual environment, after you have installed your dependencies)

pip freeze > requirements.txt
  1. delete the virtualenv folder from your directory completely. in my case, I had named my VE, venv, so I deleted that folder. remember to close any terminals with the VE activated. this can lead to cached data that might alter the result.

  2. create and activate VE again.

    pip install virtualenv

(only if you haven't installed it)

virtualenv venv

your VE can be anything, here I've named it venv

venv\Scripts\activate

works for Windows, for Mac, and Linux, please look up docs on activating venv. 4) re-install all your dependencies. PS: make sure the venv is activated.

pip install -r requirements.txt

you should be good to go. this method is basically using force but works great for a lot of faulty import errors or dependency issues.

Upvotes: 1

Tropicalrambler
Tropicalrambler

Reputation: 715

If you are using a virtual environment like virtualenv or pipenv, it is highly suggested to install the package outside of the environment, for all python versions:

pip install flask-bcrypt && pip3 install flask-bcrypt

Then, access your virtual environment, activate it if necessary, and install the package there. In my case I am using pipenv, thus the installation was with:

pipenv install flask-bcrypt

After doing this I no longer had this import trouble.

Upvotes: 2

MTMD
MTMD

Reputation: 1232

You need to install flask_bcrypt as follows:

pip install flask-bcrypt

Upvotes: 9

Related Questions