473,593 Members | 2,907 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

f2py on windows XP - "Unknown Switch"??

Hello,
I'm trying to get f2py working from the command line on windows XP. I
have mingw32 as my C complier (after some advice on a previous thread)
and Compaq Visual Fortran 6.5. Changing my C complier reduced my errors
but I'm still having trouble. I think I have all the correct paths set
but I'm not sure. F2PY gets further when I specifically tell it what my
compilers are as follows........ .........

C:\Program Files\ESI_Softw are\SileFortran \ExampleF2PY>f2 py
--fcompiler=compa qv -
-compiler=mingw3 2 -c -m hello hello.f

If I don't specify the compliers it looks for a file cl.exe then
terminates when it can't find it.

Once the compliers are specified it seems to read my fortran code ok,
build the module "hello" and the wrapper function "foo" and writes a
temporary file "hellomodul e.c"

Then it seems to use MINGW32 ok.........

The problem arises right at the end when it tries to generate hello.pyd
and I'm not sure why, I've included the error below.

I've tried eveything I can think of but I'm very new to programming so
I'm not having much success.

Any help would be much appreciated.

Thanks,
Sile

DF:f77: hello.f
DF
c:\docume~1\esi l\locals~1\temp \tmp-tajpa\Release\d ocume~1\esil\lo cals~1\temp\
tmp-tajpa\src.win32-2.3\hellomodule .o
c:\docume~1\esi l\locals~1\temp \tmp-tajpa\R
elease\docume~1 \esil\locals~1\ temp\tmp-tajpa\src.win32-2.3\fortranobje ct.o
c:\do
cume~1\esil\loc als~1\temp\tmp-tajpa\Release\h ello.o
-LC:\PROGRA~1\ES I_SO~1\UTILS
_~1\PYTHON~1.3_ C\libs
-LC:\PROGRA~1\ES I_SO~1\UTILS_~1 \PYTHON~1.3_C\P CBuild -lpyt
hon23 /OUT:.\hello.pyd
DF: error: Unknown switch:
'-LC:\PROGRA~1\ES I_SO~1\UTILS_~1 \PYTHON~1.3_C\l ibs'
error: Command "DF
c:\docume~1\esi l\locals~1\temp \tmp-tajpa\Release\d ocume~1\esi
l\locals~1\temp \tmp-tajpa\src.win32-2.3\hellomodule .o
c:\docume~1\esi l\locals~1\
temp\tmp-tajpa\Release\d ocume~1\esil\lo cals~1\temp\tmp-tajpa\src.win32-2.3\fortr
anobject.o c:\docume~1\esi l\locals~1\temp \tmp-tajpa\Release\h ello.o
-LC:\PROGRA~
1\ESI_SO~1\UTIL S_~1\PYTHON~1.3 _C\libs
-LC:\PROGRA~1\ES I_SO~1\UTILS_~1 \PYTHON~1.3
_C\PCBuild -lpython23 /OUT:.\hello.pyd " failed with exit status 1

Aug 21 '06 #1
6 2757

Sile wrote:
Hello,
I'm trying to get f2py working from the command line on windows XP. I
have mingw32 as my C complier (after some advice on a previous thread)
and Compaq Visual Fortran 6.5. Changing my C complier reduced my errors
but I'm still having trouble. I think I have all the correct paths set
but I'm not sure. F2PY gets further when I specifically tell it what my
compilers are as follows........ .........
[snip]

Sile,

I'd suggest that if you haven't got this sorted yet, you try the f2py
mailing list, or e-mail direct to the package author.

Cheers,
John [who's been away from the net for a week]

Aug 26 '06 #2
Cheers John -

I did finally getting f2py working on XP using MinGW, GnuFcompiler for
F77, and much help! However, having set up everything correctly I have
been told in work I now need to use F90. I have downloaded and
installed G95 MinGW in my MinGW directory and this isn't working now,
I'm not having much joy with this! When I check the available fortran
compilers in F2PY I get the following...... .........

customize Gnu95FCompiler

Could not locate executable f95

Executable f95 does not exist

Could not locate executable f95

Executable f95 does not exist

Could not locate executable f95

Executable f95 does not exist

customize IntelVisualFCom piler

Could not locate executable ifl

Executable ifl does not exist

customize G95FCompiler

Couldn't match compiler version for 'G95 (GCC 4.0.3 (g95 0.90!) Aug 22
2006) Copyright (C) 2002-2005 Free Software Foundation, Inc.nG95 comes
with NO WARRANTY, to the extent permitted by law. You may redistribute
copies of G95under the terms of the GNU General Public License.For more
information about these

............... .etc.
based on suggestions on the web I changed one line in g95.py to
version_pattern =r'G95.*\(GCC4. 01)\(g95!) (?P<version& gt;.\).
Unfortunately this didn't work for me. The problem seems to be with my
gcc version so I'm trying to find a way around this at the moment. Any
suggestions would be much appreciated, I have submitted this problem to
the f2py mailing list too.

thanks,

Sile

Aug 28 '06 #3
On 28/08/2006 6:44 PM, Sile wrote:
Cheers John -

I did finally getting f2py working on XP using MinGW, GnuFcompiler for
F77, and much help! However, having set up everything correctly I have
been told in work I now need to use F90. I have downloaded and
installed G95 MinGW in my MinGW directory and this isn't working now,
I'm not having much joy with this! When I check the available fortran
compilers in F2PY I get the following...... .........

customize Gnu95FCompiler

Could not locate executable f95

Executable f95 does not exist

Could not locate executable f95

Executable f95 does not exist

Could not locate executable f95

Executable f95 does not exist

customize IntelVisualFCom piler

Could not locate executable ifl

Executable ifl does not exist

customize G95FCompiler

Couldn't match compiler version for 'G95 (GCC 4.0.3 (g95 0.90!) Aug 22
2006) Copyright (C) 2002-2005 Free Software Foundation, Inc.nG95 comes
with NO WARRANTY, to the extent permitted by law. You may redistribute
copies of G95under the terms of the GNU General Public License.For more
information about these

............... etc.
based on suggestions on the web I changed one line in g95.py to
version_pattern =r'G95.*\(GCC4. 01)\(g95!) (?P<version& gt;.\).
Unfortunately this didn't work for me. The problem seems to be with my
gcc version so I'm trying to find a way around this at the moment. Any
suggestions would be much appreciated, I have submitted this problem to
the f2py mailing list too.
Ummm shouldn't that be "GCC 4.0.1", not "GCC4.01" ???
Further that pattern seems as though it's been through some web
garbling; for example "&lt;" instead of "<", the parentheses don't
match, the string isn't terminated by a "'", spaces missing, ....

Can you post an ungarbled version of the original line (maybe the
*whole* g95.py -- e-mail if it's too big) and what you changed it to,
plus what your f95 compiler puts out when you run it with --version?

Cheers,
John
Aug 28 '06 #4
Thanks for your reply,
Sorry about the last post - pasting from another post didn't work so
well...

The --version output from my f95 compiler is as follows:

C:\>g95 --version
G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006)
Copyright (C) 2002-2005 Free Software Foundation, Inc.

G95 comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of G95
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

The f95.py file is located under Numpy as follows.......
C:\Program
Files\ESI_Softw are\UTILS_2006\ Python2.3_CFD\L ib\site-packages\numpy\ distutils\fcomp iler\f95.py

import os
import sys

from numpy.distutils .cpuinfo import cpu
from numpy.distutils .fcompiler import FCompiler

class G95FCompiler(FC ompiler):

compiler_type = 'g95'
version_pattern = r'G95.*\(GCC 4.0.3 \(g95!\) (?P<version>.*) \).*'
THE LINE ABOVE WAS ORIGINALLY:
version_pattern = r'G95.*\(experi mental \(g95!\)
(?P<version.*)\ ).*'

executables = {
'version_cmd' : ["g95", "--version"],
'compiler_f77' : ["g95", "-ffixed-form"],
'compiler_fix' : ["g95", "-ffixed-form"],
'compiler_f90' : ["g95"],
'linker_so' : ["g95","-shared"],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"]
}
pic_flags = ['-fpic']
module_dir_swit ch = '-fmod='
module_include_ switch = '-I'

def get_flags(self) :
return ['-fno-second-underscore']
def get_flags_opt(s elf):
return ['-O']
def get_flags_debug (self):
return ['-g']

if __name__ == '__main__':
from distutils import log
log.set_verbosi ty(2)
from numpy.distutils .fcompiler import new_fcompiler
#compiler = new_fcompiler(c ompiler='g95')
compiler = G95FCompiler()
compiler.custom ize()
print compiler.get_ve rsion()
The output from f2py when I check the fortran compilers is.........

C:\>f2py -c --help-fcompiler
............... .....
Could not locate executable f95
Executable f95 does not exist
customize VastFCompiler
Could not locate executable vf90
Executable vf90 does not exist
customize GnuFCompiler
customize IbmFCompiler
Could not locate executable xlf
Executable xlf does not exist
customize Gnu95FCompiler
Could not locate executable f95
Executable f95 does not exist
Could not locate executable f95
Executable f95 does not exist
Could not locate executable f95
Executable f95 does not exist
customize IntelVisualFCom piler
Could not locate executable ifl
Executable ifl does not exist
customize G95FCompiler
Couldn't match compiler version for 'G95 (GCC 4.0.3 (g95 0.90!) Aug 22
2006)\nCo
pyright (C) 2002-2005 Free Software Foundation, Inc.\n\nG95 comes with
NO WARRAN
TY, to the extent permitted by law.\nYou may redistribute copies of
G95\nunder the terms of the GNU General Public License.\nFor more
information about these matters, see the file named COPYING'
customize IntelItaniumFCo mpiler
Could not locate executable efc
Executable efc does not exist
customize PGroupFCompiler
Could not locate executable pgf77
Executable pgf77 does not exist
customize LaheyFCompiler
Could not locate executable lf95
Executable lf95 does not exist
customize CompaqVisualFCo mpiler
customize MipsFCompiler
customize HPUXFCompiler
customize IntelItaniumVis ualFCompiler
Could not locate executable efl
Executable efl does not exist
customize IntelEM64TFComp iler
Could not locate executable efc
Executable efc does not exist
List of available Fortran compilers:
--fcompiler=compa qv DIGITAL|Compaq Visual Fortran Compiler (6.5)
--fcompiler=gnu GNU Fortran Compiler (3.4.5)

I hope that makes it a bit clearer,

Thanks,

Sile

Aug 28 '06 #5
On 28/08/2006 9:47 PM, Sile wrote:
Thanks for your reply,
Sorry about the last post - pasting from another post didn't work so
well...

The --version output from my f95 compiler is as follows:

C:\>g95 --version
G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006)
Copyright (C) 2002-2005 Free Software Foundation, Inc.
[snip]
The f95.py file is located under Numpy as follows.......
C:\Program
Files\ESI_Softw are\UTILS_2006\ Python2.3_CFD\L ib\site-packages\numpy\ distutils\fcomp iler\f95.py
Looks like asking the Numpy folks might be a good idea ...
>
import os
import sys

from numpy.distutils .cpuinfo import cpu
from numpy.distutils .fcompiler import FCompiler

class G95FCompiler(FC ompiler):

compiler_type = 'g95'
version_pattern = r'G95.*\(GCC 4.0.3 \(g95!\) (?P<version>.*) \).*'
That won't match the guff your f95 puts out. The "!)" appears *after*
the version number. See below.

|>>import re
|>>guff = 'G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006) etc etc'
|>>vp1 = r'G95.*\(GCC 4.0.3 \(g95!\) (?P<version>.*) \).*'
|>>vp2 = r'G95.*\(GCC 4.0.3 \(g95 (?P<version>.*) !\).*'
|>>m1 = re.match(vp1, guff)
|>>print m1
None
|>>m2 = re.match(vp2, guff)
|>>print m2
<_sre.SRE_Mat ch object at 0x00AED9E0>
|>>print m2.group('versi on')
0.90
|>>>

THE LINE ABOVE WAS ORIGINALLY:
version_pattern = r'G95.*\(experi mental \(g95!\)
(?P<version.*)\ ).*'
No it wasn't. It would have had a ">" after "version" :-)

HTH,
John
Aug 28 '06 #6
Thanks John,

Your help is very much appreciated - my f2py finally recognises my
fortran compiler - I'm very relieved!
>
That won't match the guff your f95 puts out. The "!)" appears *after*
the version number. See below.

|>>import re
|>>guff = 'G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006) etc etc'
|>>vp1 = r'G95.*\(GCC 4.0.3 \(g95!\) (?P<version>.*) \).*'
|>>vp2 = r'G95.*\(GCC 4.0.3 \(g95 (?P<version>.*) !\).*'
I changed my g95 file so that version_pattern was correct.
>
THE LINE ABOVE WAS ORIGINALLY:
version_pattern = r'G95.*\(experi mental \(g95!\)
(?P<version.*)\ ).*'

No it wasn't. It would have had a ">" after "version" :-)
oops!

Many thanks again,

Sile

Aug 28 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3368
by: Marcus | last post by:
I'm running into a situation that has me adding a value of "Unknown" to a reference table. I am being pulled between two trains of thought, and was curious to get other's input on in. I give an example below. 1-) Adding "Unknown" to a reference table is bad. Doing so effectively changes the Nullability option of every FK that references the table to a NULLable FK relation. 2-) Simply adding a "Not Known/Undetermined" value to the...
1
1712
by: imw8n4u | last post by:
I need to create combo box that lists unique values from a table and limit the selection to this list. However, I also need to add "UNKNOWN" as a valid selection even though it is not in the table I am using as the source for the combo box. Can this be done? Thanks!
2
1964
by: John Baker | last post by:
Hi: I have two systems, one a W98 and the other XP Home. I have Access 2000 installed on both, and have run into a difference in the way the two behave. I have a table on which I wish to reset an "auto number" field so the counter goes back to zero. The procedure I have used is to copy the contents of the table to a temp table, empty the table and then compress the files. After that I copy back the data to the table without the...
12
3215
by: junky_fellow | last post by:
Which is better using a switch statement or the if-then equivalent of switch ?
3
6632
by: Ed L. | last post by:
On 7.4.6, is there any problem with defining one column of a view to be a string literal? For example ... $ psql -c "create view fooview as select 'bar' as footype" WARNING: column "footype" has type "unknown" DETAIL: Proceeding with relation creation anyway. CREATE VIEW Or is this warning just noise in this case?
25
2602
by: MLH | last post by:
Is it a common occurrence for A97 VBA to 'RACE' on past a debug.print statement? I have been trying to debug a problem (which turned out to be an attempt to assign Null to a Date Type variable) and had several debug.print statements... 10 Good code... 20 Debug.Print "tblBlahBlah", MyVar 30 Good code...
0
2154
by: Shaun | last post by:
Hi all, I'm trying to implement a custom session handler that writes session data to a MySQL database. It works fine about 99% of the time. Trouble is, at random intervals, I get entries like the following in my php-error.log: PHP Warning: Unknown: A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0
9
10711
by: Klaus Johannes Rusch | last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of an unknown property of an object, for example document.write(typeof window.missingproperty); Has "unknown" been defined as a valid return value for the typeof operator in a later version of ECMAScript or is this a JScript "feature"? -- Klaus Johannes Rusch
7
38001
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement using innerHTML. Now, I've researched this problem on the web, and found many references to it, but none of them quite addressed my specific situation, and since my experience with JavaScript is limited, I was not able to adapt the solutions I...
0
8241
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8227
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5402
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3853
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1469
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.