scubasteve7
scubasteve7

Reputation: 67

ImportError: cannot import name 'RSA' from 'Crypto.PublicKey'

Hi I am trying to connect my python script to the google firebase. I have run into some issues with installing pyrebase. when i install using pip install pyrebase i get this error message:

image 1:

enter image description here

However i have tried several way to fix this, one way was by installing by pip install pyrebase4. The installation would go just fine, but when I would go to write the import statement import pyre base i would get this error:

Image 2:

enter image description here

I have also tried uninstalling pyrebase4 and installing setuptools and gcloud from which i should be able to pip install pyrebase. However it fails to build pycryptodome wheel. it then executes this error:

Image 3:

enter image description here

Could anyone please help me get this installed an running, i need to finish a project here soon, but this bottleneck is really stressing me out

Upvotes: 3

Views: 15116

Answers (3)

efeakaroz13
efeakaroz13

Reputation: 143

The python3 -m pip install pyrebase4 command solved my problem on Mac OS Catalina.

But the problem you are having is related to not having the c/c++ dependencies installed. You will get the same error if you don't get c/c++ from visual studio. The command I wrote won't work without them.

Upvotes: 1

Kumar Student
Kumar Student

Reputation: 249

I faced the same issue with RSA crypto. Then I uninstall my pycrypto package and re install them, which works fine for me. Here are my commands for uninstalling and reinstalling;

  • pip uninstall PyCrypto
  • pip uninstall PyCryptodome
  • pip install PyCryptodome

Try them and see it.

Upvotes: 16

nate.py
nate.py

Reputation: 21

Go into the file which the error is pointing to (pyrebase.py) and change the reference from (from Crypto import RSA) to (from Crypto import rsa).

That might do the trick although for the version I am using I had to go into the Crypto package and fix alot of other incorrect imports. Alot of the imports where referenced in capital letters when they should have been in lowercase.

If you do both of those you should be fine, it worked for me at least.

Upvotes: 0

Related Questions