Brian Thorne <hardb...@gmail.com> added the comment:

Comments on the SciPy-Dev mailing list:

>>>
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).
<<<

>>>
As well as that, I have another problem on another computer (which I
don't have access to right now) where I have a user name with a space in
it, and that causes several problems (although I think these problems
are the fault of distutils and nothing to do with scipy). I found a way
to work around that though by changing the environment variable for
USERNAME from "Dan Goodman" to "DanGoo~1".
<<<

>>>
Unfortunately, it is still often necessary to patch weave to get it to work on 
Windows. If a Windows user name includes a space, Weave tries to use paths with 
spaces for its "intermediate" and "compiled" files. I have no idea if this is a 
problem with distutils (not quoting strings correctly), or if Weave itself 
should do something different, but I myself hack weave installations on Windows.
<<<

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4508>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to