[pycrypto] pycryptodome

Dave Pawson dave.pawson at gmail.com
Fri Dec 9 10:34:27 UTC 2016

This is getting messy!
Comments inline

On 8 December 2016 at 20:29, Martin Falatic <martin at falatic.com> wrote:
> This is beyond the scope of pycrypto for the moment - you have system
> problems because you've upgraded pip yourself.
> This looks familiar because I did the same exact thing myself in the
> process of testing this (and it didn't go smoothly - same problem you're
> having - so I rolled that back to get pip2 and pip3 working properly).
> Let's get you back on track.
> # At this point let's get back to the system default pips and go from
> there. IF you upgraded the system pip to 9.0.1 as it appears, here's how
> to fix them:
> sudo dnf reinstall python-pip python3-pip


> # Now, with that done, run these:
> sudo pip3.5 uninstall pycrypto

# pip3.5 uninstall pycrypto
DEPRECATION: Uninstalling a distutils installed project (pycrypto) has
been deprecated and will be removed in a future version. This is due
to the fact that uninstalling a distutils project will only partially
uninstall the project.
Uninstalling pycrypto-2.6.1:
Proceed (y/n)?

"distutils installed project" - will only partially uninstall the project?
Unclear just what that means.
Accept y and get a pip warning!

Proceed (y/n)? y
  Successfully uninstalled pycrypto-2.6.1
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Ignored the message

> sudo pip2.7 uninstall pycrypto

Ah! A difference.
#pip2.7 uninstall pycrypto
Cannot uninstall requirement pycrypto, not installed
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

It would seem that pycrypto (installed using python setup.py install) is
"associated" with python 2.7 (guess)

Either way it is uninstalled.


> # Once that's done, list them as per my earlier email:
> pip3.5 list | grep pycrypt
> pip2.7 list | grep pycrypt

Nothing from pip3.5


# pip2.7 list | grep pycrypt
pycryptodomex (3.4.3)

so that is there.

> Shouldn't see `pycrypto` there now. If you do... you installed it some
> other way (perhaps as a dnf package?) Uninstall it via the same mechanism
> you installed it and try again.

Which I did yesterday, using the suggestion from a link

> Now go through the steps in my previous email to install pycryptodome and
> pycryptodomex for the purpose of this test, and report the results.

Both? IFAICT the suggestion is one or the other, both not needed?

Aside, I am not 'out of date' with pip
# pip3.5 -V
pip 8.1.2 from /usr/lib/python3.5/site-packages (python 3.5)

# pip2.7 -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

OK, to repeat the tests from the pycryptodome pages.

# python3 -m Cryptodome.SelfTest
/usr/bin/python3: Error while finding spec for 'Cryptodome.SelfTest'
(ImportError: No module named 'Cryptodome')


# python -m Cryptodome.SelfTest
and off it goes!
Ran 22656 tests in 48.420s

Implication that Cryptodome is in the 2.7 library?

More testing.

import Crypto.Cipher.AES

    if "Crypto" in mods:
        print("Found Crypto")
        print("\nCrypto.Cipher.AES: ",dir(Crypto.Cipher.AES))


<module 'Crypto' from '/usr/lib64/python3.5/site-packages/Crypto/__init__.py'>
['Cipher', 'Util', '__all__', '__builtins__', '__cached__', '__doc__',
'__file__', '__loader__', '__name__', '__package__', '__path__',
'__revision__', '__spec__', '__version__', 'version_info']
['AES', '_AES', '__all__', '__builtins__', '__cached__', '__doc__',
'__file__', '__loader__', '__name__', '__package__', '__path__',
'__revision__', '__spec__', 'blockalgo']

Crypto.Cipher.AES:  ['AESCipher', 'MODE_CBC', 'MODE_CFB', 'MODE_CTR',
'__builtins__', '__cached__', '__doc__', '__file__', '__loader__',
'__name__', '__package__', '__revision__', '__spec__', 'block_size',
'blockalgo', 'key_size', 'new']

So how to tell whether I have crypto (??) or pycryptodome[x] ?

Signed, confused.com <grin/>

Dave Pawson
Docbook FAQ.

More information about the pycrypto mailing list