[SciPy-user] weave and mingw on win xp sp2 bug?

Michael ODonnell odonnems at yahoo.com
Sun Dec 30 18:01:22 EST 2007


Thanks for the info on this. Sorry I was slow at responding to your email. I did compile my notes as to how I got weave.inline to work. I know that when I was working on this before and trying a million different combinations, I also changed the location of my temp directory in the environment variables to C:/Temp. I have learned that everything tends to work best when there are no spaces in directories and ISO standards are followed. I will go ahead and post my notes on what I did but it sounds like you have everything working so feel free to ignore.



Like I mentioned I was only
able to get weave.inline to work with python 2.5.1 and mingw 5.0.3. I tried
python 2.4.1 and 2.4.4 with visual studio compilers and mingw. I hope this
information is of some help. This process was new for me so it may not be the
best solution or accurate but it does work for me.


 


OS: Windows XP SP2
professional


Processor: x86


 


I suggest you check that MinGW
is installed correctly by following the directions on their website. A summary
of these directions include: First install MSYS, say, to directory C:\msys\1.0.
Then install MinGW to C:\msys\1.0\mingw directory. If you choose to install
MinGW to C:\mingw as the installer suggests by default then you have to create
a file C:\msys\1.0\etc\fstab containing c:/mingw /mingw and then restart your
computer so that /mingw will be mounted. Once this is done you might test the
compiler on something to eliminate this as a source of error. Then make sure
you add the MinGW path to PYTHONPATH environment variable (e.g., % PYTHONPATH%;
C:\msys\1.0\bin;C:\msys\1.0\mingw\bin;).


 


I then had to modify the numpy
distutils exec_command.py. This is likely found in
C:\Python25\Lib\site-packages\numpy\ distutils:


 


                    I commented out this code starting on line 67 or
so:


    '''


    if os.name
in ['nt','dos']:


       
fdir,fn = os.path.split(pythonexe)


        fn =
fn.upper().replace('PYTHONW','PYTHON')


       
pythonexe = os.path.join(fdir,fn)


        assert
os.path.isfile(pythonexe), '%r is not a file' % (pythonexe,)


    '''


        And then I replaced with these lines:


        ###MOD edits


        #C:\Python24\python.exe


        import string


        exe = 'python.exe'


        for p in
string.split(os.environ['Path'],';'):


            fn =
os.path.join(os.path.abspath(p),exe)


            if os.path.isfile(fn):


                pythonexe = fn


        ###End of MOD edits


 


 


These
edits worked for me.


 


I
was never successful in using VS2003 toolkit or VS2005 Express. I was able to
install these and compile some python modules successfully so they did work as
compilers. However, changes to the SDK had to be implemented in order for these
to work as well. I am not sure why I could not get weave to work with these
compilers but once I got something to work I gave up trying to understand due
to my time constraints. The alterations I made to the compilers are included
below. Apparently the problem has to do with Microsoft and Express. The full software
package of visual studio apparently does not have these problems. Here are the
edits I made to get these to compile python modules (weave still did not work
however).


 


Source for this info: http://www.codeproject.com/KB/wtl/WTLExpress.aspx


 


 


1. cd C:\Program
Files\Microsoft Platform SDK\include\atl


 


Change SetChainEntry function
at line 1725 of atlwin.h - define "int i" at the first line of the
function body.


BOOL SetChainEntry(DWORD
dwChainID, CMessageMap* pObject, DWORD


dwMsgMapID = 0)


{


    int i;


    // first search for an existing entry


 


    


    for(i = 0; i < m_aChainEntry.GetSize();
i++)


 


 


2.Change AllocStdCallThunk
and FreeStdCallThunk at line 287 of atlbase.h to the new macros


/* Comment it


PVOID __stdcall __AllocStdCallThunk(VOID);


VOID __stdcall
__FreeStdCallThunk(PVOID);


 


#define AllocStdCallThunk()
__AllocStdCallThunk()


#define FreeStdCallThunk(p)
__FreeStdCallThunk(p)


 


#pragma comment(lib,
"atlthunk.lib")


*/


#define AllocStdCallThunk()
HeapAlloc(GetProcessHeap(), 


                              0,
sizeof(_stdcallthunk))


#define FreeStdCallThunk(p)
HeapFree(GetProcessHeap(), 0, p)


 


 


3. Download and install WTL
from SourceForge


cd  to WTL\AppWiz folder, double click
setup80x.js (or appropriate version to install the WTL Wizard into VC Express








----- Original Message ----
From: mani sabri <mani.sabri at gmail.com>
To: SciPy Users List <scipy-user at scipy.org>
Sent: Sunday, December 30, 2007 2:34:18 AM
Subject: Re: [SciPy-user] weave and mingw on win xp sp2 bug?


>-----Original Message-----
>From: scipy-user-bounces at scipy.org
 [mailto:scipy-user-bounces at scipy.org] On
>Behalf Of Michael ODonnell
>Sent: Saturday, December 29, 2007 6:04 PM
>To: SciPy Users List
>
>Hi sorry I did not reply about your inquiry of using weave. It took me
>quite a bit of time to get this to work and I never got any responses.
>Unfortunately, I am heading out the door so I will keep this extremely
>short until I can provide a more complete response tonight or tomorrow
>morning. I was able to get weave inline to work using python 2.5.1 and
>mingw 5.0.3. The path to this needs to be added to your pythonpath
 variable
>and you need to specify 'gcc' as your compiler. I also worked with
 VS2003
>and VS2005 Express. And I worked with python 2.4.1 and 2.4.4. None of
 these
>combinations worked. There was also a problem in numpy with finding
 the
>python.exe file. I cannot remember if this error was given with VS
 compiler
>or both VS and MingW.
>

I managed to run/compile my Time Wrapping function with weave and
 python
2.4.4 an hour ago. Although the weave.tests continues to show ugly
"Permission Denied" message I had no problem with my func. (and like
 most
windows users I don't care about that message! Its windows! ;) )

As I remember it is the python24.a file in 2.4.4 that makes the whole
difference because gcc don't know anything about Microsoft lib files.
Anyhow here is a brief state of my system:

- scipy 0.6.0
- numpy 1.0.4
- Python in c:\python24 (no spaces in path! Its important)
- environment variables:
    python_lib = c:\Python24\libs\python24.a
    pythonpath = c:\Python24;C:\PROGRAM FILES\Pyrex-0.9.6.4;
    swig_lib =    C:\PROGRAM FILES\swingwin-1.3.27\python
    python_include = C:\Python24\include;
    path = C:\MINGW\BIN;C:\CYGWIN\BIN; C:\PROGRAM FILES\swingwin-
1.3.27\python;c:\python24

p.s: I saw some posts about cleaning up weave.tests in scipy-dev these
 days.
I hope they take a look at weave.example directory. 

_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20071230/482523e1/attachment.html>


More information about the SciPy-User mailing list