Failing to install python cryptography library using pip on msys2/mingw

Viewed 193
    Collecting cryptography
  Downloading cryptography-37.0.2.tar.gz (585 kB)
     -------------------------------------- 585.4/585.4 kB 7.4 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  pip subprocess to install build dependencies did not run successfully.
  exit code: 1

  [41 lines of output]
  Collecting setuptools!=60.9.0,>=40.6.0
    Using cached setuptools-62.3.1-py3-none-any.whl (1.2 MB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Collecting cffi>=1.12
    Using cached cffi-1.15.0.tar.gz (484 kB)
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'error'
    error: subprocess-exited-with-error

    python setup.py egg_info did not run successfully.
    exit code: 1

    [16 lines of output]
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "C:/Users/####/AppData/Local/Temp/pip-install-myhhpkap/cffi_c72832fd79d3476b80c36655663d2237/setup.py", line 126, in <module>
        if sys.platform == "win32" and uses_msvc():
      File "C:/Users/####/AppData/Local/Temp/pip-install-myhhpkap/cffi_c72832fd79d3476b80c36655663d2237/setup.py", line 105, in uses_msvc
        return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/command/config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/command/config.py", line 132, in _compile
        self.compiler.compile([src], include_dirs=include_dirs)
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py", line 327, in compile
        self.initialize()
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py", line 218, in initialize
        raise DistutilsPlatformError("--plat-name must be one of {}"
    distutils.errors.DistutilsPlatformError: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: metadata-generation-failed

  Encountered error while generating package metadata.

  See above for output.

  note: This is an issue with the package mentioned above, not pip.
  hint: See above for details.
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

pip subprocess to install build dependencies did not run successfully.
exit code: 1

See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Pip and setuptools are both completely up to date, I have rust installed, and linked to the x86_64-pc-windows-gnu toolchain, and I have the C++ tools from VS. I have even tried completely reinstalling msys2 and it still gives me the same error every single time. I have gotten this installed this way before so I know it is possible, but it was on a different machine and I didn't run into this issue. I am really at a loss as to how to get this installed so any help would be greatly appreciated.

Edit: So after a bit more hunting and searching. I realized that there is a msys2 package for the cryptography library that you need to use instead of trying to use pip. As far as I can tell there is some sort of compilation error that results from running it in the msys2 environment instead of a windows terminal that is causing it. Here is the package I used https://packages.msys2.org/package/mingw-w64-x86_64-python3-cryptography

0 Answers
Related