I'm having some issues trying to use flask-bcrypt. Please read this entirely it is not as simple as installing the flask-bcrypt. So my OS: Win10 IDE: PyCharm version: 2019.3 . Well I got to the point where I was incorporating my sqlite database and adding users directly to it. I needed to install flask-bcrypt to hash passwords and store in the db. I opened up a cmd at C: and typed in pip install flask-bcrypt spit out the following error:
Command "C:\Users\onyxb\PycharmProjects\DIRT\venv\Scripts\python.exe C:\Users\onyxb\PycharmProjects\DIRT\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip install --ignore-in stalled --no-user --prefix C:\Users\onyxb\AppData\Local\Temp\pip-build-env-e6sok_m_\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pyp i.org/simple -- setuptools>=40.8.0 wheel "cffi>=1.1; python_implementation != 'PyPy'"" failed with error code 1 in None
when that didn't work I googled and found people suggested running it using admin privs. so I opened up cmd as administrator and ran the same command in the project directory. it said it worked. I thought it did too, but it only seems to work partially(let me explain). if I open a cmd and run a password hash from the python terminal it works, but from Jet Brains it says the the following:
(venv) C:\Users\onyxb\PycharmProjects\DIRT>python run.py
bcrypt is required to use Flask-Bcrypt
Traceback (most recent call last):
File "run.py", line 1, in <module>
from DIRT import app
File "C:\Users\onyxb\PycharmProjects\DIRT\DIRT\__init__.py", line 3, in <module>
from flask_bcrypt import Bcrypt
File "C:\Users\onyxb\PycharmProjects\DIRT\venv\lib\site-packages\flask_bcrypt-0.7.1-py3.8.egg\flask_bcrypt.py", line 27, in <module>
raise e
File "C:\Users\onyxb\PycharmProjects\DIRT\venv\lib\site-packages\flask_bcrypt-0.7.1-py3.8.egg\flask_bcrypt.py", line 24, in <module>
import bcrypt
ModuleNotFoundError: No module named 'bcrypt'
However when I go to my __init__.py I can tell it is install just by typing fla then the rest(flask-bcrypt) pops up in the intellisense, and so does the Bcrypt after the import statement. I must have installed something incorrectly so I don't understand what is going on I appreciate any help. Also I have tried easy_install flask-bcrypt that also gives me an error to install the following
(venv) C:\Users\onyxb\PycharmProjects\DIRT>easy_install flask-bcrypt
Searching for flask-bcrypt
Best match: flask-bcrypt 0.7.1
Processing flask_bcrypt-0.7.1-py3.8.egg
flask-bcrypt 0.7.1 is already the active version in easy-install.pth
Using c:\users\onyxb\pycharmprojects\dirt\venv\lib\site-packages\flask_bcrypt-0.7.1-py3.8.egg
Processing dependencies for flask-bcrypt
Searching for bcrypt
Reading https://pypi.org/simple/bcrypt/
Downloading https://files.pythonhosted.org/packages/fa/aa/025a3ab62469b5167bc397837c9ffc486c42a97ef12ceaa6699d8f5a5416/bcrypt-3.1.7.tar.gz#sha256=0b0069c752ec14172c5f78208f
1863d7ad6755a6fae6fe76ec2c80d13be41e42
Best match: bcrypt 3.1.7
Processing bcrypt-3.1.7.tar.gz
Writing C:\Users\onyxb\AppData\Local\Temp\easy_install-ggxvm9mc\bcrypt-3.1.7\setup.cfg
Running bcrypt-3.1.7\setup.py -q bdist_egg --dist-dir C:\Users\onyxb\AppData\Local\Temp\easy_install-ggxvm9mc\bcrypt-3.1.7\egg-dist-tmp-1tk8qkf0
_configtest.c
_cffi_backend.c
c:\users\onyxb\appdata\local\programs\python\python38\include\pyconfig.h(206): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Any help would be greatly appreciated. BTW I did install build tools Microsoft Visual Studio C++ 14.0 Jet Brains said it needs it.
You need to install
flask_bcryptyou can do it using following command :-