Issue with installing pyCrypto

Apologies if this is the wrong place to post this. I am very new with all of this.

I am attempting to remove the encryption from a PDF called FileOpen. I found a python script and I have followed the instructions suggested here

[Is it possible to enclose FileOpen_ineptpdf into plugin? · Issue #157 · noDRM/DeDRM_tools · GitHub]

and here


I have managed to install Pycrypto but when I attempt to run the ineptpdf8.4.51 script I still get the error ‘Pycypto is not installed etc etc’ even though it seems clear to me that its been installed correctly.

Has anyone else had the same issue and has found a fix?

Many thanks

It looks like PyCrypto is no longer maintained because it’s for Python 2, which reached the end of its life a while back, and that you should try PyCryptodome instead.

In almost every case, “I installed X and all the output from Pip looked ok, but I can’t import X” means that either:

  • the name for the package in Python code does not match the name used on PyPI;

  • the wrong Pip was used, which therefore installed for the wrong Python (= a different copy of Python vs. the one being used to run the code).

In your case, you are using someone else’s code, which is giving a custom diagnostic based on its attempt to import the module, and it knows what the package name should be. So it has to be the other problem. The comments in the script clearly indicate that it expects to run on Python 2.7, which is outdated (comparable to Windows 7 in this regard, except there were intentional breaking changes to the language in 3.x), and to use the Pycrypto package with is also for the outdated Python 2.7.

You should not expect to be able to use this code productively, and should look for an alternative.

If you really must stick with this legacy system, and have all the requirements set up (in particular, a Python 2.7 installation), make sure that you are using Python 2.7 both when you install PyCrypto and when you run the script. The best way to ensure the install is correct is to figure out how to run that Python from the command line, and then run it with -m pip followed by the rest of the arguments to Pip.