ERROR: Could not build wheels for bcrypt which use PEP 517 and cannot be installed directly
Asked Answered
E

8

25

The interpreter configuration in pycharm became invalid for some reason so I created a new virtual environment for the project that I was working on, and installed the dependencies again. But I am having trouble in installing bcrypt again. Here's the complete error. The project was working fine with the previous interpreter so I doubt that the python version has anything to do with it. I tried installing wheel as well as the error said could not build wheels but that didn't do the job as well.

The complete error:

Collecting flask-bcrypt
      Using cached https://files.pythonhosted.org/packages/1d/c0/6d4c04d007d72b355de24e7a223978d1a95732245f
    9e9becbf45d3024bf8/Flask-Bcrypt-0.7.1.tar.gz
    Requirement already satisfied: Flask in c:\users\User\appdata\local\programs\python\python38-3
    2\lib\site-packages (from flask-bcrypt) (1.1.2)
    Collecting bcrypt (from flask-bcrypt)
      Using cached https://files.pythonhosted.org/packages/d8/ba/21c475ead997ee21502d30f76fd93ad8d5858d19a3
    fad7cd153de698c4dd/bcrypt-3.2.0.tar.gz
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
        Preparing wheel metadata ... done
    Requirement already satisfied: Jinja2>=2.10.1 in c:\users\User\appdata\local\programs\python\p
    ython38-32\lib\site-packages (from Flask->flask-bcrypt) (2.11.2)
    Requirement already satisfied: Werkzeug>=0.15 in c:\users\User\appdata\local\programs\python\p
    ython38-32\lib\site-packages (from Flask->flask-bcrypt) (1.0.1)
    Requirement already satisfied: itsdangerous>=0.24 in c:\users\User\appdata\local\programs\pyth
    on\python38-32\lib\site-packages (from Flask->flask-bcrypt) (1.1.0)
    Requirement already satisfied: click>=5.1 in c:\users\User\appdata\local\programs\python\pytho
    n38-32\lib\site-packages (from Flask->flask-bcrypt) (7.1.2)
    Requirement already satisfied: six>=1.4.1 in c:\users\User\appdata\roaming\python\python38\sit
    e-packages (from bcrypt->flask-bcrypt) (1.15.0)
    Requirement already satisfied: cffi>=1.1 in c:\users\User\appdata\local\programs\python\python
    38-32\lib\site-packages (from bcrypt->flask-bcrypt) (1.14.2)
    Requirement already satisfied: MarkupSafe>=0.23 in c:\users\User\appdata\local\programs\python
    \python38-32\lib\site-packages (from Jinja2>=2.10.1->Flask->flask-bcrypt) (1.1.1)
    Requirement already satisfied: pycparser in c:\users\User\appdata\local\programs\python\python
    38-32\lib\site-packages (from cffi>=1.1->bcrypt->flask-bcrypt) (2.20)
    Building wheels for collected packages: bcrypt
      Building wheel for bcrypt (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
       command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' 'c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.p
    y' build_wheel 'C:\conda_temp\tmpgl0zt2ul'
           cwd: C:\conda_temp\pip-install-9i9ne9yb\bcrypt
      Complete output (15 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-3.8
      creating build\lib.win32-3.8\bcrypt
      copying src\bcrypt\__about__.py -> build\lib.win32-3.8\bcrypt
      copying src\bcrypt\__init__.py -> build\lib.win32-3.8\bcrypt
      copying src\bcrypt\py.typed -> build\lib.win32-3.8\bcrypt
      running build_ext
      generating cffi module 'build\\temp.win32-3.8\\Release\\_bcrypt.c'
      creating build\temp.win32-3.8
      creating build\temp.win32-3.8\Release
      building '_bcrypt' extension
      error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://vi
    sualstudio.microsoft.com/downloads/
      ----------------------------------------
      ERROR: Failed building wheel for bcrypt
      Running setup.py clean for bcrypt
    Failed to build bcrypt
    ERROR: Could not build wheels for bcrypt which use PEP 517 and cannot be installed directly
    WARNING: You are using pip version 19.2.3, however version 20.2.2 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Ediva answered 20/8, 2020 at 16:30 Comment(9)
The error is pretty clear: error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/Thitherto
Does this answer your question? Pip error: Microsoft Visual C++ 14.0 is requiredThitherto
@Thitherto I have Visual Studio as well but I am working on PycharmEdiva
Right, the link installs the build tools for C++, and doesn't require VSThitherto
@Thitherto can you please tell me what exactly do I need to install from that link?Ediva
@Thitherto and my problem is in Pycharm, what good would installing vs tools do?Ediva
To install the build tools, you should be able to download them from hereThitherto
It's not visual studio, it's visual c++, and it needs it to build the wheels for the package you are installingThitherto
@Thitherto ohh okay thanks for your helpEdiva
D
29

try using these commands:

python -m pip install --upgrade pip
python -m pip install --no-use-pep517 bcrypt
Deloisedelong answered 21/9, 2020 at 20:32 Comment(5)
python -m pip install --upgrade pipStephenstephenie
--no-use-pep517 is a brilliant suggestion, bcrypt was installed with no headache using this option.Daff
It didn't fix my problem at first. Then I've installed these libraries using brew and then used your answer and it's fixed. https://mcmap.net/q/539116/-could-not-find-xmlsec1-config-are-libxmlsec1-dev-and-pkg-config-installedEngedi
I am working via Visual studio Code IDE and just this python -m pip install --upgrade pip solved the code for me. later I just reinstalled bcrypt via pip install bcrypt and solved!Vardar
bcrypt was installed with this solution but the rest requirements, like bsdiff4 and numpy, failed although all the Microsoft Visual C++ versions are installed.Bum
S
5

bcrypt is now implemented in Rust. Users building from source will need to have a Rust compiler available although nothing will change for users downloading wheels.

bcrypt developers no longer ship manylinux2010 wheels. Users should upgrade to the latest pip to ensure this doesn’t cause issues downloading wheels on their platform or use an older version than 4.0.0.

So try

pip3 install -U "bcrypt<4.0.0"
Serve answered 7/12, 2022 at 12:27 Comment(2)
Actually installing version 4.0.0. helped in my case :)Fondness
This solution worked with my Python 3.6 and pip 21.2. I was trying to install bcrypt 4.1 from source and it failed. Switching to lower bcrypt 3.6 worked!Flavour
A
3

Fixing bcrypt to 3.2.2 (the latest version before 4.0.0) fixed this for me. Like stated here:

The problem comes with bcrypt 4.0.0 for which there is no wheel available.

Atilt answered 26/10, 2022 at 13:18 Comment(0)
C
2

What I did might work for you also:

$ python -m pip install --upgrade pip
$ python -m pip install --no-use-pep517 bcrypt

and it worked.

Churn answered 25/8, 2021 at 19:41 Comment(0)
M
0

Changing python from 32-version to 64-version may be solution. It helped me.

Musing answered 5/7, 2021 at 17:43 Comment(0)
C
0

I was able to resolve the issue by upgrading my pip version:

python -m pip install --upgrade pip

After that, I successfully installed the flask-bcrypt package:

pip install flask-bcrypt

Cardiograph answered 23/8, 2023 at 12:12 Comment(0)
O
-1

try

pip install pep517

PIP is very unreliable, it needs over 350 different packages under python, and the system as well

Omland answered 19/1, 2021 at 5:56 Comment(0)
I
-1

I downloaded and installed

"microsoft visual c++ build tools" https://go.microsoft.com/fwlink/?LinkId=691126

and restarted the computer and worked for me.

Indicate answered 13/4, 2021 at 4:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.