Install & Compatibility
Where this runs
tested against v0.12.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
netifaces
✓ import netifaces
✗ import netifaces_plus
The library name in PyPI is 'netifaces-plus' but the import package is 'netifaces'. Do not use the hyphenated name.
interfaces
✓ netifaces.interfaces()
✗ netifaces.networks()
The function to list interface names is `interfaces()`, not `networks()`.
gateways
✓ netifaces.gateways()
✗ netifaces.default_gateway()
`gateways()` is a top-level function returning all gateway info. There is no `default_gateway()`.
Basic usage: list interfaces, get addresses for first interface, and show gateways.
import netifaces
# List all network interface names
ifaces = netifaces.interfaces()
print('Interfaces:', ifaces)
# Get addresses for a specific interface (e.g., 'eth0' or 'en0')
if ifaces:
iface = ifaces[0]
addrs = netifaces.ifaddresses(iface)
print(f'Addresses for {iface}:', addrs)
# Get default gateways
print('Gateways:', netifaces.gateways())
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'netifaces_plus'
User tried to import the package with the PyPI name (netifaces-plus) as the module name.
fixUse 'import netifaces' instead of 'import netifaces_plus'.
AttributeError: module 'netifaces' has no attribute 'interfaces'
The module might not be the real netifaces-plus (perhaps a stale or different package).
fixEnsure you installed netifaces-plus (not netifaces) and check the version: `pip show netifaces-plus`.
KeyError: 2 (or AF_INET not found)
The interface does not have an IPv4 address (e.g., no IP assigned).
fixCheck with `if netifaces.AF_INET in addrs` before accessing addrs[netifaces.AF_INET].
Upgrade
Version history
0.12.5latest on PyPI · released Nov 1, 2025
Audit
Dependencies
No dependency data recorded yet.