-1

I am facing Syntax error on Mac python 3.8 from pycrypto, surprisingly its passing on the linux system, i know the alternative was proposed to remove pycrypto and install pycryptodome but i didnt get why the above is working on linux and not on mac with the same python version ?

Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.PublicKey.RSA
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/manish/pyvenv/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 585
    except ValueError, IndexError:
                     ^
SyntaxError: invalid syntax

On linux

python
Python 3.8.5 (default, Jul 24 2020, 17:46:42)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.PublicKey.RSA
>>>

Pycrypto version 2.6.1

Manish
  • 31
  • 1
  • 5
  • 1
    Very old version of pycrypto on one vs. the other…? – deceze Jun 14 '22 at 07:12
  • From PyPI: PyCrypto is written and tested using Python version 2.1 through 3.3. Python 1.5.2 is not supported The latest release (2.6.1) dates back to 2013 – DarkKnight Jun 14 '22 at 07:58

1 Answers1

3

Found the issue. Posting it here for other's reference as i had a hard time figuring out this issue. Thanks to one of my colleague for finding out the below link. This is because of setuptools version, refer https://github.com/pycrypto/pycrypto/issues/327 after downgrading the setuptools<58.0.0 it is working fine. Additionally make sure its not picking up the wheel from pip cache so run below steps

pip cache purge
pip uninstall wheel
pip install pycrypto
Manish
  • 31
  • 1
  • 5