cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

error: can't find Rust compiler in FreeBSD

Open ehthxC7x9D opened this issue 3 years ago • 3 comments

Versions: setuptools in ./env/lib/python3.9/site-packages (58.1.0) cffi in ./env/lib/python3.9/site-packages (1.15.1) pycparser in ./env/lib/python3.9/site-packages (from cffi) (2.21) pip in ./env/lib/python3.9/site-packages/pip (23.0.1)

System: FreeBSD 13.1-RELEASE OpenSSL 1.1.1o-freebsd 3 May 2022 libffi-3.4.4 rustc 1.68.0 (2c8cc3432 2023-03-06) (in PATH)

Installation: pip install cryptography

Issue: When installing and getting to running build_rust it is unable to find my rustc path despite it being accessible in PATH. Is there another way to specify it? Or is this issue from something else? Thank you.

CLI output:

      =============================DEBUG ASSISTANCE=============================
      If you are seeing a compilation error please try the following steps to
      successfully install cryptography:
      1) Upgrade to the latest pip and try again. This will fix errors for most
         users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation/ for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq/
      4) Ensure you have a recent Rust toolchain installed:
         https://cryptography.io/en/latest/installation/#rust
  
      Python: 3.9.16
      platform: FreeBSD-13.1-RELEASE-amd64-64bit-ELF
      pip: n/a
      setuptools: 67.6.0
      setuptools_rust: 1.5.2
      rustc: n/a
      =============================DEBUG ASSISTANCE=============================

ehthxC7x9D avatar Mar 15 '23 05:03 ehthxC7x9D

The code is truly doing nothing more than:

    if shutil.which("rustc") is not None:
        try:
            # If for any reason `rustc --version` fails, silently ignore it
            rustc_output = subprocess.run(
                ["rustc", "--version"],
                capture_output=True,
                timeout=0.5,
                encoding="utf8",
                check=True,
            ).stdout
            version = re.sub("^rustc ", "", rustc_output.strip())
        except subprocess.SubprocessError:
            pass

to find the rustc binary for that debugging message.

So either rustc is not on your path, or invoking it errors out.

To actually build the extension you need cargo to be on your path as well.

alex avatar Mar 15 '23 10:03 alex

Cargo and Rust are installed correctly and work as expected independent of Python. Playing with this it looks like shutil might not be identifying the path properly. I will investigate this on the FreeBSD side as I believe that is where the issue is and update when I figure it out. Thanks.

ehthxC7x9D avatar Mar 15 '23 16:03 ehthxC7x9D

Sounds good

On Wed, Mar 15, 2023, 12:23 PM jarebear6expepjozn6rakjq5iczi3irqwphcvbswgkahd6b6twnxxid < @.***> wrote:

Cargo and Rust are installed correctly and work as expected independent of Python. Playing with this it looks like shutil might not be identifying the path properly. I will investigate this on the FreeBSD side as I believe that is where the issue is and update when I figure it out. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/pyca/cryptography/issues/8519#issuecomment-1470348657, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBDGPSHDIQLFA5QFM33W4HUHXANCNFSM6AAAAAAV3KTWDI . You are receiving this because you commented.Message ID: @.***>

alex avatar Mar 15 '23 16:03 alex