[Numpy-discussion] Import error while freezing with cxfreeze

Anand Gadiyar gadiyar at gmail.com
Fri Apr 5 07:43:32 EDT 2013


Hi all,

I have a small program that uses numpy and scipy. I ran into a couple of
errors while trying to use cxfreeze to create a windows executable.

I'm running Windows 7 x64, Python 2.7.3 64-bit, Numpy 1.7.1rc1 64-bit,
Scipy-0.11.0 64-bit, all binary installs from <
http://www.lfd.uci.edu/~gohlke/pythonlibs/>

I was able to replicate this with scipy-0.12.0c1 as well.

1) "from scipy import constants" triggers the below:
Traceback (most recent call last):
File "D:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line
27, in <module>
exec_code in m.__dict__
File "mSimpleGui.py", line 10, in <module>
File "mSystem.py", line 7, in <module>
File "D:\Python27\lib\site-packages\scipy\__init__.py", line 64, in <module>
    from numpy import show_config as show_numpy_config
File "D:\Python27\lib\site-packages\numpy\__init__.py", line 165, in
<module>
    from core import *
AttributeError: 'module' object has no attribute 'sys'

2) "from scipy import interpolate" triggers the below:
Traceback (most recent call last):
File "D:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line
27, in <module>
exec_code in m.__dict__
File "mSimpleGui.py", line 10, in <module>
File "mSystem.py", line 9, in <module>
File "mSensor.py", line 10, in <module>
File "D:\Python27\lib\site-packages\scipy\interpolate\__init__.py", line
154, in <module>
    from rbf import Rbf
File "D:\Python27\lib\site-packages\scipy\interpolate\rbf.py", line 50, in
<module>
    from scipy import linalg
ImportError: cannot import name linalg

I've attached a couple of small patches that fix these errors for me, but
I'm not sure if these are the best way to fix. Could you please take a look?

I'd be happy to test alternative fixes.

Thanks in advance,
Anand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130405/8cf46d17/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-import-sys-as-something-else-to-avoid-namespace-conf.patch
Type: application/octet-stream
Size: 1598 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130405/8cf46d17/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-interpolate-import-only-the-required-function-to-avo.patch
Type: application/octet-stream
Size: 1700 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130405/8cf46d17/attachment-0001.obj>


More information about the NumPy-Discussion mailing list