{"library":"pyswisseph","title":"PySwissEphe - Swiss Ephemeris","description":"PySwissEphe is a Python extension providing access to the powerful Swiss Ephemeris library, a high-precision astronomical calculation engine. It allows for calculation of planetary positions, houses, aspects, and other celestial data. Currently at version 2.10.3.2, the library maintains a steady release cadence, often updating to reflect new versions of the underlying Swiss Ephemeris C code.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyswisseph"],"cli":null},"imports":["import swisseph as swe"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import swisseph as swe\nimport os\n\n# IMPORTANT: For accurate calculations, you need to download the Swiss Ephemeris\n# data files (e.g., 'se1900-2050.se1', 'seasr.se1') from the official website\n# (www.astro.com/swisseph/sweph_e.htm) and place them in a directory.\n# For this example, we create an empty 'swefiles' directory in the current\n# working directory. Calculations will fail or return errors without the actual files.\n\nephe_dir = 'swefiles'\nif not os.path.exists(ephe_dir):\n    os.makedirs(ephe_dir)\n    print(f\"Created directory '{ephe_dir}'. Please populate it with Swiss Ephemeris data files.\")\n\n# Set the path to the ephemeris data files\nswe.swe_set_ephe_path(ephe_dir)\n\n# Define a Julian Day (UT - Universal Time) for calculation\n# January 1, 2024, 12:00 UT\njd_ut = swe.swe_julday(2024, 1, 1, 12.0, swe.SE_GREG_CAL)\n\n# Define calculation flags: use default Swiss Ephemeris, calculate speed\nflags = swe.SEFLG_SWIEPH | swe.SEFLG_SPEED\n\n# Calculate Mars' position (SE_MARS)\n# xx will contain: [longitude, latitude, distance, speed_longitude, speed_latitude, speed_distance]\nxx, ret = swe.swe_calc_ut(jd_ut, swe.SE_MARS, flags)\n\nif ret >= 0:\n    print(f\"Mars' position on 2024-01-01 12:00 UT:\")\n    print(f\"  Longitude: {xx[0]:.4f}°\")\n    print(f\"  Latitude:  {xx[1]:.4f}°\")\n    print(f\"  Distance:  {xx[2]:.4f} AU\")\n    print(f\"  Speed Longitude: {xx[3]:.4f}°/day\")\nelse:\n    print(f\"Error calculating Mars' position. Make sure '{ephe_dir}' contains required '.se1' files.\")\n    print(f\"Swiss Ephemeris error: {swe.swe_get_serr_string(ret)}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize PySwissEphe, set the ephemeris data path, and calculate a planet's position. Note that accurate calculations require downloading Swiss Ephemeris data files (.se1) and placing them in the specified `ephe_dir`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"2.10.3.2","pypi_latest":"2.10.3.2","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":60,"avg_install_s":1.8,"avg_import_s":0,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyswisseph","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"24.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyswisseph","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0,"mem_mb":0.1,"disk_size":"23M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyswisseph","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"26.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyswisseph","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0,"mem_mb":0.3,"disk_size":"25M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyswisseph","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyswisseph","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.8,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyswisseph","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyswisseph","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.5,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyswisseph","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"24.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyswisseph","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0,"mem_mb":0.1,"disk_size":"22M"}]}}