Re: [f2py] Can't get Enthought python to work with f2py

Robert Kern <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Organization The Church of Last Thursday
Message-ID <[email protected]>
On 2009-06-30 14:40, charlie strauss wrote:
>
> On Jun 30, 2009, at 12:35 PM, Robert Kern wrote:
>
>> On 2009-06-30 12:58, charlie strauss wrote:
>>> I just installed the latest enthought python distro and now my f2py
>>> won't compile.
>>>
>>> I think the problem is that the enthought f2py is trying to use the fink
>>> or macports gfortran. But I don't know how to tell it not to.
>>>
>>> if I run ipython from fink then the programs do compile.
>>
>> You almost certainly shouldn't be running f2py from ipython.
>
>
> uh why not?
>
>>
>>> the specific error that occurs from the enthought f2py is that it does
>>> not like the --arch command line flag that f2py places on the compile
>>> command. So another way to try solving this is to somehow adjust the
>>> default command line args in enthought's f2py so the fink gfortran is
>>> happy.
>>
>> Note that it's not "Enthought's f2py". It's the standard f2py from
>> numpy. I suspect that Fink is patching numpy to work with its standard
>> gfortran configuration out-of-box.
>>
>>> I have also tries using g95 as the -fcompiler=g95 or --fcompliler=gnu95
>>> and this also produced different but I think fundamentally simmilar
>>> errors.
>>>
>>> So my first question is how do I get enthought's f2py to stop using the
>>> fink or macports f2py???
>>
>> Make sure that the gfortran that is first on your $PATH is the one you
>> want to use. I recommend the one here:
>
> well the enthought python framework is first on the path (as I showed in
> the original post). when I invoke ipython or python it is what launches
> not the one in fink which is later on the path.
>
> So I repeat my original question, how do I tell the enthought numpy.f2py
> that it needs to use whatever fortran compiler is used by enthought
> rather than finks.
>
> perhaps the mistake I'm making here is that I'm assuming enthough's
> distro has a fortran compiler lurking in it for numpy.f2py to use.

Correct. It does not.

> So if I'm going to install a different one, then how do I "patch" f2py's
> default arguments so it works with that compiler. Clearly the gfortran,
> g9g and gnu95 that come with fink and macports do not work unpatched
> with enthought's numpy.f2py.

Install the one I recommended. Make sure it is first on the $PATH.

Actually, I was probably incorrect about Fink's patching numpy. They probably 
didn't. The --arch flags are most likely coming from Python's configuration, as 
with any extension module. The version of EPD that you installed compiled Python 
as a Universal binary, so all of the extension modules have --arch flags in 
them. Fink's Python is probably Intel-only and was not compiled with those flags.

> you are suggesting I install yet another fortran compiler to solve this
> problem when I already have at least four installed including two
> versions of gfortran. This seems kind of a brute force suggestion.

Sorry. Fink's gfortran does not incorporate the Apple patches to work with the 
--arch flags that are standard on OS X. If one of the four you have installed 
does incorporate those patches, then go ahead and use that. In my experience, 
only the one I recommended does.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.