Install & Compatibility
Where this runs
tested against v0.0.22 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.1MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 22MB
20MB installed
● package 20MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
interfaces
✓ from netifaces import interfaces
✗ import netifaces2
AF_INET
✓ from netifaces import AF_INET
✗ import netifaces2
gateways
✓ from netifaces import gateways
✗ import netifaces2
This example demonstrates how to list all network interfaces and retrieve their IPv4, IPv6, and MAC addresses using `netifaces2`.
import netifaces2
print(f"All interfaces: {netifaces2.interfaces()}")
for i in netifaces2.interfaces():
print(f"\nInterface: {i}")
addrs = netifaces2.ifaddresses(i)
if netifaces2.AF_INET in addrs:
for link in addrs[netifaces2.AF_INET]:
print(f" IPv4: {link.get('addr')}")
if netifaces2.AF_INET6 in addrs:
for link in addrs[netifaces2.AF_INET6]:
print(f" IPv6: {link.get('addr')}")
if netifaces2.AF_LINK in addrs:
for link in addrs[netifaces2.AF_LINK]:
print(f" MAC: {link.get('addr')}")
Debug
Known issues
gotchaUsers migrating from the original `netifaces` library might mistakenly install or import `netifaces` instead of `netifaces2`. These are distinct packages, and `netifaces2` is the actively maintained fork.fixAlways use `pip install netifaces2` and `import netifaces2` in your code.
affects: All
gotchaOn Windows, prior to version 0.0.22, users might encounter stability issues, including potential unbounded memory allocations, particularly on complex network setups.fixEnsure you are running netifaces2 version 0.0.22 or newer for improved Windows stability by running `pip install --upgrade netifaces2`. Report specific issues to the GitHub repository.
affects: <0.0.22 (Windows only)
gotchaNetwork interface names can vary significantly across operating systems (e.g., 'eth0', 'en0', 'Local Area Connection'). Hardcoding interface names can lead to non-portable code.fixUse `netifaces2.interfaces()` to dynamically get a list of available interfaces and iterate through them, or use platform-specific logic to resolve common interface names.
affects: All
Upgrade
Version history
0.0.22latest on PyPI · released Feb 28, 2024
Audit
Dependencies
No dependency data recorded yet.