ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

Chirag Bhansali picture Chirag Bhansali · Dec 22, 2019 · Viewed 65.3k times · Source

I get an error when pip builds wheels for the cryptography package.

Error:

Error

LINK : fatal error LNK1181: cannot open input file 'libssl.lib'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\link.exe' failed with exit status 1181
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
  Running setup.py clean for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

I have already installed OpenSSL and set the environment variables as suggested in this post yet the problem persists. My setup details:

  • System - Windows 10
  • Python - 3.8
  • Pip - 19.3.1

Answer

Abhi picture Abhi · Feb 15, 2020

Setting cryptography to version 2.8 in requirements.txt fixed the issue.