thisbejim / Pyrebase

A simple python wrapper for the Firebase API.
2.05k stars 525 forks source link

Crypto Error on import pyrebase #406

Open robertkstarr opened 2 years ago

robertkstarr commented 2 years ago

I'm getting the following error when running import pyrebase:

>>> import pyrebase
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/pyrebase/__init__.py", line 1, in <module>
    from .pyrebase import initialize_app
  File "/usr/local/lib/python3.9/site-packages/pyrebase/pyrebase.py", line 17, in <module>
    from oauth2client.service_account import ServiceAccountCredentials
  File "/usr/local/lib/python3.9/site-packages/oauth2client/service_account.py", line 25, in <module>
    from oauth2client import client
  File "/usr/local/lib/python3.9/site-packages/oauth2client/client.py", line 47, in <module>
    from oauth2client import crypt
  File "/usr/local/lib/python3.9/site-packages/oauth2client/crypt.py", line 55, in <module>
    from oauth2client import _pycrypto_crypt
  File "/usr/local/lib/python3.9/site-packages/oauth2client/_pycrypto_crypt.py", line 17, in <module>
    from Crypto.PublicKey import RSA
  File "/usr/local/lib/python3.9/site-packages/Crypto/PublicKey/__init__.py", line 29, in <module>
    from Crypto.Util.asn1 import (DerSequence, DerInteger, DerBitString,
  File "/usr/local/lib/python3.9/site-packages/Crypto/Util/asn1.py", line 33, in <module>
    from Crypto.Util.number import long_to_bytes, bytes_to_long
  File "/usr/local/lib/python3.9/site-packages/Crypto/Util/number.py", line 398
    s = pack('>I', n & 0xffffffffL) + s
                                 ^
SyntaxError: invalid syntax

It was working fine just a few days ago.

Thanks for your hard work!

benthecoder commented 2 years ago

Having this issue too, did you find a solution @rstarr-indeed ?

robertkstarr commented 2 years ago

@benthecoder I haven't looked into this since reporting the error, so no I haven't. I'm waiting for a new version that will (fingers crossed) fix it.

shourav9884 commented 2 years ago

I unistalled pycryptodome and installed pycryptodome again and it is now working

pip uninstall pycryptodome
pip install pycryptodome
robertkstarr commented 2 years ago

I unistalled pycryptodome and installed pycryptodome again and it is now working

pip uninstall pycryptodome
pip install pycryptodome

This worked for me! Thanks!

iosifache commented 1 year ago

An alternative solution is to install Pyrebase4.

abdullah-zulfiqar-ent commented 1 year ago

This

I unistalled pycryptodome and installed pycryptodome again and it is now working

pip uninstall pycryptodome
pip install pycryptodome

This worked for me! Thanks!

This worked for me, I updated my project from python 3.7 to 3.11 and after installing pycrypto I faced an error. error: value |= 2L ** (N-1) # Ensure high bit is set I searched for the solution and here I got it so I just installed pycryptodome and it worked for me.

Darrshan-Sankar commented 3 weeks ago

pycryptodome>=3.19.0 works i think. For me, installing pycryptodome==3.19.0 worked