skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.4k stars 211 forks source link

JPL changed FTP site to https #666

Closed ngnahz closed 2 years ago

ngnahz commented 2 years ago

It seems JPL's FTP was closed and upgraded to https download site. The link ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/ was changed to https://ssd.jpl.nasa.gov/ftp/eph/planets/bsp/ Related files can't be downloaded.

repro steps: Download and install python module "sfalmanac" Run command "python -m sfalmanac" Got the following error: File "C:\Python37\lib\site-packages\sfalmanac__main.py", line 328, in ts = init_sf(spad) # in alma_skyfield File "C:\Python37\lib\site-packages\sfalmanac\lib\alma_skyfield.py", line 98, in init_sf eph = load(config.ephemeris[config.ephndx][0]) # load chosen ephemeris File "C:\Python37\lib\site-packages\skyfield\iokit.py", line 193, in call__ path = self._assure(url, filename, reload, backup) File "C:\Python37\lib\site-packages\skyfield\iokit.py", line 214, in _assure download(url, path, self.verbose, backup=backup) File "C:\Python37\lib\site-packages\skyfield\iokit.py", line 525, in download raise e2 OSError: cannot download ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/de421.bsp because <urlopen error ftp error: TimeoutError

brandon-rhodes commented 2 years ago

I just tested and was able to perform a successful download with both Skyfield and also the manual command:

curl ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/de421.bsp | wc

But you bring up a good question: what if they were to disable the service someday? I'll go see if there's a mailing list I can join so I'd be warned ahead of time!

Meanwhile, you'll probably want to check other possible sources of connectivity problems between you and the JPL servers. Let me know if you find a root cause, in case any other users are affected. I'll close the issue since it's not a Skyfield problem, but I welcome further comments on the closed issue. Thanks!

brandon-rhodes commented 2 years ago

Though — I suppose I could go ahead and switch proactively, couldn't I? Rather than wait until a day when maybe they really take FTP down and downloads break for all users? The only thing that gives me pause is that their official README, updated last December (it says), recommends FTP links for downloading ephermides:

https://ssd.jpl.nasa.gov/planets/eph_export.html

But, looking elsewhere on the site, I do see more recent documents using the new /ftp top-level directory under their HTTPS site. So I'm going to presume that it's official, not temporary, and safe to switch to.

This could break Skyfield for users without the right certificates installed, but given that it protects against TCP hijacking, and future-proofs against the possibility of the FTP service going down, I'm going to try making the change. I can always back it out before the next release if I realize there's a severe downside.

ngnahz commented 2 years ago

My friends and I tried to connect the ftp directly but we can't even ping through... Meanwhile, the https site alway work on our machines. Thanks for the quick fix:)

yangyang-studio commented 2 years ago

Unable to download (Windows 10)

mmexport1638251385773

JamesRRitter commented 11 months ago

With de421.bsp loaded via pip, the statement load('de421.bsp') in Python seemed to work only near the beginning of my program. This was before other loads in the program. I note this result but have no explanation for it.

brandon-rhodes commented 11 months ago

@JamesRRitter — What is the traceback when an error is displayed?

JamesRRitter commented 11 months ago

Brandon Rhodes:

Amazing!! I was just trying to save others the time that I lost trying to untangle the symptoms described below. Thanks for your response!

When the load operation is near the beginning of my program, the program operates as expected. The beginning of the program is:

def main(): pass

if name == 'main': main() from skyfield.api import EarthSatellite, Topos, load from Skyfield_Support import * from skyfield import almanac from skyfield.api import wgs84 from skyfield.framelib import itrs from StarShip_20230526 import GetTLE

It appears that the load of de421.bsp must be early in the program!!

eph = load('de421.bsp')

When the load operation is in the main program with no other explicit load operations in the program, the following traceback results:

Traceback (most recent call last): File "C:\Users\Jim\Documents\Python_Source\Python 3\Skyfield_Scratch_20230904.py", line 296, in eph = load('de421.bsp') ^^^^^^^^^^^^^^^^^ File "C:\Users\Ritte_2dotfhr\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\lib\npyio.py", line 438, in load raise ValueError("Cannot load file containing pickled data " ValueError: Cannot load file containing pickled data when allow_pickle=False

From: Brandon Rhodes @.> Sent: Monday, October 2, 2023 1607 To: skyfielders/python-skyfield @.> Cc: JamesRRitter @.>; Mention @.> Subject: Re: [skyfielders/python-skyfield] JPL changed FTP site to https (Issue #666)

@JamesRRitterhttps://github.com/JamesRRitter - What is the traceback when an error is displayed?

- Reply to this email directly, view it on GitHubhttps://github.com/skyfielders/python-skyfield/issues/666#issuecomment-1743766679, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BC34DCWZMXOUE5W3KQ3EKPDX5MUHLAVCNFSM5I3DVSVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZUGM3TMNRWG44Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

brandon-rhodes commented 11 months ago

File "C:\Users\Ritte_2dotfhr\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\lib\npyio.py", line 438, in load

It looks like you are calling the NumPy load() routine instead of Skyfield's. Maybe you have a line like this in your program?

from numpy import load
JamesRRitter commented 11 months ago

Brandon Rhodes:

            Indeed, buried two import levels down, the following appears:

                            from numpy import *

            Thanks again!!

From: Brandon Rhodes @.> Sent: Monday, October 2, 2023 1754 To: skyfielders/python-skyfield @.> Cc: JamesRRitter @.>; Mention @.> Subject: Re: [skyfielders/python-skyfield] JPL changed FTP site to https (Issue #666)

File "C:\Users\Ritte_2dotfhr\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\lib\npyio.py", line 438, in load

It looks like you are calling the NumPy load() routine instead of Skyfield's. Maybe you have a line like this in your program?

from numpy import load

- Reply to this email directly, view it on GitHubhttps://github.com/skyfielders/python-skyfield/issues/666#issuecomment-1743882070, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BC34DCR5EYZZDQ32XB23G5DX5NAXRAVCNFSM5I3DVSVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZUGM4DQMRQG4YA. You are receiving this because you were mentioned.Message ID: @.**@.>>