Ticket #363 (new defect)
PyInstaller fails to import module created using F2PY (Mac OSX 10.6, Python2.7)
| Reported by: | escheu2 | Owned by: | matysek |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PyInstaller | Version: | 1.5 |
| Severity: | blocker | Keywords: | MacOSX10.6, PyQt4, F2PY, NumPy |
| Cc: |
Description
I'm trying to bundle a PyQt4 gui script into a standalone app using PyInstaller?. So far, I've had good success in creating these standalone apps but just recently found a problem when trying to import modules created uisng SciPy?'s f2py (Fortran --> Python)...
The idea is to connect a gui button click to the execution of compiled Fortran code all wrapped up using Python and PyInstaller?...
PyInstaller? seems to build everything without error, but the app will not launch. The Traceback following failure to launch the app is:
ImportError?: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<string>", line 3, in <module> File "/Users/Edward?/pyinstaller/iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "/Users/Edward?/pyinstaller/iu.py", line 505, in doimport
mod = director.getmod(nm)
File "/Users/Edward?/pyinstaller/iu.py", line 297, in getmod
mod = owner.getmod(nm)
File "/Users/Edward?/pyinstaller/iu.py", line 109, in getmod
mod = imp.load_module(nm, fp, attempt, (ext, mode, typ))
ImportError?: numpy.core.multiarray failed to import ([0x0-0x13c13c].Mactestgui[2902]): Exited with exit code: 255
Any ideas would be helpful.
Attachments
Change History
comment:2 Changed 22 months ago by matysek
- Milestone changed from PyInstaller 1.5.1 to PyInstaller 1.5.2
This seems to require more work. Moving to another milestone.
comment:3 Changed 20 months ago by anonymous
Maybe a stupid suggestion, but if you import numpy module in your python main program, it may resolve your problem no ? I wrote a basic program python calling a f2py module and create an exe from that.
Python code
import testf2py
a=1
b=4
output=testf2py.main(a,b)
Fortran_code
subroutine main(a,b)
implicit none
integer a
integer b
integer i
i=0
do i=a,b
write(*,*),i
end do
end subroutine
Firstly, i had the following error : Traceback (most recent call last):
File "C:\Python26\pyinstaller-1.5\iu.py", line 455, in importHook
raise ImportError?, "No module named %s" % fqname
ImportError?: No module named numpy Traceback (most recent call last):
File "<string>", line 1, in <module> File "C:\Python26\pyinstaller-1.5\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Python26\pyinstaller-1.5\iu.py", line 505, in doimport
mod = director.getmod(nm)
File "C:\Python26\pyinstaller-1.5\iu.py", line 297, in getmod
mod = owner.getmod(nm)
File "C:\Python26\pyinstaller-1.5\iu.py", line 109, in getmod
mod = imp.load_module(nm, fp, attempt, (ext, mode, typ))
ImportError?: numpy.core.multiarray failed to import
So i wrote 'import numpy' in my main python code and it finally works. Maybe that can help you.

Could you please try svn version?