Hello, I am having troubles using f2py with g95. I have Macports 1.6.0 on Leopard 10.5.1 PPC: py-numpy @1.0.4 python/py-numpy python24 @2.4.4 lang/python24 g95 @0.90 lang/g95 When I run f2py, it tries to run g95 with a "-shared" flag. g95 does have a "-shared" flag. It uses "-dynamic". I found the compiler settings in /opt/local/lib/python2.4/site-packages/numpy/distutils/fcompiler/g95.py I am now trying to change them, but I do not know how to reconfigure f2py. I assume that I must rerun a setup.py script, but I do not know which one, nor which options I should use. Would someone please tell how to reconfigure f2py? Thanks, Jim ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
On Jan 25, 2008 3:04 PM, Dexter Douglas <luomo1138@yahoo.com> wrote:
I am having troubles using f2py with g95.
<snip>
Would someone please tell how to reconfigure f2py?
The short answer is that the g95 fortran compiler is not supported on Mac OS X as the appropriate linking flags have not been implemented. I've just committed r33371 which make numpy and scipy depend on gcc42 until g95 linking is implemented in numpy. The longer answer is that numpy/distutils/fcompiler/g95.py needs to be modified (along the lines of numpy/distutils/fcompiler/gnu.py) so that it knows how to link on Mac OS X. I'm looking into this and hopefully will be able to send a patch upstream. Cheers Adam
Hello, Thanks for the update. I have already begun to modify the linking flags in numpy/distutils/fcompiler/g95.py But when I rerun f2py, it uses the old flags. I assume that I must rerun one of the setup.py files, but I am not sure which one to run or how to run it (setup.py, setup.py install, setup.py build, etc.) How do I reconfigure f2py so it sees my fixes? I will be happy to work with you fix this problem. Thanks, Jim --- Adam Mercer <ram@macports.org> wrote:
On Jan 25, 2008 3:04 PM, Dexter Douglas <luomo1138@yahoo.com> wrote:
I am having troubles using f2py with g95.
<snip>
Would someone please tell how to reconfigure f2py?
The short answer is that the g95 fortran compiler is not supported on Mac OS X as the appropriate linking flags have not been implemented. I've just committed r33371 which make numpy and scipy depend on gcc42 until g95 linking is implemented in numpy.
The longer answer is that numpy/distutils/fcompiler/g95.py needs to be modified (along the lines of numpy/distutils/fcompiler/gnu.py) so that it knows how to link on Mac OS X. I'm looking into this and hopefully will be able to send a patch upstream.
Cheers
Adam _______________________________________________ macports-users mailing list macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/macports-users
____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
On Jan 25, 2008, at 16:15, Dexter Douglas wrote:
Adam Mercer wrote:
On Jan 25, 2008 3:04 PM, Dexter Douglas wrote:
I am having troubles using f2py with g95.
<snip>
Would someone please tell how to reconfigure f2py?
The short answer is that the g95 fortran compiler is not supported on Mac OS X as the appropriate linking flags have not been implemented. I've just committed r33371 which make numpy and scipy depend on gcc42 until g95 linking is implemented in numpy.
The longer answer is that numpy/distutils/fcompiler/g95.py needs to be modified (along the lines of numpy/distutils/fcompiler/gnu.py) so that it knows how to link on Mac OS X. I'm looking into this and hopefully will be able to send a patch upstream.
I have already begun to modify the linking flags in numpy/distutils/fcompiler/g95.py
But when I rerun f2py, it uses the old flags. I assume that I must rerun one of the setup.py files, but I am not sure which one to run or how to run it (setup.py, setup.py install, setup.py build, etc.)
How do I reconfigure f2py so it sees my fixes? I will be happy to work with you fix this problem.
I don't use this software, but I'm curious: if it compiles with the fortran compiler in gcc42, why expend any effort trying to make it work with a different fortran compiler? Why not just say "it requires gcc42" and be done with it?
On Jan 25, 2008 5:39 PM, Ryan Schmidt <ryandesign@macports.org> wrote:
I don't use this software, but I'm curious: if it compiles with the fortran compiler in gcc42, why expend any effort trying to make it work with a different fortran compiler? Why not just say "it requires gcc42" and be done with it?
That's what I ended up doing in r33371 Cheers Adam
Hello,
On Jan 25, 2008 5:39 PM, Ryan Schmidt <ryandesign@macports.org> wrote:
I don't use this software, but I'm curious: if it compiles with the fortran compiler in gcc42, why expend any effort trying to make it work with a different fortran compiler? Why not just say "it requires gcc42" and be done with it?
f2py is used to create interfaces that allow Python code to call Fortran code. It supports many different Fortran compilers like Absoft, Lahey, IBM, gfortran, and g95. The support file for g95 is included with the f2py (numpy) package. The support file lists compiler and linker flags for g95. Some of the flags are wrong. I know how to update the g95.py file, but I do not remember how to reconfigure the f2y/numpy package so that it will recognize my fixes. I am pretty sure it is a matter of rerunning one of the setup.py files. I just do not know which one or how. It really is a quick fix -- except for setup.py. I have tried running several of the setup.py scripts, but I am either running the wrong ones, or I am not using the right options. If anyone knows which setup.py file I am supposed to run and the correct way to run it, please let me know. Thanks, Jim ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
On Jan 26, 2008 5:22 PM, Dexter Douglas <luomo1138@yahoo.com> wrote:
Hello,
On Jan 25, 2008 5:39 PM, Ryan Schmidt <ryandesign@macports.org> wrote:
I don't use this software, but I'm curious: if it compiles with the fortran compiler in gcc42, why expend any effort trying to make it work with a different fortran compiler? Why not just say "it requires gcc42" and be done with it?
f2py is used to create interfaces that allow Python code to call Fortran code. It supports many different Fortran compilers like Absoft, Lahey, IBM, gfortran, and g95.
The support file for g95 is included with the f2py (numpy) package. The support file lists compiler and linker flags for g95. Some of the flags are wrong. I know how to update the g95.py file, but I do not remember how to reconfigure the f2y/numpy package so that it will recognize my fixes. I am pretty sure it is a matter of rerunning one of the setup.py files. I just do not know which one or how.
It really is a quick fix -- except for setup.py. I have tried running several of the setup.py scripts, but I am either running the wrong ones, or I am not using the right options.
If anyone knows which setup.py file I am supposed to run and the correct way to run it, please let me know.
I would imagine you'd have to apply the fix to the source tree and then rerun the install from the beginning. Have you sent the fixes to g95.py upstream? Cheers Adam
Hello, --- Adam Mercer <ramercer@gmail.com> wrote:
I would imagine you'd have to apply the fix to the source tree and then rerun the install from the beginning. Have you sent the fixes to g95.py upstream?
No I have not submitted my fixes because I want to test them first. Thanks, Jim ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Hello, I have resolved my problem with f2py. First, installed python2.5. "sudo port install python2.5" Then I linked python. "cd /opt/local/bin ; sudo ln -s python2.5 python" Then I installed numpy. "sudo port install py25-numpy" Then I modified the linker flags. In /opt/local/lib/python2.5/site-packages/numpy/distutils/fcompiler/g95.py I changed line 24 from 'linker_so' : ["<F90>","-static"], to 'linker_so' : ["<F90>","-dynamiclib -L/opt/local/lib -lpython2.5"], Then I compiled a test program. f2py25 -c -m hello hello.f90 I was able to import and run it (see http://www.scipy.org/F2py). See hello.f90 below. I have not done any further testing. I have submitted a bug report. JIm cat hello.f90: subroutine foo(a) implicit none integer :: a write(*,*) "Hello from Fortran!" write(*,*) "a =", a end subroutine foo ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
On Jan 30, 2008 5:13 PM, Dexter Douglas <luomo1138@yahoo.com> wrote:
Then I modified the linker flags. In /opt/local/lib/python2.5/site-packages/numpy/distutils/fcompiler/g95.py
I changed line 24 from 'linker_so' : ["<F90>","-static"], to 'linker_so' : ["<F90>","-dynamiclib -L/opt/local/lib -lpython2.5"],
This has been incorporated into py-numpy/py25-numpy version 1.0.4_6, can you update to that version and check that f2py still works with g95? Cheers Adam
Hello, I have upgraded my py25-numpy package. It works. Thanks, Jim --- Adam Mercer <ram@macports.org> wrote:
On Jan 30, 2008 5:13 PM, Dexter Douglas <luomo1138@yahoo.com> wrote:
Then I modified the linker flags. In
/opt/local/lib/python2.5/site-packages/numpy/distutils/fcompiler/g95.py
I changed line 24 from 'linker_so' : ["<F90>","-static"], to 'linker_so' : ["<F90>","-dynamiclib -L/opt/local/lib -lpython2.5"],
This has been incorporated into py-numpy/py25-numpy version 1.0.4_6, can you update to that version and check that f2py still works with g95?
Cheers
Adam
____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
participants (4)
-
Adam Mercer
-
Adam Mercer
-
Dexter Douglas
-
Ryan Schmidt