Page 1 of 1

Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 10:17 am
by davinci
I am using panasonic_viera. Since I use an M1 Mac I get this error:

Code: Select all
 Script Error                    Panasonic Setup.py: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.so': cannot load library '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so': dlopen(/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so, 2): no suitable image found.  Did find:
   /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so: mach-o, but wrong architecture
   /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/_raw_ecb.so: mach-o, but wrong architecture.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so', Trying '_raw_ecbmodule.so': cannot load library '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecbmodule.so': dlopen(/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecbmodule.so, 2): image not found.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecbmodule.so'
   Script Error                    Exception Traceback (most recent call shown last):

     Panasonic Setup.py, line 6, at top level
     File "/Users/server/Library/Python/2.7/lib/python/site-packages/panasonic_viera/__init__.py", line 13, in <module>
       from Crypto.Cipher import AES
     File "/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/__init__.py", line 27, in <module>
       from Crypto.Cipher._mode_ecb import _create_ecb_cipher
     File "/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/_mode_ecb.py", line 47, in <module>
       """
     File "/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/_raw_api.py", line 297, in load_pycryptodome_raw_lib
       raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.so': cannot load library '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so': dlopen(/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so, 2): no suitable image found.  Did find:
   /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so: mach-o, but wrong architecture
   /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/_raw_ecb.so: mach-o, but wrong architecture.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecb.so', Trying '_raw_ecbmodule.so': cannot load library '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecbmodule.so': dlopen(/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecbmodule.so, 2): image not found.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Util/../Cipher/_raw_ecbmodule.so'


Any ideas? I suspect the python version in Indigo/M1 to be the issue.

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 11:03 am
by FlyingDiver
Edit that to change QUOTE to CODE tags so it's readable...

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 11:10 am
by davinci
Done :D

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 11:11 am
by FlyingDiver
Much better. Did this work on a previous Mac? Have you tried installing the Crypto library?

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 11:21 am
by davinci
Yes it worked before.
Crypto is generated in the python folder by pycryptodome.

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 11:35 am
by FlyingDiver
Yeah, sounds like it hasn't been updated for Apple Silicon.

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 7:40 pm
by matt (support)
Copy/paste the result of this Terminal command into a reply for me:

Code: Select all
lipo -detailed_info /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/_raw_ecb.so

Re: Possible problem with python on M1 Mac

PostPosted: Tue Apr 20, 2021 11:36 pm
by davinci
Code: Select all
input file /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/_raw_ecb.so is not a fat file
Non-fat file: /Users/server/Library/Python/2.7/lib/python/site-packages/Crypto/Cipher/_raw_ecb.so is architecture: arm64

Re: Possible problem with python on M1 Mac

PostPosted: Thu Apr 22, 2021 11:45 am
by davinci
Do you have any idea what it is?

Re: Possible problem with python on M1 Mac

PostPosted: Thu Apr 22, 2021 5:59 pm
by matt (support)
I'm not sure about the specifics of the file, but the problem is that it is compiled for the M1 processor (arm64) but Indigo starts all plugins under the emulation mode (Rosetta) so it fails when that file is loaded. If that file was compiled as a universal binary (arm64 and x86_64) then it would work.

I believe it will also work in an upcoming release of Indigo which will be compiled for the M1 processor. No firm ETA yet, but we are actively working on it.

Re: Possible problem with python on M1 Mac

PostPosted: Fri Apr 23, 2021 1:36 am
by davinci
That's it. I installed pycrpytodome with Terminal in Rosetta-Mode.
It works now. :)

I'm excited for the April(ish)-Release.


Thank you

Re: Possible problem with python on M1 Mac

PostPosted: Sun Jun 20, 2021 4:23 am
by davinci
Well it took us to late June but it is now working without Rosetta.