ping3
A pure python3 version of ICMP ping implementation using raw socket.
What it is and what it does
Ping3 is a pure Python implementation of ICMP ping that uses raw sockets to send echo requests and measure network latency. It works with both IPv4 and IPv6 addresses, supports custom timeouts, packet sizes, TTL values, and source addresses or interfaces. The package offers both a programmatic API (ping and verbose_ping functions) and a command-line tool.
The main use case is network diagnostics and connectivity testing from within Python applications without spawning external ping processes. It returns the round-trip delay as a float, False when a host cannot be resolved, or None on timeout. Optional DEBUG and EXCEPTIONS modes provide detailed packet inspection or exception-based error handling instead of return values.
Use it for:
- Check if a remote host is reachable and measure latency before attempting a connection.
- Monitor network connectivity in a background service or health-check daemon.
- Diagnose network issues by pinging multiple hosts with custom timeouts and TTL values.
- Build a network topology or reachability map by pinging a range of IP addresses.
- Test IPv6 connectivity explicitly or auto-detect the appropriate protocol version.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Ping3 sends ICMP echo requests to hosts and measures round-trip time using raw sockets, returning latency in seconds or milliseconds or None on timeout.
Yes, if you need ICMP ping from Python and can work with the privilege requirement. The package is stable, actively maintained, has no external dependencies, and carries permissive licensing. It is well-suited for network diagnostics and connectivity checks in applications or scripts. The main gotcha is that most platforms require root or administrator privileges to send raw ICMP packets.
Install
ping3 on PyPI
pip
pip install ping3uv
uv add ping3poetry
poetry add ping3Installing ping3
Before you install
Low install friction with no runtime dependencies. Active maintenance with recent commits and a stable release history since 2017. Requires Python 3.5 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations, making it safe for commercial and private projects.
Quickstart
pip install ping3
from ping3 import ping
delay = ping('example.com') # Returns delay in seconds, False if host unknown, None if timeout
print(delay)
On most platforms, sending ICMP packets requires root or administrator privileges; some systems may need `sudo ping3` or equivalent elevated permissions.
Verify before relying
- Whether the package works reliably across Windows, macOS, and Linux without platform-specific workarounds beyond privilege requirements.
- Performance characteristics when pinging many hosts concurrently or in rapid succession.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 369 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 786,264/month — #5,067 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ping3-5.1.5-py3-none-any.whl
Keywords: python3, ping, icmp, socket, tool
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
aiopingaioping provides an asyncio-based ICMP ping…
copyleft · top 15,000 on PyPI
pingparsingExecutes and parses ping command output,…
permissive · top 15,000 on PyPI
pythonpingSends ICMP ping requests to remote hosts from…
permissive · top 15,000 on PyPI
icmplibicmplib provides a pure Python implementation…
copyleft · top 5,000 on PyPI
speedtest-cliCommand-line tool that measures internet…
permissive · top 15,000 on PyPI
multipingMultiPing sends ICMP echo requests (pings) to…
permissive · top 15,000 on PyPI
inputimeoutProvides cross-platform standard input with a…
permissive · top 5,000 on PyPI
mcstatusQueries Minecraft servers (Java, Legacy, and…
permissive · top 15,000 on PyPI
ipaddressProvides IPv4 and IPv6 address manipulation for…
permissive · top 5,000 on PyPI
IP2LocationLooks up geolocation data (country, region,…
permissive · top 15,000 on PyPI