#openssl #msbuild #cryptography
#openssl #msbuild #криптография
Вопрос:
Я пытаюсь установить пакет python, который не является общедоступным. Однако проблема здесь не в пакете, а в том, что инструменты ms build не находят libssl.lib
. Вот ошибка, которую я получаю, когда он пытается установить криптографию. Пожалуйста, обратите внимание, что у меня была установлена криптография с использованием pip отдельно, но пакет все еще пытается ее собрать и установить.
ERROR: Command errored out with exit status 1:
command: 'c:usersadminappdatalocalprogramspythonpython38-32python.exe' 'c:usersadminappdatalocalprogramspythonpython38-32libsite-packagespip_vendorpep517_in_process.py' build_wheel 'C:UsersSHREST~1AppDataLocalTemptmpyfoyip74'
cwd: C:UsersadminAppDataLocalTemppip-install-tz7xrs6scryptography_1a90283ee8854dbc8b5878dca15d28c1
Complete output (146 lines):
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win32-3.8
creating buildlib.win32-3.8cryptography
copying srccryptographyexceptions.py -> buildlib.win32-3.8cryptography
copying srccryptographyfernet.py -> buildlib.win32-3.8cryptography
copying srccryptographyutils.py -> buildlib.win32-3.8cryptography
copying srccryptography__about__.py -> buildlib.win32-3.8cryptography
copying srccryptography__init__.py -> buildlib.win32-3.8cryptography
creating buildlib.win32-3.8cryptographyhazmat
copying srccryptographyhazmat_oid.py -> buildlib.win32-3.8cryptographyhazmat
copying srccryptographyhazmat__init__.py -> buildlib.win32-3.8cryptographyhazmat
creating buildlib.win32-3.8cryptographyx509
copying srccryptographyx509base.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509certificate_transparency.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509extensions.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509general_name.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509name.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509ocsp.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509oid.py -> buildlib.win32-3.8cryptographyx509
copying srccryptographyx509__init__.py -> buildlib.win32-3.8cryptographyx509
creating buildlib.win32-3.8cryptographyhazmatbackends
copying srccryptographyhazmatbackendsinterfaces.py -> buildlib.win32-3.8cryptographyhazmatbackends
copying srccryptographyhazmatbackends__init__.py -> buildlib.win32-3.8cryptographyhazmatbackends
creating buildlib.win32-3.8cryptographyhazmatbindings
copying srccryptographyhazmatbindings__init__.py -> buildlib.win32-3.8cryptographyhazmatbindings
creating buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitivescmac.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitivesconstant_time.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitiveshashes.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitiveshmac.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitiveskeywrap.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitivespadding.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitivespoly1305.py -> buildlib.win32-3.8cryptographyhazmatprimitives
copying srccryptographyhazmatprimitives__init__.py -> buildlib.win32-3.8cryptographyhazmatprimitives
creating buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslaead.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslbackend.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslciphers.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslcmac.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopenssldecode_asn1.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopenssldh.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopenssldsa.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslec.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopenssled25519.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopenssled448.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslencode_asn1.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslhashes.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslhmac.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslocsp.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslpoly1305.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslrsa.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslutils.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslx25519.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslx448.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopensslx509.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
copying srccryptographyhazmatbackendsopenssl__init__.py -> buildlib.win32-3.8cryptographyhazmatbackendsopenssl
creating buildlib.win32-3.8cryptographyhazmatbindingsopenssl
copying srccryptographyhazmatbindingsopensslbinding.py -> buildlib.win32-3.8cryptographyhazmatbindingsopenssl
copying srccryptographyhazmatbindingsopenssl_conditional.py -> buildlib.win32-3.8cryptographyhazmatbindingsopenssl
copying srccryptographyhazmatbindingsopenssl__init__.py -> buildlib.win32-3.8cryptographyhazmatbindingsopenssl
creating buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricdh.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricdsa.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricec.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetriced25519.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetriced448.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricpadding.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricrsa.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricutils.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricx25519.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetricx448.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
copying srccryptographyhazmatprimitivesasymmetric__init__.py -> buildlib.win32-3.8cryptographyhazmatprimitivesasymmetric
creating buildlib.win32-3.8cryptographyhazmatprimitivesciphers
copying srccryptographyhazmatprimitivesciphersaead.py -> buildlib.win32-3.8cryptographyhazmatprimitivesciphers
copying srccryptographyhazmatprimitivesciphersalgorithms.py -> buildlib.win32-3.8cryptographyhazmatprimitivesciphers
copying srccryptographyhazmatprimitivesciphersbase.py -> buildlib.win32-3.8cryptographyhazmatprimitivesciphers
copying srccryptographyhazmatprimitivesciphersmodes.py -> buildlib.win32-3.8cryptographyhazmatprimitivesciphers
copying srccryptographyhazmatprimitivesciphers__init__.py -> buildlib.win32-3.8cryptographyhazmatprimitivesciphers
creating buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdfconcatkdf.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdfhkdf.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdfkbkdf.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdfpbkdf2.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdfscrypt.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdfx963kdf.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
copying srccryptographyhazmatprimitiveskdf__init__.py -> buildlib.win32-3.8cryptographyhazmatprimitiveskdf
creating buildlib.win32-3.8cryptographyhazmatprimitivesserialization
copying srccryptographyhazmatprimitivesserializationbase.py -> buildlib.win32-3.8cryptographyhazmatprimitivesserialization
copying srccryptographyhazmatprimitivesserializationpkcs12.py -> buildlib.win32-3.8cryptographyhazmatprimitivesserialization
copying srccryptographyhazmatprimitivesserializationssh.py -> buildlib.win32-3.8cryptographyhazmatprimitivesserialization
copying srccryptographyhazmatprimitivesserialization__init__.py -> buildlib.win32-3.8cryptographyhazmatprimitivesserialization
creating buildlib.win32-3.8cryptographyhazmatprimitivestwofactor
copying srccryptographyhazmatprimitivestwofactorhotp.py -> buildlib.win32-3.8cryptographyhazmatprimitivestwofactor
copying srccryptographyhazmatprimitivestwofactortotp.py -> buildlib.win32-3.8cryptographyhazmatprimitivestwofactor
copying srccryptographyhazmatprimitivestwofactorutils.py -> buildlib.win32-3.8cryptographyhazmatprimitivestwofactor
copying srccryptographyhazmatprimitivestwofactor__init__.py -> buildlib.win32-3.8cryptographyhazmatprimitivestwofactor
running egg_info
writing srccryptography.egg-infoPKG-INFO
writing dependency_links to srccryptography.egg-infodependency_links.txt
writing requirements to srccryptography.egg-inforequires.txt
writing top-level names to srccryptography.egg-infotop_level.txt
reading manifest file 'srccryptography.egg-infoSOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs_build'
warning: no previously-included files found matching 'vectors'
warning: no previously-included files matching '*' found under directory 'vectors'
warning: no previously-included files found matching 'azure-pipelines.yml'
warning: no previously-included files found matching '.azure-pipelines'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.travis'
warning: no previously-included files matching '*' found under directory '.azure-pipelines'
warning: no previously-included files matching '*' found under directory '.travis'
warning: no previously-included files found matching 'release.py'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching 'codecov.yml'
warning: no previously-included files found matching 'dev-requirements.txt'
warning: no previously-included files found matching 'rtd-requirements.txt'
warning: no previously-included files found matching 'tox.ini'
writing manifest file 'srccryptography.egg-infoSOURCES.txt'
running build_ext
generating cffi module 'build\temp.win32-3.8\Release\_padding.c'
creating buildtemp.win32-3.8
creating buildtemp.win32-3.8Release
generating cffi module 'build\temp.win32-3.8\Release\_constant_time.c'
generating cffi module 'build\temp.win32-3.8\Release\_openssl.c'
building '_openssl' extension
creating buildtemp.win32-3.8Releasebuild
creating buildtemp.win32-3.8Releasebuildtemp.win32-3.8
creating buildtemp.win32-3.8Releasebuildtemp.win32-3.8Release
C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.28.29333binHostX86x86cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:usersadminappdatalocalprogramspythonpython38-32include -Ic:usersadminappdatalocalprogramspythonpython38-32include "-IC:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.28.29333include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0um" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0cppwinrt" /Tcbuildtemp.win32-3.8Release_openssl.c /Fobuildtemp.win32-3.8Releasebuildtemp.win32-3.8Release_openssl.obj
_openssl.c
buildtemp.win32-3.8Release_openssl.c(1509): warning C4098: 'Cryptography_HMAC_CTX_free': 'void' function returning a value
buildtemp.win32-3.8Release_openssl.c(12129): warning C4090: 'return': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(12140): warning C4090: '=': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(12155): warning C4090: 'return': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(12166): warning C4090: '=': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(28350): warning C4090: 'return': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(28373): warning C4090: '=': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(40431): warning C4090: 'function': different 'const' qualifiers
buildtemp.win32-3.8Release_openssl.c(40469): warning C4090: 'function': different 'const' qualifiers
C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.28.29333binHostX86x86link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:usersadminappdatalocalprogramspythonpython38-32libs /LIBPATH:c:usersadminappdatalocalprogramspythonpython38-32PCbuildwin32 "/LIBPATH:C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.28.29333libx86" "/LIBPATH:C:Program Files (x86)Windows KitsNETFXSDK4.8libumx86" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.18362.0ucrtx86" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.18362.0umx86" libssl.lib libcrypto.lib advapi32.lib crypt32.lib gdi32.lib user32.lib ws2_32.lib /EXPORT:PyInit__openssl buildtemp.win32-3.8Releasebuildtemp.win32-3.8Release_openssl.obj /OUT:buildlib.win32-3.8cryptographyhazmatbindings_openssl.pyd /IMPLIB:buildtemp.win32-3.8Releasebuildtemp.win32-3.8Release_openssl.lib /NXCOMPAT /DYNAMICBASE
LINK : fatal error LNK1181: cannot open input file 'libssl.lib'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\link.exe' failed with exit status 1181
----------------------------------------
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
Я также включил OpenSSL в переменные среды
Тем не менее, я продолжаю получать указанную выше ошибку. Я также переустановил Visual Studio build tools 2019. Не совсем уверен, что еще я могу попытаться исправить эту ошибку.
Ответ №1:
Похоже libpath
, что используемые MS build tools не имеют OpenSSL
пути к библиотеке, поэтому он не может найти libssl.lib
. Одним из возможных решений было бы скопировать .lib
файлы из openssl
каталога, который вы указали в переменных среды, в библиотеку Python c:usersadminappdatalocalprogramspythonpython38-32libs
. Это должно сработать.
Комментарии:
1. Спасибо. Это интересно. Я сделал то, что вы предложили, и ошибка исчезла, но теперь у меня другая ошибка. _openssl.obj: ошибка LNK2001: неразрешенный внешний символ _X509_REQ_get_version _openssl.obj: ошибка LNK2001: неразрешенный внешний символ _BN_rand_range buildlib.win32-3.8 cryptography hazmat bindings_openssl.pyd: фатальная ошибка LNK1120: 855 неразрешенных внешних ошибок: команда ‘C:\Program Файлы (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\link.exe ‘сбой со статусом выхода 1120
2. Из переменных среды, которые вы показали выше, кажется, что вы установили 64-разрядную версию, но ваши инструменты сборки работают под управлением 32-разрядной версии. Это может быть связано с несоответствием версии. Попробуйте установить 32-разрядную версию OpenSSL с slproweb.com/products/Win32OpenSSL.html . Скопируйте . файлы библиотеки из 32-разрядной папки openssl в папку библиотеки python.
3. Вау!! вот и все. теперь он установлен без каких-либо проблем. Спасибо, @Kuni. Это замечательно, спасибо, что решили это для меня. Я работал над этим со вчерашнего дня.