Help needed to freeze a script.

Michael Palmer m_palmer45 at yahoo.ca
Wed Sep 3 15:29:53 EDT 2008


On Sep 3, 1:30 pm, LB <berthe.l... at gmail.com> wrote:
>   Hi,
>
> I would like to freeze a numpy based script in order to have an
> application which could run without having to install numpy and cie.
>
> Indeed, I'm not root on the targeted computer and I can't easily
> make a complete install of numpy and scipy.
>
> So I decided to test the freeze.py tool shipped with python2.5.
> To complicate matters, I must say that I only have a local
> installation
> of python2.5 and numpy.
>
> I used the following command line :
>
> > python2.5 ../Python-2.5.1/Tools/freeze/freeze.py ~/Python/numpy/test_freeze.py
>
> At first sight, it seems to be fine, as I saw numpy in the liste of
> frozen dependancies :
>         [...]
> freezing numpy ...
> freezing numpy.__config__ ...
> freezing numpy._import_tools ...
> freezing numpy.add_newdocs ...
> freezing numpy.core ...
> freezing numpy.core._internal ...
> freezing numpy.core.arrayprint ...
> freezing numpy.core.defchararray ...
> freezing numpy.core.defmatrix ...
> freezing numpy.core.fromnumeric ...
> freezing numpy.core.info ...
> freezing numpy.core.memmap ...
> freezing numpy.core.numeric ...
> freezing numpy.core.numerictypes ...
> freezing numpy.core.records ...
> freezing numpy.ctypeslib ...
>               [...]
> freezing numpy.version ...
>
> But at the end I saw this message :
> Warning: unknown modules remain: _bisect _csv _ctypes _curses _hashlib
> _heapq
>               [...]
> numpy.core._dotblas numpy.core._sort numpy.core.multiarray
> numpy.core.scalarmath numpy.core.umath numpy.fft.fftpack_lite
> numpy.lib._compiled_base numpy.linalg.lapack_lite numpy.random.mtrand
> operator parser pyexpat readline
>               [...]
> Now run "make" to build the target: test_weibull
>
> I runned make without any problem but the final application didn't
> work :
> % ./test_freeze
> Traceback (most recent call last):
>   File "/home/loic/Python/numpy/test_freeze.py", line 8, in <module>
>     import numpy             as np
>              [...]
>   File "/home/loic/tmp/bluelagoon/lib/python2.5/site-packages/numpy/
> core/__init__.py", line 5, in <module>
>     import multiarray
> ImportError: No module named multiarray
>
> Is there any known issue when freezing a numpy based script ?
> I should add that I configured my PYTHONPATH to match my local
> installation
>  > echo $PYTHONPATH
> /home/loic/lib/python:/home/loic/tmp/bluelagoon/lib/python2.5:/home/
> loic/tmp/bluelagoon/lib/python2.5/site-packages/:
>
> and this local installation work fine :
>
> > python2.5 -c 'import numpy; print numpy.__version__; import numpy.core.multiarray; print "no pb"'
>
> 1.2.0b2
> no pb
>
> Have you got any recipe to freeze numpy based script ?
>
> Regards,
>
> --
> LB

Did you try py2exe instead of freeze? On the page

http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules

there is only one brief mention of numpy packaging troubles,
suggesting that it might work better. I have used py2exe in the past
without much trouble.



More information about the Python-list mailing list