Freezing pycrypto

mk mrkafk at
Wed Oct 28 14:05:23 CET 2009

Hello everyone,

I'm trying to freeze PyCrypto on Linux (using and having 
trouble with it, can you help me? PyCrypto is used by paramiko (ssh 
client module).

I have added following in the Modules/Setup while building Python (This 
has to be done because requires that all compiled extension 
modules are compiled statically into Python, it can't import dynamic 
libraries into frozen binary):

# ... lots of other modules
Crypto.Cipher.DES3 DES3.c

But this produces:

[root at localhost Python-2.6.2]# make
/bin/sh ./Modules/makesetup -c ./Modules/ \
                                 -s Modules \
                                 Modules/Setup.config \
                                 Modules/Setup.local \
bad word Crypto.Cipher.DES3 in Crypto.Cipher.DES3 DES3.c
make: *** [Makefile] Error 1

If I change that to:


Python compiles, but then I can't import this module and neither can 
PyCrypto in a frozen binary:

[root at localhost tmp2]# ./cssh
<frozen>:6: DeprecationWarning: the sha module is deprecated; use the 
hashlib module instead
<frozen>:6: DeprecationWarning: the md5 module is deprecated; use 
hashlib instead
Traceback (most recent call last):
   File "", line 7, in <module>
     import paramiko
   File "/usr/local/lib/python2.6/site-packages/paramiko/", 
line 69, in <module>
     from transport import randpool, SecurityOptions, Transport
   File "/usr/local/lib/python2.6/site-packages/paramiko/", 
line 37, in <module>
     from paramiko.dsskey import DSSKey
   File "/usr/local/lib/python2.6/site-packages/paramiko/", 
line 31, in <module>
     from paramiko.pkey import PKey
   File "/usr/local/lib/python2.6/site-packages/paramiko/", line 
28, in <module>
     from Crypto.Cipher import DES3
ImportError: cannot import name DES3


More information about the Python-list mailing list