[SciPy-Dev] Getting Scipy's weave to work reliably on Windows
Chris Ball
ceball at gmail.com
Sat Jul 17 11:49:15 EDT 2010
Hi,
While testing Scipy's weave on several different Windows installations, I came
across some problems with spaces in paths that often prevent weave from working.
I can see a change that could probably get weave working on most Windows
installations, but it is a quick hack. Someone knowledgeable about distutils
(and numpy.distutils?) might be able to help me fix this properly. Below I
describe three common problems with weave on Windows, in the hope that this
information helps others, or allows someone to suggest how to fix the spaces-in-
paths problem properly.
I think there are three common problems that stop weave from working on Windows.
The first is not having a C compiler. Both Python(x,y) and EPD provide a C
compiler that seems to work fine, which is great!
The second problem is that if weave is installed to a location with a space in
the path, linking fails. There is already a scipy bug report about this
(http://projects.scipy.org/scipy/ticket/809). I've just commented on that
report, saying the problem appears to be with distutils, and there is already a
Python bug report about it (http://bugs.python.org/issue4508). Maybe someone
could close this scipy bug, or link it to the Python one somehow? In any case,
when using Python(x,y) or EPD, this bug will not show up if the default
installation locations are accepted. So, that's also good news!
The third problem is that if the Windows user name has a space in it (which in
my experience is quite common), compilation fails. Weave uses the user name to
create a path for its "intermediate" and "compiled" files. When the compilation
command is issued, the path with the space in it is also not quoted. Presumably
that is another error in distutils (or numpy.distutils)? Unfortunately I wasn't
able to pinpoint what function is failing to quote strings properly, because I
couldn't figure out the chain that leads to the compiler being called. However,
I can avoid the problem by removing spaces from the user name in weave itself
(catalog.py):
def whoami():
"""return a string identifying the user."""
return (os.environ.get("USER") or os.environ.get("USERNAME") or
"unknown").replace(" ","")
(where I have added .replace(" ","") to the existing code).
I realize this isn't the right solution, so if someone could help to guide me to
the point where quoting should occur, that would be very helpful. Otherwise, is
there any chance of applying a hack like this so weave can work reliably on
Windows?
Thanks,
Chris
More information about the SciPy-Dev
mailing list