cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

Import "cryptography.hazmat.bindings._rust" could not be resolved (M1 Mac)

Open pandeyg2106 opened this issue 1 year ago • 9 comments

I am seeing this error on my M1: ~/cryptography/hazmat/_oid.py:7: Evaluation error PanicException: Python API call failed OS: M1 Mac python version: 3.10

paramiko version : 3.4.0 Mode of installation: pip

cryptography version: 42.0.5 Mode of installation: pip

pandeyg2106 avatar May 02 '24 09:05 pandeyg2106

Please provide instructions with sufficient detail for us to reproduce.

alex avatar May 02 '24 10:05 alex

In my project I have dependency with paramiko. In M1 when I import paramiko and build I see this error. Works fine if build on any machine which is not arm based architecture.

pandeyg2106 avatar May 02 '24 12:05 pandeyg2106

Basically it's this line that fails on M1 from cryptography.hazmat.bindings._rust import ( ObjectIdentifier as ObjectIdentifier,

pandeyg2106 avatar May 02 '24 12:05 pandeyg2106

This is not enough information for us to reproduce. Please keep in mind that this package is successfully installed millions of times a day. You need to give us information on what makes your situation unique.

On Thu, May 2, 2024, 8:56 AM Gaurav Pandey @.***> wrote:

Basically it's this line that fails on M1 from cryptography.hazmat.bindings._rust import ( ObjectIdentifier as ObjectIdentifier,

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

alex avatar May 02 '24 13:05 alex

So recently someone added a dependency of paramiko in the project to start a ssh client to run some commands. Before this I never faced any error. It's only after adding this dependency I started seeing this, and that too only in machines running arm64 architecture.

Fails here from cryptography.hazmat.bindings._rust import ( ObjectIdentifier as ObjectIdentifier,

This fails on all the M1 machines, so, I assume there is something with paramiko that is not compatible with M1, and cryptography is not happy.

pandeyg2106 avatar May 02 '24 13:05 pandeyg2106

Again, this package supports arm64 macos and has for years.

You need to provide information on how we can reproduce this.

On Thu, May 2, 2024, 9:32 AM Gaurav Pandey @.***> wrote:

So recently someone added a dependency of paramiko in the project to start a ssh client to run some commands. Before this I never faced any error. It's only after adding this dependency I started seeing this, and that too only in machines running arm64 architecture.

Fails here from cryptography.hazmat.bindings._rust import ( ObjectIdentifier as ObjectIdentifier,

This fails on all the M1 machines, so, I assume there is something with paramiko that is not compatible with M1, and cryptography is not happy.

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

alex avatar May 02 '24 14:05 alex

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

github-actions[bot] avatar May 06 '24 00:05 github-actions[bot]

import paramiko

class foo:
         def __init__(self):
               self.ip = "some_ip"
               self.username = "some_username"
               self.password = "some_password"
               self.ssh_client = paramiko.SSHClient()
               self.ssh_client.connect(self.ip, username=self.username, password=self.password)
        def method(self):
               self.ssh_client.exec_command("some_command")

If I do something like this on a M1 machine, I get the error I stated above. I assume paramiko calls cryptography somewhere in background.

pandeyg2106 avatar May 07 '24 12:05 pandeyg2106

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

github-actions[bot] avatar May 11 '24 00:05 github-actions[bot]

This issue has not received a reporter response and has been auto-closed. If the issue is still relevant please leave a comment and we can reopen it.

github-actions[bot] avatar May 17 '24 00:05 github-actions[bot]