[AstroPy] Strange problem with astropy.coordinates.EarthLocation (OSX)

Christoph Deil deil.christoph at googlemail.com
Wed Oct 30 18:26:48 EDT 2019



> On 30. Oct 2019, at 16:44, Frederic V. Hessman <hessman at astro.physik.uni-goettingen.de> wrote:
> 
> An astropy script I had previously used suddently bombed for no obvious reason.  The core problem was
> 
>>> from astropy import units as u
>>> from astropy.coordinates import EarthLocation
>>> earth = EarthLocation.from_geocentric (0.,0.,0.,u.m)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/coordinates/earth.py", line 253, in from_geocentric
>    return super().__new__(cls, struc, unit, copy=False)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/units/quantity.py", line 379, in __new__
>    value = value.astype(float)
> TypeError: Cannot cast array from dtype([('x', '<f8'), ('y', '<f8'), ('z', '<f8')]) to dtype('float64') according to the rule 'unsafe'
> 
> Tried to find the problem - nothing obvious.  In desperation, I eventually uninstalled and re-installed MacPorts entirely (according to their recipe at https://guide.macports.org/chunked/installing.macports.uninstalling.html), which totally zaps /opt/local, and then _only_ re-installed python3.5 and py35-astropy (and the corresponding other packages needed automatically).  Didn't do any good....
> 
> I bet it's a python problem rather than an astropy problem, but I wouldn't know where to begin since everything else appears to work.  Anybody else encounter such problems?  I'm using Sierra 10.12.6 on a MacBook Pro.
> 
> Rick
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy

Hi Rick,

Likely an issue with an old version of Python, Numpy, Astropy.

Can you update to e.g. Python 3.6 or 3.7?

Even if your macOS version is old, it should be possible with either Macports or Anaconda.

sudo port install py37-astropy

Christoph



More information about the AstroPy mailing list