user3522242 user3522242 - 11 months ago 112
Python Question

How to pip install bcrypt on Azure webapp?

Disclosure : First time Azure experience

I am deploying a Flask app to Azure Webapp. All deployment steps are fine till I hit the bcrypt package installation and it fails.

After much research based on error log output, I found out that I might need to install bcrypt using wheelhouse (*.WHL)

I downloaded the below files from here

  • bcrypt-3.1.0-cp27-cp27m-win32.whl

  • bcrypt-3.1.0-cp27-cp27m-win_amd64.whl

and I copied them to

Then, I activated the virtualenv through KUDU and I run this command:

d:\home\site\wwwroot\env\scripts\pip install -r requirements.txt --find-links d:\home\site\repository\wheelhouse

I get no messages or any log output. When I run a
pip freeze > tmp.txt
I get a blank file.

But when I run
d:\python27\scripts\pip install -r requirements.txt --find-links d:\home\site\repository\wheelhouse

It starts installing the packages until it gets to bcrypt and it errs out with this message:

Skipping bcrypt-3.1.0-cp27-cp27m-win32.whl because it is not compatible with
this Python

Which is a confusing message because the wheel is for Python 2.7

Since my Flask app works fine on both my Linux and Windows dev machines, I went ahead and created my own brypt wheel file in my Windows computer which runs the same Python version on Azure. I uploaded the new
, redid the steps above and I still get the same error message

Extra notes:

  • python -V on Azure console returns 2.7.8

  • python -V while virtualenv is activated also returns 2.7.8

  • Azure portal > Application Settings shows "Python version 2.7" and "Platform 32bits".

  • After deployment, all packages in requirements.txt are installed except bcrypt.

  • Visiting the web page gives a 500 error (which i expect due to missing lib)

  • I removed the virtualenv and GIT pushed the repo with
    --find-links wheelhouse
    at the top of requirements.txt as stated here.

    However, I get a
    Unable to find vcvarsall.bat
    error. That's why I m trying to manually install via wheel

  • I deleted the whole virtualenv, uploaded wheel files for all required packages to \repository\wheelhouse and added
    to my pip install command. Everything gets installed except bcrypt.

  • I tried
    and just
    without specifying the version and it doesnt make any difference.

I ran out of ideas. Anyone knows what's wrong? How do I go about installing bcrypt on Azure webapp?

Answer Source

I was finally able to get the Flask app working on Azure Webapps. Unfortunately, I couldn't do it using my usual dev tools.


  • I created a VirtualEnv in Visual Studio using my requirements.txt file
  • Moved my Flask code to Visual Studio
  • Click on Publish to Azure Webapps

It does what it does and once completed, you may still get a 500 error. If that is the case, use KUDU and take a look at your web.config file and modify the WSGI_ALT_VIRTUALENV_HANDLER value to match your Flask app name.

This is the only way I was able to get bcrypt to install correctly for my Flask app to work. I hope this saves someone valuable time.

That's all folks.