Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python cannot install cryptography: Command errored out with exit status 1

I am trying to install cryptography, using Windows 10 OS, however it keeps erroring, unable to build the wheel for cffi.

Collecting cryptography
  Using cached cryptography-35.0.0-cp36-abi3-win_amd64.whl (2.1 MB)
Collecting cffi>=1.12
  Using cached cffi-1.14.6.tar.gz (475 kB)
Requirement already satisfied: pycparser in c:\users\alexf\appdata\local\programs\python\python310\lib\site-package
s (from cffi>=1.12->cryptography) (2.20)
Building wheels for collected packages: cffi
  Building wheel for cffi (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\alexf\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptoo
ls, tokenize; sys.argv[0] = '"'"'C:\\Users\\alexf\\AppData\\Local\\Temp\\pip-install-x7mxn55y\\cffi_7273550c7112440
399311ad24099a7b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\alexf\\AppData\\Local\\Temp\\pip-install-x7mxn55y\\cffi_
7273550c7112440399311ad24099a7b4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.ex
ists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'
"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\alexf\AppData
\Local\Temp\pip-wheel-q8b5b_9v'
       cwd: C:\Users\alexf\AppData\Local\Temp\pip-install-x7mxn55y\cffi_7273550c7112440399311ad24099a7b4\
  Complete output (37 lines):
  _configtest.c
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\cffi
  copying cffi\api.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\backend_ctypes.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\cffi_opcode.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\commontypes.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\cparser.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\error.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\ffiplatform.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\lock.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\model.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\pkgconfig.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\recompiler.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\setuptools_ext.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\vengine_cpy.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\vengine_gen.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\verifier.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\__init__.py -> build\lib.win-amd64-3.10\cffi
  copying cffi\_cffi_include.h -> build\lib.win-amd64-3.10\cffi
  copying cffi\parse_c_type.h -> build\lib.win-amd64-3.10\cffi
  copying cffi\_embedding.h -> build\lib.win-amd64-3.10\cffi
  copying cffi\_cffi_errors.h -> build\lib.win-amd64-3.10\cffi
  running build_ext
  building '_cffi_backend' extension
  creating build\temp.win-amd64-3.10
  creating build\temp.win-amd64-3.10\Release
  creating build\temp.win-amd64-3.10\Release\c
  creating build\temp.win-amd64-3.10\Release\c\libffi_msvc
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c
 /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic/libffi_msvc -IC:\Users\alexf\AppData\Local\Programs\Python\Python310\include
-IC:\Users\alexf\AppData\Local\Programs\Python\Python310\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2
019\Community\VC\Tools\MSVC\14.26.28801\include /Tcc/_cffi_backend.c /Fobuild\temp.win-amd64-3.10\Release\c/_cffi_b
ackend.obj
  _cffi_backend.c
  C:\Users\alexf\AppData\Local\Programs\Python\Python310\include\pyconfig.h(59): fatal error C1083: Cannot open inc
lude file: 'io.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\
bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for cffi
  Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: cffi, cryptography
    Running setup.py install for cffi ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\alexf\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setupt
ools, tokenize; sys.argv[0] = '"'"'C:\\Users\\alexf\\AppData\\Local\\Temp\\pip-install-x7mxn55y\\cffi_7273550c71124
40399311ad24099a7b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\alexf\\AppData\\Local\\Temp\\pip-install-x7mxn55y\\cff
i_7273550c7112440399311ad24099a7b4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.
exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\
n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\alexf\App
Data\Local\Temp\pip-record-ye_cwvjn\install-record.txt' --single-version-externally-managed --compile --install-hea
ders 'C:\Users\alexf\AppData\Local\Programs\Python\Python310\Include\cffi'
         cwd: C:\Users\alexf\AppData\Local\Temp\pip-install-x7mxn55y\cffi_7273550c7112440399311ad24099a7b4\
    Complete output (37 lines):
    _configtest.c
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.10
    creating build\lib.win-amd64-3.10\cffi
    copying cffi\api.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\backend_ctypes.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\cffi_opcode.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\commontypes.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\cparser.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\error.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\ffiplatform.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\lock.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\model.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\pkgconfig.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\recompiler.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\setuptools_ext.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\vengine_cpy.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\vengine_gen.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\verifier.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\__init__.py -> build\lib.win-amd64-3.10\cffi
    copying cffi\_cffi_include.h -> build\lib.win-amd64-3.10\cffi
    copying cffi\parse_c_type.h -> build\lib.win-amd64-3.10\cffi
    copying cffi\_embedding.h -> build\lib.win-amd64-3.10\cffi
    copying cffi\_cffi_errors.h -> build\lib.win-amd64-3.10\cffi
    running build_ext
    building '_cffi_backend' extension
    creating build\temp.win-amd64-3.10
    creating build\temp.win-amd64-3.10\Release
    creating build\temp.win-amd64-3.10\Release\c
    creating build\temp.win-amd64-3.10\Release\c\libffi_msvc
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic/libffi_msvc -IC:\Users\alexf\AppData\Local\Programs\Python\Python310\includ
e -IC:\Users\alexf\AppData\Local\Programs\Python\Python310\Include -IC:\Program Files (x86)\Microsoft Visual Studio
\2019\Community\VC\Tools\MSVC\14.26.28801\include /Tcc/_cffi_backend.c /Fobuild\temp.win-amd64-3.10\Release\c/_cffi
_backend.obj
    _cffi_backend.c
    C:\Users\alexf\AppData\Local\Programs\Python\Python310\include\pyconfig.h(59): fatal error C1083: Cannot open i
nclude file: 'io.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801
\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\alexf\AppData\Local\Programs\Python\Python310\python.exe'
-u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\alexf\\AppData\\Local\\Temp\\pip-ins
tall-x7mxn55y\\cffi_7273550c7112440399311ad24099a7b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\alexf\\AppData\\Local
\\Temp\\pip-install-x7mxn55y\\cffi_7273550c7112440399311ad24099a7b4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'
"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"')
;code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' ins
tall --record 'C:\Users\alexf\AppData\Local\Temp\pip-record-ye_cwvjn\install-record.txt' --single-version-externall
y-managed --compile --install-headers 'C:\Users\alexf\AppData\Local\Programs\Python\Python310\Include\cffi' Check t
he logs for full command output.

I have OpenSSL version 1.1.1d, pip version 21.2.4, and am using Python 3.10, and the same error happens if I try to install cffi on it's own. I have no idea why this isn't working. If you need any more information I'll be happy to provide it.

like image 542
Alexander Fall Avatar asked Mar 24 '26 07:03

Alexander Fall


1 Answers

Gonna answer this myself, because it's me being dumb.

cryptography, or possibly one of it's dependency libraries such as cffi, does not work with python 3.10 yet. Needed to go back to 3.9 for this to work.

like image 183
Alexander Fall Avatar answered Mar 25 '26 19:03

Alexander Fall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!