How to install pycrypto in pycharm?

Viewed 1963

I want to use "from Crypto.Cipher import AES" in pycahrm for running the AES encryption and decryption code. But when I want to install pycrypto or pycryptodome, the terminal shows this message:

Command "python setup.py egg_info" failed with error code 1 in C:\Users\....\AppData\Local\Temp\pip-install-6gk6aq_f\pycryptodome

How can I install these packages?

2 Answers

Pycharm -> Preference -> Project -> Python Interpreter -> + pycryptodome. Since pycrypto hasn't maintained for years, install pycryptodome instead.

enter image description here

It looks like there's a problem in the version of pycrypto/pycryptodome that you're installing. The lines prior to the one in your question should contain details about what this is. It could be that this distribution doesn't work on windows, doesn't specify all the dependencies it needs or one of many other problems. If you can post the entire error we should be able to give more advice.

You could try installing an early version to see if that works, the current version of pycryptodome is 3.10.1 so try pip install pycryptodome==3.9.9 which is the previous version in PyPI.

Another thing you can do is install the distribution a different way. Try downloading the .tar.gz archive of the package and pip installing that file e.g. pip install pycryptodome-3.10.1.tar.gz

Both of these solutions may work but it's impossible to say without knowing the precise problem with the install.


On pycrypto github there seem to be a lot of installation problems and the recommendation is) to use pycryptodome instead.

Related