Skip to content
This repository has been archived by the owner. It is now read-only.

pip install places pycrypto in lowercase 'crypto' on windows. #156

Open
Grazfather opened this issue Aug 27, 2015 · 15 comments
Open

pip install places pycrypto in lowercase 'crypto' on windows. #156

Grazfather opened this issue Aug 27, 2015 · 15 comments

Comments

@Grazfather
Copy link

Grazfather commented Aug 27, 2015

Windows XP SP4, Python 2.7

python -m pip install pycrypto succeeds after installing the compiler, but it fails to load:

>>> from Crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Crypto.Cipher
>>> from crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\crypto\Cipher\AES.py", line 49, in <module
>
    from Crypto.Cipher import blockalgo
ImportError: No module named Crypto.Cipher

Notice 'crypto' in site-packages is lowercase? Renaming it to 'Crypto' seems to solve the issue.

@alawal123
Copy link

alawal123 commented Sep 17, 2015

From the look of things the pycrypto module is not installed on your system. Try this

https://luiscberrocal.wordpress.com/2012/07/18/installing-and-using-pycrypto-on-windows-7/

or Alternatively open your windows command prompt and set python path first as follows:

set path=%path%;C:\python27

Then on your pycrypto folder hold shift and right click , it will take you to pycrypto file directory in windows command prompt

Then type this command again:

Python setup.py install
or just setup.py install

@Grazfather
Copy link
Author

Grazfather commented Sep 17, 2015

No, it is installed. I verified it exists in site-packages, and like I said, renaming crypto to Crypto solved the issue.

I actually think the issue is the following:

  1. I ran pip install crypto (Creates 'crypto' in site-packages)
  2. I ran pip install pycrypto (Puts pycrypto in lowercase 'crypto', since the directory already exists)
  3. I tried to import Crypto. This failed because presumably python's __import__ checks directories in a case-sensitive way.

I can verify tonight if this is the case. If so, then I think it's a pip issue.

@jomido
Copy link

jomido commented Dec 18, 2015

This just occurred to me today. Thanks for posting your solution.

@amremam2004
Copy link

amremam2004 commented Sep 29, 2016

under lib/site-packages rename crypto folder to Crypto

@mike-bailey
Copy link

mike-bailey commented Aug 19, 2017

Can confirm, this is a bug.

@thecodingchicken
Copy link

thecodingchicken commented Oct 7, 2017

This is a bug. It is only imported as 'crypto', but it is imported as Crypto in the library's files.

@darouwan
Copy link

darouwan commented Oct 9, 2017

I ever submitted this issue before, but it was closed by someone...

@mike-bailey
Copy link

mike-bailey commented Oct 9, 2017

Sounds like this project is dead

@darouwan
Copy link

darouwan commented Oct 9, 2017

@mike-bailey yep , the latest release was on four years ago

@askerlee
Copy link

askerlee commented Aug 29, 2019

You can use pycryptodome, which is a fork of pycrypto and is actively developed. However the same problem exists with this package. Renaming works 😄

@lemenkov
Copy link

lemenkov commented Sep 19, 2019

Dupe of #285

@Mike-Logit
Copy link

Mike-Logit commented Oct 4, 2019

This has been a real problem for us and very happy to have found this git issue. Any bug fix ETA?

@avrajsri
Copy link

avrajsri commented Oct 6, 2019

pip uninstall crypto
Delete "crypto" Folder [C:\Users\AppData\Local\Programs\Python\Python37\Lib\site-packages]
pip install crypto
pip uninstall pycryptodome
pip install pycryptodome

Rename Folder "crypto" to "Crypto" [C:\Users\AppData\Local\Programs\Python\Python37\Lib\site-packages]

Then You Use "from Crypto.Cipher import AES" in Code

@tina0430
Copy link

tina0430 commented Mar 3, 2020

Thank you, @avrajsri
I solved my issue!

@clintonb
Copy link

clintonb commented Sep 10, 2020

This is an issue on macOS, too, which may also be case-insensitive.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests