I have recently upgraded from a 2017 MBP to a 2021 MBP with the M1 Pro chip.
Since then i've had issue running a Python 2.7 script.
I am using paramiko:
#!/usr/bin/env python
...
import paramiko
...
...and when I run the script I get the following error:
Traceback (most recent call last):
File "/Users/crmpicco/deploy.py", line 14, in <module>
import paramiko
File "/Library/Python/2.7/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 90, in <module>
from paramiko.ed25519key import Ed25519Key
File "/Library/Python/2.7/site-packages/paramiko/ed25519key.py", line 17, in <module>
import bcrypt
File "/Library/Python/2.7/site-packages/bcrypt/__init__.py", line 25, in <module>
from bcrypt import _bcrypt
ImportError: dlopen(/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so, 0x0002): tried: '/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/_bcrypt.so' (no such file)
The file definitely exists, as the error says, but i'm unsure how to proceed.
locate bcrypt.so
/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so
CodePudding user response:
The only solution I could find for this was an uninstall and re-install of a bunch of Python packages, name bcrypt, cffi, PyNaCl and cryptography.
sudo python2.7 -m pip uninstall bcrypt
python2.7 -m pip install bcrypt --user
sudo python2.7 -m pip uninstall cffi
python2.7 -m pip install cffi --user
sudo python2.7 -m pip uninstall PyNaCl
python2.7 -m pip install PyNaCl==1.4.0 --user
sudo -H python2.7 -m pip uninstall cryptography
python2.7 -m pip install cryptography --user