skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.43k stars 213 forks source link

sgp4 is an unlisted dependency #135

Closed DFEvans closed 5 years ago

DFEvans commented 7 years ago

The website/readme gives the impression that the only dependency is numpy, although some astropy features can be used. However, it seems that the package sgp4 is required - from skyfield.api import load will fail with the following: File "/home/devans/.local/lib/python2.7/site-packages/skyfield/sgp4lib.py", line 4, in <module> from sgp4.earth_gravity import wgs72 ImportError: No module named sgp4.earth_gravity

I don't know if there are meant to be ways to use skyfield without sgp4, but certainly all of the example code requires skyfield.api.load to work.

oefe commented 7 years ago

It says that numpy the only binary dependency. sgp4 and jplephem are pure python packages.

When using pip, these low level packages by the same author are automatically installed (see setup.py).

brandon-rhodes commented 7 years ago

Yes, @oefe is correct — Skyfield’s pure Python dependencies like sgp4lib should be installed automatically and without needing any compilation when Skyfield is installed by pip. @Dannei, could you show us the command you used to install Skyfield and show us its output? It's possible that it ran into an error and did not complete the install, if a dependency like sgp4lib is missing.

DFEvans commented 7 years ago

This isn't a pip issue, as my install was not done through pip. My university supplied computer doesn't allow user access to e.g. apt-get or pip (I'm not sure pip is even available), so I installed the package manually as a user-only install. Therefore the only way to pick up on dependencies is to have them listed, or to start deciphering error messages, hence my original comment/request.

Regards, Daniel

On 24 May 2017 6:58 a.m., "Brandon Rhodes" notifications@github.com wrote:

Yes, @oefe https://github.com/oefe is correct — Skyfield’s pure Python dependencies like sgp4lib should be installed automatically and without needing any compilation when Skyfield is installed by pip. @Dannei https://github.com/dannei, could you show us the command you used to install Skyfield and show us its output? It's possible that it ran into an error and did not complete the install, if a dependency like sgp4lib is missing.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/skyfielders/python-skyfield/issues/135#issuecomment-303623314, or mute the thread https://github.com/notifications/unsubscribe-auth/AbTDqBDg-U9mmVzMiXVDXQquBx5JlzxCks5r88NegaJpZM4NX1An .

brandon-rhodes commented 7 years ago

@Dannei — Understood! I had forgotten that there would be users without access to the standard install toolchain.

When a user needs to install Skyfield by hand, I should add the suggestion that they read this clause from the setup.py file:

    install_requires=[
        'jplephem>=2.3',
        'numpy',
        'sgp4>=1.4',
        ],

which is the official list of packages that Skyfield needs to operate. Where could I document this so that, in the future, folks installing by hand will be sent to look at the right file to learn the dependency list? Is it the main README up at the top of this repository that you were following? Or was it the online docs on the web, and I should put it there?

Thanks for letting me know that my docs need to point this out!

(Sorry for my high response time; I'm still catching up after PyCon!)

DFEvans commented 7 years ago

No worries - I know my case is quite niche!

I would put a mention in both the docs and the README - it never hurts to tell people twice, right? I would usually look at both, although the README does already link to the documentation where more detailed instructions usually exist.

Daniel

On 18 June 2017 at 16:14, Brandon Rhodes notifications@github.com wrote:

@Dannei https://github.com/dannei — Understood! I had forgotten that there would be users without access to the standard install toolchain.

When a user needs to install Skyfield by hand, I should add the suggestion that they read this clause from the setup.py file:

install_requires=[
    'jplephem>=2.3',
    'numpy',
    'sgp4>=1.4',
    ],

which is the official list of packages that Skyfield needs to operate. Where could I document this so that, in the future, folks installing by hand will be sent to look at the right file to learn the dependency list? Is it the main README up at the top of this repository that you were following? Or was it the online docs on the web, and I should put it there?

Thanks for letting me know that my docs need to point this out!

(Sorry for my high response time; I'm still catching up after PyCon!)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/skyfielders/python-skyfield/issues/135#issuecomment-309283498, or mute the thread https://github.com/notifications/unsubscribe-auth/AbTDqBoQVcCSn_qKjMETJPUrJozpOGo6ks5sFT7ogaJpZM4NX1An .

gerritholl commented 5 years ago

conda install skyfield omits the installation of both jplephem and sgp4.

brandon-rhodes commented 5 years ago

Wow, Skyfield can be installed through conda now? I probably won't be able to investigate until after PyLondinium next weekend, but let me re-open this so I can take a look at the situation and see if they have registered Skyfield's dependencies correctly.

brandon-rhodes commented 5 years ago

@gerritholl I now have time to look into this! I am not able to install skyfield through conda, though:

$ conda install skyfield                                    master  (tmp) 
Fetching package metadata ...........

PackageNotFoundError: Packages missing in current channels:

  - skyfield

We have searched for the packages in the following channels:

  - https://repo.continuum.io/pkgs/main/linux-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/linux-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/linux-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/linux-64
  - https://repo.continuum.io/pkgs/pro/noarch

Could you double-check how you were able to install it?

gerritholl commented 5 years ago

I got it through the conda-forge channel https://anaconda.org/search?q=skyfield

brandon-rhodes commented 5 years ago

Thanks for the link, that got me going! And now I'm befuddled. Why does conda install -c conda-forge skyfield want to install astropy and beautifulsoup4 and lxml when I so carefully crafted my library to not need any binary dependencies beyond NumPy!?

And why doesn't it include dependencies from setup.py?

I wonder if I have any contacts over in conda-land that I could ping about this. Otherwise one of us will have to go learn their ecosystem ourselves to figure out how it got poorly packaged.

For the record:

The following NEW packages will be INSTALLED:

    astropy:            3.2.1-py36h516909a_0  conda-forge
    atomicwrites:       1.3.0-py_0            conda-forge
    attrs:              19.1.0-py_0           conda-forge
    beautifulsoup4:     4.8.0-py36_0          conda-forge
    html5lib:           1.0.1-py_0            conda-forge
    icu:                64.2-he1b5a44_0       conda-forge
    importlib_metadata: 0.18-py36_0           conda-forge
    libblas:            3.8.0-10_openblas     conda-forge
    libcblas:           3.8.0-10_openblas     conda-forge
    libgfortran-ng:     7.3.0-hdf63c60_0                 
    libiconv:           1.15-h516909a_1005    conda-forge
    liblapack:          3.8.0-10_openblas     conda-forge
    libopenblas:        0.3.6-h6e990d7_4      conda-forge
    libxml2:            2.9.9-hee79883_2      conda-forge
    libxslt:            1.1.32-h31b3aaa_1004  conda-forge
    lxml:               4.3.4-py36h7ec2d77_0  conda-forge
    more-itertools:     7.1.0-py_0            conda-forge
    numpy:              1.16.4-py36h95a1406_0 conda-forge
    openblas:           0.3.6-h6e990d7_4      conda-forge
    packaging:          19.0-py_0             conda-forge
    pluggy:             0.12.0-py_0           conda-forge
    psutil:             5.6.3-py36h516909a_0  conda-forge
    py:                 1.8.0-py_0            conda-forge
    pyparsing:          2.4.1-py_0            conda-forge
    pytest:             5.0.1-py36_1          conda-forge
    pytest-arraydiff:   0.3-py_0              conda-forge
    pytest-astropy:     0.5.0-py_0            conda-forge
    pytest-doctestplus: 0.3.0-py_0            conda-forge
    pytest-openfiles:   0.3.1-py_0            conda-forge
    pytest-remotedata:  0.3.1-py_0            conda-forge
    pytz:               2019.1-py_0           conda-forge
    six:                1.12.0-py36_1000      conda-forge
    skyfield:           1.11-py_0             conda-forge
    soupsieve:          1.9.2-py36_0          conda-forge
    wcwidth:            0.1.7-py_1            conda-forge
    webencodings:       0.5.1-py_1            conda-forge
    zipp:               0.5.1-py_0            conda-forge

Proceed ([y]/n)?
DanielFEvans commented 5 years ago

The conda-forge "recipe" for skyfield lives at: https://github.com/conda-forge/skyfield-feedstock

In particular, the requirements are specified in this file: https://github.com/conda-forge/skyfield-feedstock/blob/master/recipe/meta.yaml

It appears they've had the dependencies on astropy, etc., since they approved the recipe in 2016.

brandon-rhodes commented 5 years ago

After wrestling with the question of whether I should just leave the conda install a "kitchen sink" install with lots of other packages, I finally decided to weigh into the feedstock brawl and see if I can get the dependencies slimmed down to Skyfield's real dependencies. We’ll see what happens.

https://github.com/conda-forge/skyfield-feedstock/pull/29