Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

Grazfather opened this issue Aug 27, 2015 · 14 comments

Comments

@Grazfather
Copy link

@Grazfather 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

This comment has been minimized.

Copy link

@alawal123 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

This comment has been minimized.

Copy link
Author

@Grazfather 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

This comment has been minimized.

Copy link

@jomido jomido commented Dec 18, 2015

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

@amremam2004

This comment has been minimized.

Copy link

@amremam2004 amremam2004 commented Sep 29, 2016

under lib/site-packages rename crypto folder to Crypto

@mike-bailey

This comment has been minimized.

Copy link

@mike-bailey mike-bailey commented Aug 19, 2017

Can confirm, this is a bug.

@thecodingchicken

This comment has been minimized.

Copy link

@thecodingchicken 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

This comment has been minimized.

Copy link

@darouwan darouwan commented Oct 9, 2017

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

@mike-bailey

This comment has been minimized.

Copy link

@mike-bailey mike-bailey commented Oct 9, 2017

Sounds like this project is dead

@darouwan

This comment has been minimized.

Copy link

@darouwan darouwan commented Oct 9, 2017

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

@askerlee

This comment has been minimized.

Copy link

@askerlee 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

This comment has been minimized.

Copy link

@lemenkov lemenkov commented Sep 19, 2019

Dupe of #285

@Mike-Logit

This comment has been minimized.

Copy link

@Mike-Logit 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

This comment has been minimized.

Copy link

@avrajsri 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

This comment has been minimized.

Copy link

@tina0430 tina0430 commented Mar 3, 2020

Thank you, @avrajsri
I solved my issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.