Getting started

Requirements

poliastro requires a number of Python packages, notably:

  • Astropy, for physical units and time handling
  • NumPy, for basic numerical routines
  • jplephem, for the planetary ephemerides using SPICE kernels
  • matplotlib, for static orbit plotting
  • numba (when using CPython), for accelerating the code
  • Plotly, for interactive orbit plotting
  • SciPy, for root finding and numerical propagation

poliastro is usually tested on Linux and Windows on Python 3.6, 3.7 and 3.8 against latest NumPy. It should work on OS X without problems.

Installation

The easiest and fastest way to get the package up and running is to install poliastro using conda:

$ conda install poliastro --channel conda-forge

Note

We encourage users to use conda and the conda-forge packages for convenience, especially when developing on Windows.

If the installation fails for any reason, please open an issue in the issue tracker.

Alternative installation methods

If you don’t want to use conda you can install poliastro from PyPI using pip:

$ pip install numpy  # Run this one first for pip 9 and older!
$ pip install poliastro[jupyter] pytest

Finally, you can also install the latest development version of poliastro directly from GitHub:

$ pip install https://github.com/poliastro/poliastro/archive/master.zip

This is useful if there is some feature that you want to try, but we did not release it yet as a stable version. Although you might find some unpolished details, these development installations should work without problems. If you find any, please open an issue in the issue tracker.

Warning

It is recommended that you never ever use sudo with distutils, pip, setuptools and friends in Linux because you might seriously break your system [1][2][3][4]. Options are per user directories, virtualenv or local installations.

Using poliastro on JupyterLab

After the release of Plotly 3.0, plotting orbits using poliastro is easier than ever.

You have to install three extensions of JupyterLab to make your experience smooth:

$ jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.38
$ jupyter labextension install plotlywidget@0.7.0
$ jupyter labextension install @jupyterlab/plotly-extension@0.18.1

And as the documentation of JupyterLab Extensions states:

“In order to install JupyterLab extensions, you need to have Node.js version 4 or later installed.”

If you face any further issues, you can refer to the installation guide by Plotly.

Testing

If you want to test poliastro after installing it, you should also install pytest with either conda install pytest or pip install pytest. Then you can run the tests to verify everything is working:

$ python -c "import poliastro.testing; poliastro.testing.test()"
===================================== test session starts =====================================
platform linux -- Python 3.7.1, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /home/juanlu/.miniconda36/envs/_test37/lib/python3.7/site-packages/poliastro, inifile:
collected 747 items
[...]
========= 738 passed, 3 skipped, 5 xfailed, 1 xpassed, 13 warnings in 392.12 seconds ==========
$

If for some reason any test fails, please report it with details of your environment in the issue tracker.