Problems with astropy.wcs and Scamp / TPV

Astropy’s WCS functions are not properly transforming from RA/Dec to image coordinates. I have two images of the same field, but offset by ~10ish pixels each in x and y. If I use ds9 and tell it to align the images by a WCS created with scamp (aligning to the Gaia catalog), the stars line up very well. (Centroids of stars show the same RA and Dec to much better than a pixel.) However, if I convert the RA/Dec to x and y using astropy, the position it gives me on one image is visibly off by a pixel or more, whereas it’s lined up on the other image (the one where I found the star in the first place).

My suspicion is that astropy is not handling TPV distortions correctly. I’m using astropy 5.1 installed just a few minutes ago from PyPI.

The images I’m using have a WCS created by scamp, with CTYPE1 and CTYPE2 equal to ‘RA–TPV’ and ‘DEC-TPV’. What I’ve read suggests that astropy should properly handle this, but that it needs to be compiled with wcslib.

Is the astropy that comes from PyPi compiled with wcslib? Is there a way i can check if the astropy that I’m using is properly compiled with wcslib and supports TPV?

The reason I suspect it’s not getting the right WCS from the header is that if I just print the WCS, it tells me that the CTYPE1 is ‘RA–TAN’:

>>> f[0].header['CTYPE1']
'RA---TPV'
>>> wcs = WCS(f[0].header)
>>> wcs
WCS Keywords

Number of WCS axes: 2
CTYPE : 'RA---TAN'  'DEC--TAN'  
CRVAL : 270.8910025612  -29.53460421215  
CRPIX : 11168.8  8437.0  
CD1_1 CD1_2  : -1.869209278298e-07  7.285681803276e-05  
CD2_1 CD2_2  : -7.285593827158e-05  -1.777778364502e-07  
NAXIS : 2048  4096