[pycrypto] pycryptodome

Martin Falatic martin at falatic.com
Fri Dec 9 10:57:48 UTC 2016


You had pip 9.0.1 installed previously -  from your earlier email:
> # pip -V
> pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)

This suggests at some point you ran the "pip install --upgrade pip" bit
you see appearing when you install things with pip at this point. Clearly
that's problematic so don't do that (problematic because the version dnf
installs is older and doesn't break things by virtue of how it gets
installed via that mechanism).

Whether pycrypto is truly uninstalled can obviously be hard to tell....
but there are lots of ways to work it out (even if it means re-installing
it via setup.py and then using the info from that install to remove it
thoroughly). See this link for more info on the general problem of
uninstalling such things:

http://stackoverflow.com/questions/1550226/python-setup-py-uninstall

And yet, the module's dictionary you listed tells us that there's version
info to be had so that will probably suffice:

  import Crypto
  print(Crypto.version_info)

I see (3,4,3)... how about you? Try this for both python 2.7 and 3.5.

The fact that the tests all worked is the second indication of health.
Between the two, you can tell whether the install is sane and correct.

Finally, I suggested you pip install both pycryptodome and pycryptodomex
to prove that a) both are working properly using the tests as described,
and b) that they can co-exist. As long as you don't have pycrypto
installed, pycryptodome will do. Otherwise, you use pycryptodomex instead.
Uninstall whichever you don't need - pycryptodome and pycryptodomex don't
share the same namespace.

 - Marty


On Fri, December 9, 2016 02:34, Dave Pawson wrote:
> 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
>
> OK
>
>
>
>>
>> # Now, with that done, run these:
>> sudo pip3.5 uninstall pycrypto
>
> produces # 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:
> /usr/lib64/python3.5/site-packages/pycrypto-2.6.1-py3.5.egg-info
> 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.
>
>
> https://ofswiki.org/wiki/Uninstalling_setup.py_install
>
>
>>
>> # 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
>
>
> however
>
> # 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
> https://ofswiki.org/wiki/Uninstalling_setup.py_install
>
>
>>
>> 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')
>
>
> Yet...
>
>
> # 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
>
> mods=sys.modules if "Crypto" in mods: print("Found Crypto")
> print(mods["Crypto"]) print(dir(Crypto)) print(dir(Crypto.Cipher))
> print("\nCrypto.Cipher.AES: ",dir(Crypto.Cipher.AES))
>
>
> shows
>
> <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',
> 'MODE_ECB', 'MODE_OFB', 'MODE_OPENPGP', 'MODE_PGP', '_AES',
> '__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
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
> _______________________________________________
> pycrypto mailing list pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>
>




More information about the pycrypto mailing list