Skip to content

Having an issue with OpenSSL and Building wheel for cryptography (pyproject.toml) #108

Description

@sweichbr

Not sure why it cannot find the OpenSSL location, as it is in my ENV, unless I am using teh wrong OpenSSL version: LibreSSL 3.3.6

  error: subprocess-exited-with-error
  
  × Building wheel for cryptography (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [186 lines of output]
      Python reports SOABI: cpython-314-darwin
      Computed rustc target triple: x86_64-apple-darwin
      Installation directory: /Users/shimonweichbrod/Library/Caches/puccinialin
      Rustup already downloaded
      Installing rust to /Users/shimonweichbrod/Library/Caches/puccinialin/rustup
      warn: It looks like you have an existing rustup settings file at:
      warn: /Users/shimonweichbrod/Library/Caches/puccinialin/rustup/settings.toml
      warn: Rustup will install the default toolchain as specified in the settings file,
      warn: instead of the one inferred from the default host triple.
      info: profile set to minimal
      info: setting default host triple to x86_64-apple-darwin
      warn: Updating existing toolchain, profile choice will be ignored
      info: syncing channel updates for stable-x86_64-apple-darwin
      info: default toolchain set to stable-x86_64-apple-darwin
      Checking if cargo is installed
      cargo 1.96.0 (30a34c682 2026-05-25)
      Rust not found, installing into a temporary directory
      Running `maturin pep517 build-wheel -i /Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14 --compatibility off`
      🍹 Building a mixed python/rust project
      🐍 Found CPython 3.14 at /Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14
      🔗 Found pyo3 bindings with abi3 support
      📡 Using build options locked from pyproject.toml
      💻 Using `MACOSX_DEPLOYMENT_TARGET=10.12` for x86_64-apple-darwin by default
         Compiling proc-macro2 v1.0.106
         Compiling quote v1.0.45
         Compiling unicode-ident v1.0.24
         Compiling shlex v2.0.1
         Compiling find-msvc-tools v0.1.9
         Compiling cc v1.2.64
         Compiling target-lexicon v0.13.5
         Compiling vcpkg v0.2.15
         Compiling pkg-config v0.3.33
         Compiling libc v0.2.186
         Compiling openssl-sys v0.9.117
         Compiling syn v2.0.117
         Compiling pyo3-build-config v0.29.0
         Compiling pyo3-ffi v0.29.0
      warning: openssl-sys@0.9.117: Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information.
      error: failed to run custom build command for `openssl-sys v0.9.117`
      
      Caused by:
        process didn't exit successfully: `/private/var/folders/7j/256zq40x4bb6bqftr2zm5n_m0000gn/T/pip-install-kh49erir/cryptography_98d157c7209f4dc4ac0dbf7e10894ea9/target/release/build/openssl-sys-9779dd73fcfbd72d/build-script-main` (exit status: 101)
        --- stdout
        cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO", "OPENSSL_NO_EC", "OPENSSL_NO_SSL3_METHOD", "OPENSSL_NO_KRB5", "OPENSSL_NO_TLSEXT", "OPENSSL_NO_SRP", "OPENSSL_NO_SRTP", "OPENSSL_NO_RFC3779", "OPENSSL_NO_SHA", "OPENSSL_NO_NEXTPROTONEG", "OPENSSL_NO_ENGINE", "OPENSSL_NO_BUF_FREELISTS", "OPENSSL_NO_RC2"))
        cargo:rustc-check-cfg=cfg(openssl)
        cargo:rustc-check-cfg=cfg(libressl)
        cargo:rustc-check-cfg=cfg(boringssl)
        cargo:rustc-check-cfg=cfg(awslc)
        cargo:rustc-check-cfg=cfg(awslc_pregenerated)
        cargo:rustc-check-cfg=cfg(libressl250)
        cargo:rustc-check-cfg=cfg(libressl251)
        cargo:rustc-check-cfg=cfg(libressl252)
        cargo:rustc-check-cfg=cfg(libressl261)
        cargo:rustc-check-cfg=cfg(libressl270)
        cargo:rustc-check-cfg=cfg(libressl271)
        cargo:rustc-check-cfg=cfg(libressl273)
        cargo:rustc-check-cfg=cfg(libressl280)
        cargo:rustc-check-cfg=cfg(libressl281)
        cargo:rustc-check-cfg=cfg(libressl291)
        cargo:rustc-check-cfg=cfg(libressl310)
        cargo:rustc-check-cfg=cfg(libressl321)
        cargo:rustc-check-cfg=cfg(libressl332)
        cargo:rustc-check-cfg=cfg(libressl340)
        cargo:rustc-check-cfg=cfg(libressl350)
        cargo:rustc-check-cfg=cfg(libressl360)
        cargo:rustc-check-cfg=cfg(libressl361)
        cargo:rustc-check-cfg=cfg(libressl370)
        cargo:rustc-check-cfg=cfg(libressl380)
        cargo:rustc-check-cfg=cfg(libressl381)
        cargo:rustc-check-cfg=cfg(libressl382)
        cargo:rustc-check-cfg=cfg(libressl390)
        cargo:rustc-check-cfg=cfg(libressl400)
        cargo:rustc-check-cfg=cfg(libressl410)
        cargo:rustc-check-cfg=cfg(libressl420)
        cargo:rustc-check-cfg=cfg(libressl430)
        cargo:rustc-check-cfg=cfg(ossl101)
        cargo:rustc-check-cfg=cfg(ossl102)
        cargo:rustc-check-cfg=cfg(ossl102f)
        cargo:rustc-check-cfg=cfg(ossl102h)
        cargo:rustc-check-cfg=cfg(ossl110)
        cargo:rustc-check-cfg=cfg(ossl110f)
        cargo:rustc-check-cfg=cfg(ossl110g)
        cargo:rustc-check-cfg=cfg(ossl110h)
        cargo:rustc-check-cfg=cfg(ossl111)
        cargo:rustc-check-cfg=cfg(ossl111b)
        cargo:rustc-check-cfg=cfg(ossl111c)
        cargo:rustc-check-cfg=cfg(ossl111d)
        cargo:rustc-check-cfg=cfg(ossl300)
        cargo:rustc-check-cfg=cfg(ossl310)
        cargo:rustc-check-cfg=cfg(ossl320)
        cargo:rustc-check-cfg=cfg(ossl330)
        cargo:rustc-check-cfg=cfg(ossl340)
        cargo:rustc-check-cfg=cfg(ossl400)
        cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_LIB_DIR
        X86_64_APPLE_DARWIN_OPENSSL_LIB_DIR unset
        cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
        OPENSSL_LIB_DIR unset
        cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_INCLUDE_DIR
        X86_64_APPLE_DARWIN_OPENSSL_INCLUDE_DIR unset
        cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
        OPENSSL_INCLUDE_DIR unset
        cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_DIR
        X86_64_APPLE_DARWIN_OPENSSL_DIR unset
        cargo:rerun-if-env-changed=OPENSSL_DIR
        OPENSSL_DIR unset
        cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
        cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG
        cargo:rerun-if-env-changed=PKG_CONFIG
        cargo:rerun-if-env-changed=OPENSSL_STATIC
        cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
        cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
        cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
        cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
        cargo:rerun-if-env-changed=PKG_CONFIG_PATH
        cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
        cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
        cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
        cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
        cargo:rerun-if-env-changed=OPENSSL_STATIC
        cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
        cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
        cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
        cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
        cargo:rerun-if-env-changed=PKG_CONFIG_PATH
        cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
        cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
        cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
        cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
        cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
        cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      
      
        Could not find openssl via pkg-config:
        Could not run `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl`
        The pkg-config command could not be found.
      
        Most likely, you need to install a pkg-config package for your OS.
        Try `brew install pkgconf` if you have Homebrew.
      
        If you've already installed it, ensure the pkg-config command is one of the
        directories in the PATH environment variable.
      
        If you did not expect this build to link to a pre-installed system library,
        then check documentation of the openssl-sys crate for an option to
        build the library from source, or disable features or dependencies
        that require pkg-config.
      
        cargo:warning=Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information.
      
        --- stderr
      
      
        Could not find directory of OpenSSL installation, and this `-sys` crate cannot
        proceed without this knowledge. If OpenSSL is installed and this crate had
        trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
        compilation process.
      
        Make sure you also have the development packages of openssl installed.
        For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
      
        If you're in a situation where you think the directory *should* be found
        automatically, please open a bug at https://github.com/rust-openssl/rust-openssl
        and include information about your system as well as this message.
      
        $HOST = x86_64-apple-darwin
        $TARGET = x86_64-apple-darwin
        openssl-sys = 0.9.117
      
      
      warning: build failed, waiting for other jobs to finish...
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO CARGO_ENCODED_RUSTFLAGS="-C\u{1f}link-arg=-undefined\u{1f}-C\u{1f}link-arg=dynamic_lookup" MACOSX_DEPLOYMENT_TARGET="10.12" PYO3_BUILD_EXTENSION_MODULE="1" PYO3_CONFIG_FILE="/private/var/folders/7j/256zq40x4bb6bqftr2zm5n_m0000gn/T/pip-install-kh49erir/cryptography_98d157c7209f4dc4ac0dbf7e10894ea9/target/maturin/pyo3-config-x86_64-apple-darwin-3.14-abi3.txt" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.14-64bit" PYO3_PYTHON="/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14" PYTHON_SYS_EXECUTABLE="/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14" "cargo" "rustc" "--profile" "release" "--message-format" "json-render-diagnostics" "--locked" "--manifest-path" "/private/var/folders/7j/256zq40x4bb6bqftr2zm5n_m0000gn/T/pip-install-kh49erir/cryptography_98d157c7209f4dc4ac0dbf7e10894ea9/src/rust/Cargo.toml" "--lib" "--" "-C" "link-args=-Wl,-install_name,@rpath/cryptography.hazmat.bindings._rust.abi3.so"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cryptography
  Building wheel for http_ece (pyproject.toml) ... done
  Created wheel for http_ece: filename=http_ece-1.2.1-py2.py3-none-any.whl size=4847 sha256=0559d8c6b28d3a62b5bbd7710e4aaa15cf5092d262db6348b3df226ab31246a5
  Stored in directory: /Users/shimonweichbrod/Library/Caches/pip/wheels/49/c5/61/d8d0a72eeede76a094359cb51f7737eab85aca29a6505778ae
Successfully built undetected-chromedriver pyscrypt http_ece
Failed to build cryptography
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> cryptography

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions