skillfed

ephem

Compute positions of the planets and stars

ephem v4.2.1 1.6M downloads/30d#3,754 on PyPI893
Permissive license MIT Active released

What it is and what it does

PyEphem is a Python wrapper around high-precision C-based astronomy computation routines originally from the XEphem application. It lets you compute where celestial objects appear in the sky from any location on Earth at any date, handling the complex orbital mechanics and coordinate transformations automatically. The package represents planets, moons, stars, comets, and asteroids as Python objects, and automatically formats dates and angles in standard astronomical notation.

Typical use involves creating an observer object with a location (longitude, latitude, altitude), creating or loading a celestial body (planets and major moons are built-in, or you can supply orbital elements), computing its position for a specific date, and reading off coordinates like right ascension and declination. The package also handles rise/transit/set times, Moon phases, equinoxes, solstices, coordinate system conversions, and includes a database of 122 world cities for convenience.

Use it for:

  • Determine when and where to observe a planet or comet from a specific location on a given night
  • Calculate the Moon's phase and position for calendar or astronomical applications
  • Track Earth-orbiting satellites using TLE orbital data
  • Find the dates of equinoxes, solstices, and lunar phases for a calendar year
  • Convert between equatorial, ecliptic, and galactic coordinate systems for star catalogs
  • Compute atmospheric refraction corrections for objects near the horizon

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyEphem computes high-precision positions of planets, moons, stars, comets, and asteroids in the sky for any observer location and date, using C-based numeric routines from the XEphem astronomy application.

Yes. PyEphem is a mature, actively maintained library with no known vulnerabilities, a permissive MIT license, and broad platform support via pre-built wheels. Install friction is moderate but manageable. It is the standard choice for Python-based high-precision astronomy calculations and is well-suited for anyone building observational astronomy, planetarium, or satellite-tracking tools.

Install

ephem on PyPI

pip

pip install ephem

uv

uv add ephem

poetry

poetry add ephem

Installing ephem

Before you install

Medium install friction due to C extension compilation, but pre-built wheels cover most modern Python versions and platforms. The package is actively maintained with recent commits and has been stable since its 2008 release.

License in practice

MIT license is permissive; you can use, modify, and distribute PyEphem freely in commercial or private projects with minimal restrictions.

Quickstart

pip install ephem

import ephem
mars = ephem.Mars()
mars.compute('2008/1/1')
print(mars.ra)  # prints 5:59:27.35
print(mars.dec)  # prints 26:56:27.4

A C compiler is required if installing from source; pre-built wheels are available for most platforms, eliminating this requirement for standard installations.

Verify before relying

  • Precision level (number of decimal places or arcsecond accuracy) of position computations
  • Performance characteristics for batch computations of many bodies or dates
  • Whether atmospheric refraction compensation works for all observer altitudes

Package facts

License MIT (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 167 days since the last release
Last repo commit
First released
Downloads 1,567,267/month — #3,754 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ephem-4.2.1-cp27-cp27m-manylinux2010_i686.whl; ephem-4.2.1-cp27-cp27m-manylinux2010_x86_64.whl; ephem-4.2.1-cp27-cp27mu-manylinux2010_i686.whl; ephem-4.2.1-cp27-cp27mu-manylinux2010_x86_64.whl; ephem-4.2.1-cp310-cp310-macosx_10_9_x86_64.whl; ephem-4.2.1-cp310-cp310-macosx_11_0_arm64.whl; ephem-4.2.1-cp310-cp310-manylinux2010_i686.manylinux_2_12_i686.manylinux_2_28_i686.whl; ephem-4.2.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; ephem-4.2.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; ephem-4.2.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; ephem-4.2.1-cp310-cp310-musllinux_1_2_aarch64.whl; ephem-4.2.1-cp310-cp310-musllinux_1_2_i686.whl; ephem-4.2.1-cp310-cp310-musllinux_1_2_s390x.whl; ephem-4.2.1-cp310-cp310-musllinux_1_2_x86_64.whl; ephem-4.2.1-cp310-cp310-win32.whl; ephem-4.2.1-cp310-cp310-win_amd64.whl; ephem-4.2.1-cp311-cp311-macosx_10_9_x86_64.whl; ephem-4.2.1-cp311-cp311-macosx_11_0_arm64.whl; ephem-4.2.1-cp311-cp311-manylinux2010_i686.manylinux_2_12_i686.manylinux_2_28_i686.whl; ephem-4.2.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Development Status :: 6 - MatureIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Astronomy

Tags

astronomy position calculationsplanetary ephemeris computationcelestial body coordinatesmoon and planet positionsastronomical observer calculationssatellite orbital elementsstar position lookupephemeris data python
astronomyephemeriscelestial-mechanics

More Astronomy packages