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

心不动则不痛 提交于 2021-01-02 05:36:35

问题


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

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

回答1:


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




回答2:


I got this error trying to install Scrapy with Python 3.8.1 on Windows 10, but its solved installing the last version of pip (19.3.1 in my case) and all works using pip in this way:

python -m pip install scrapy --user



回答3:


TLDR;

Try using cryptography==3.1.1

Details:

This happened on Python 3.9.0 on Windows 10 PC. I had the following in requirements.txt

cryptography==2.8

I removed the version and kept only cryptography in requirements.txt file like below

cryptography

Saved the requirements.txt and then I ran

pip install -r requirements.txt

It installed successfully. Then I freeze the requirements.txt by running the following command

pip freeze > requirements.txt

Then the requirements.txt got updated with cryptography==3.1.1




回答4:


I have faced same issue and tried to install openssl with mentioned step but still was not able to proceed for windows 10. Later I upgraded pip to latest version and tried again and it worked without any issue.

I would recommend to upgrade pip to latest version and give a try before proceeding for installing openssl



来源:https://stackoverflow.com/questions/59441794/error-could-not-build-wheels-for-cryptography-which-use-pep-517-and-cannot-be-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!