[pycrypto] pycryptodome

Martin Falatic martin at falatic.com
Fri Dec 9 21:49:57 UTC 2016


Summary: restore the system pips as shown below, uninstall all the crypto
packages you've installed, verify they are totally uninstalled now, THEN
install what you need for each python (probably just pycryptodome) per
previous emails, and test to see it's working and the right version for
both pythons.

> I honestly don't think dnf is installing pip? It's a Python environment
> issue? Post your scripts, which versions are you suggesting I use?
> 8.1 or the more recent 9.0.1 please?

# This restores the system versions of pip (8.1.2 currently):
sudo dnf reinstall python-pip python3-pip

> Yes, I have 'upgraded' pip (again this morning). Do you think this is a
> problem?

Yes - and as I said previously: don't do that. It's not a pip problem per
se, but upgrading pip that way breaks all the aliases in a way that makes
it hard to use pip for python2 and python3 properly, complicating things
massively. (I don't know how to upgrade pip and preserve or re-create the
correct aliases right offhand, and an upgrade of pip to 9.x is not
required to make any of this work. Just restore the system pip as above
and use it.)


> Python 3.5.2 (default, Sep 14 2016, 11:28:32)
>>>> import Crypto print(Crypto.version_info)
> (2, 6, 1, 'final', 0)
>
> Python 2.7.12 (default, Sep 29 2016, 12:52:02)
>>>> import Crypto
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named Crypto

You still have the old pycrypto package installed for python 2.7, and you
have no crypto installed for 3.5.

> # pip uninstall pycrypto
> Cannot uninstall requirement pycrypto, not installed
> [root at localhost ~]# pip3.5 uninstall pycrypto
> Cannot uninstall requirement pycrypto, not installed

But you upgraded pip, so it's not clear it "pip" refers to python 2 (which
we already know doesn't have it) or python 3 (which does though it's not
clear if Pip will do the job. Use pip2.7 and pip3.5 for clarity - make
sure you have the system pips as stated earlier.

That said, what you see in 3.5 is probably a result of installing with
setup.py directly. We'll get to that below.

> I'm wondering about Python and its search path?

You're using locate, but you're not searching for the right things. Try
`locate pycrypto Crypto`.

I installed everything - pycrypto, pycryptodome and pycryptodomex AS A
TEST. Here's what locate found (tree roots for brevity, you probably don't
have all of these at this point):

/usr/lib64/python2.7/site-packages/Crypto
/usr/lib64/python2.7/site-packages/Cryptodome
/usr/lib64/python2.7/site-packages/pycrypto-2.6.1.dist-info
/usr/lib64/python2.7/site-packages/pycryptodome-3.4.3-py2.7.egg-info
/usr/lib64/python2.7/site-packages/pycryptodomex-3.4.3.dist-info

/usr/lib64/python3.5/site-packages/Crypto  (lots under here)
/usr/lib64/python3.5/site-packages/Cryptodome  (lots under here)
/usr/lib64/python3.5/site-packages/pycrypto-2.6.1.dist-info
/usr/lib64/python3.5/site-packages/pycryptodome-3.4.3-py3.5.egg-info
/usr/lib64/python3.5/site-packages/pycryptodomex-3.4.3.dist-info

Lots of stuff! as pycryptodome and pycrypto both install under Crypto,
lots of conflicts too. Let's fix it!

sudo pip2.7 uninstall pycrypto
sudo pip2.7 uninstall pycryptodome
sudo pip2.7 uninstall pycryptodomex

sudo pip3.5 uninstall pycrypto
sudo pip3.5 uninstall pycryptodome
sudo pip3.5 uninstall pycryptodomex

(Answer yes to the prompts that will appear for each package installed)

Now, update `locate`'s database and re-run locate (don't ask me why but
locate will give some state info about directories no longer present after
this if you don't).
sudo updatedb; locate pycrypto Crypto

You should see... nothing, except possibly some local files. You shouldn't
find anything under /usr/lib64/.

But you might, because I've got a feeling at least one of these was
installed without pip. If that's the case, remove the following manually
and carefully:

/usr/lib64/python2.7/site-packages/Crypto
/usr/lib64/python2.7/site-packages/pycrypto-*
/usr/lib64/python3.5/site-packages/Crypto
/usr/lib64/python3.5/site-packages/pycrypto-*

Didn't you say at some point you installed pycrypto using 'setup.py'?
What's above is the only way to undo that. Fortunately, it works.

At this point you should have NOTHING left of pycrypto, or
pycryptodome/pycryptodomex. Now you can reinstall and test what you need
as per previous emails. Most likely, you'll just install pycryptodome for
python 2.7 and 3.5.


> I'm thinking that a total environment
> https://packaging.python.org/key_projects/#virtualenv
> might be a way to do this.

Better to first understand how to maintain the system installs.


> Most confusing is where Python 3.5 is finding pycrypto!

Not confusing at all now, I hope.

 - Marty




More information about the pycrypto mailing list