Freezing pycrypto

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


Hello everyone,

I'm trying to freeze PyCrypto on Linux (using freeze.py) 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 freeze.py requires that all compiled extension 
modules are compiled statically into Python, it can't import dynamic 
libraries into frozen binary):

*static*
# ... 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/config.c.in \
                                 -s Modules \
                                 Modules/Setup.config \
                                 Modules/Setup.local \
                                 Modules/Setup
bad word Crypto.Cipher.DES3 in Crypto.Cipher.DES3 DES3.c
make: *** [Makefile] Error 1

If I change that to:

DES3 DES3.c

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 "cssh.py", line 7, in <module>
     import paramiko
   File "/usr/local/lib/python2.6/site-packages/paramiko/__init__.py", 
line 69, in <module>
     from transport import randpool, SecurityOptions, Transport
   File "/usr/local/lib/python2.6/site-packages/paramiko/transport.py", 
line 37, in <module>
     from paramiko.dsskey import DSSKey
   File "/usr/local/lib/python2.6/site-packages/paramiko/dsskey.py", 
line 31, in <module>
     from paramiko.pkey import PKey
   File "/usr/local/lib/python2.6/site-packages/paramiko/pkey.py", line 
28, in <module>
     from Crypto.Cipher import DES3
ImportError: cannot import name DES3




Regards,
mk




More information about the Python-list mailing list