[AstroPy] pywcs 1.10-4.7 install failure on Microsoft Windows

Jim Vickroy jim.vickroy@noaa....
Tue Jan 3 10:32:46 CST 2012

On 1/3/2012 8:30 AM, Michael Droettboom wrote:
> On 01/03/2012 09:21 AM, Jim Vickroy wrote:
>> On 1/3/2012 6:33 AM, Michael Droettboom wrote:
>>> My apologies that this isn't working for you -- I don't have access to
>>> Visual Studio 9.0 to test with, so these sorts of things can fall
>>> through the cracks.
>>> Mark is right that the old solution involved patching wcslib before
>>> shipping it with pywcs.
>>> However, as of version 1.10 (which you are using), the solution was to add:
>>>        #define wcsset wcsset_
>>> on Windows.  This works with the mingw32/cygwin compiler, but apparently
>>> failing on the Microsoft compiler.
>>> There is an even newer solution in pywcs SVN which defines the following
>>> on Windows.  This I believe to work on the Microsoft compilers based on
>>> the report of another user:
>>> if sys.platform == 'win32':
>>>         define_macros.append(('YY_NO_UNISTD_H', None))
>>>         define_macros.append(('_CRT_SECURE_NO_WARNINGS', None))
>>>         define_macros.append(('_NO_OLDNAMES', None)) # for mingw32
>>>         define_macros.append(('NO_OLDNAMES', None)) # for mingw64
>>> You can either splice this into your current copy of setup.py, or build
>>> from SVN.  Note that building from SVN currently requires having parts
>>> of stsci_python installed (notable stsci.tools.stsci_distutils_hack).
>>> Mike
>> Thanks, Mike.
>> Could you elaborate on the above patch?  Do I need to import something
>> other than sys?  Where is define_macros defined?
> Of course -- first day back and I'm whipping through e-mail too quickly ;)
> This goes in defsetup.py -- there is already an "if sys.platform ==
> 'win32'" clause -- you would just need to add the "OLDNAMES" lines to it.
> Mike
> _______________________________________________
> AstroPy mailing list
> AstroPy@scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy

I added the OLDNAMES lines as above and here is the result:

C:\Projects\pywcs-1.10-4.7>setup.py install
running install
running build
running build_py
copying lib\svn_version.py -> build\lib.win32-2.6\pywcs
running build_ext
building 'pywcs._pywcs' extension
c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo 
DEBUG -IC:\Python26\lib\site-packages\numpy\core\include -I.\wcslib\C 
-Iwcslib\C -I.\src -IC:\Python26\include -IC:\Python26\PC 
.\wcslib\C\wcs.h(1396) : warning C4030: first formal parameter list 
longer than the second list
.\wcslib\C\wcs.h(1396) : warning C4028: formal parameter 1 different 
from declaration
.\wcslib\C\wcs.h(1396) : error C2040: 'wcsset' : 'int (wcsprm *)' 
differs in levels of indirection from 'int (wcsprm *)'
error: command '"c:\Program Files\Microsoft Visual Studio 
9.0\VC\BIN\cl.exe"' failed with exit status 2


More information about the AstroPy mailing list