Changelog¶
8.0.0 (IN DEVELOPMENT)¶
Note
psutil 8.0 introduces breaking API changes. See the migration guide if upgrading from 7.x.
New APIs
#2798, breaking: new
Process.attrsclass attribute, afrozensetof the attribute names accepted byProcess.as_dict()andprocess_iter(). Passingattrs=[]toprocess_iter()to mean “retrieve all attributes” is deprecated. See migration guide.#2776, [Windows], breaking:
virtual_memory()now includescachedandwiredfields.#1541: New
Process.page_faults()method, returning a(minor, major)named tuple.#2780, [Windows]:
disk_usage()now can accept a file path (not only a directory path).#2816, [OpenBSD]:
swap_memory()sinandsoutare no longer set to0.#2977: new
bytes2human()utility function, converting a number of bytes to a human-readable string (e.g.9.8K).#1109, [Linux]:
Process.memory_extras()returns a newlockedfield: locked virtual memory (mlock(2)).#1452, #2993, [Linux, macOS, Windows]:
Process.memory_footprint()returns a newsharedfield: resident memory shared with other processes.
Reorganization of process memory APIs (#2731, #2736, #2733, #2988).
New
Process.memory_extras()method, returning extra platform-specific memory metrics on Linux, macOS and Windows. See migration guide.New
Process.memory_footprint()method, which returnsuss,pssandswapmetrics (whatProcess.memory_full_info()used to return).breaking:
Process.memory_full_info()is deprecated. Use the newProcess.memory_footprint()instead. See migration guide.breaking:
Process.memory_info()named tuple changed on all platforms: fields were added, removed and renamed. Most old names still work but raiseDeprecationWarning; on macOSpfaultsandpageinswere removed with no backward-compatible aliases, useProcess.page_faults()instead. See migration guide.
Type hints and enums
#2753, breaking: Introduce enum classes (
ProcessStatus,ConnectionStatus,ProcessIOPriority,ProcessPriority,ProcessRlimit) grouping related constants. The top-level constants (e.g.STATUS_RUNNING) remain the primary API, and are now aliases for the corresponding enum members. See migration guide.#1946: Add inline type hints to all public APIs in
psutil/__init__.py. Editors and checkers that read inline annotations (pyright, Pylance) pick them up automatically. mypy ignores them until we ship apy.typedmarker, so it still relies on the third-partytypes-psutilstubs. No runtime behavior is changed.#2751: Convert all named tuples from
collections.namedtuple()totyping.NamedTupleclasses with type annotations. This makes the classes self-documenting, effectively turning this module into a readable API reference.
Other API changes
#2992:
Process.memory_percent()result is now rounded to 2 decimal places. It was the only*_percentAPI returning an unrounded float.#2747, breaking: the field order of the named tuple returned by
cpu_times()has been normalized on all platforms, and the first 3 fields are now alwaysuser,system,idle. See migration guide.#2772, [Windows], breaking:
cpu_times()interruptfield renamed toirqto match the field name used on Linux and BSD.interruptstill works but raisesDeprecationWarning.#2784, breaking:
process_iter(): when attrs is specified, the pre-fetched values are now cached on theProcessinstance, so subsequent method calls return them without new system calls. Thep.infodict is deprecated. See migration guide.#2889, [Windows], breaking: 32-bit psutil can no longer inspect 64-bit processes. This relied on the undocumented
NtWow64*APIs and stopped being tested when 32-bit wheels were dropped in 7.1.2 (#2657).Process.cwd()now raisesAccessDeniedin that case;Process.cmdline()andProcess.environ()are unaffected. The opposite direction (64-bit psutil inspecting 32-bit processes) still works.#2754: standardize
sensors_battery()’spercentso that it returns afloatinstead ofinton all systems, not only Linux.#2799:
Process.as_dict()now returns a dict with keys sorted alphabetically when attrs is not specified.#2805, [BSD]: remove
procfsdependency on NetBSD forcpu_stats()andvirtual_memory(); values are now retrieved via thesysctl(9)anduvm(9)kernel APIs instead. (patch by Santhosh Raju)#2947: psutil now emits a
RuntimeWarningwhen it returns incomplete or approximated results due to an unexpected condition (e.g. a sanity check on kernel data which failed). Before, these events were only visible by enabling debug mode via thePSUTIL_DEBUGenvironment variable, so in practice they went unnoticed.
Performance
#2695, [Windows]:
net_io_counters()is ~5x faster.GetAdaptersAddresses()is now invoked once instead of twice, and it skips collecting unicast / anycast / multicast / DNS details, which were retrieved but never used.net_if_stats()andnet_if_addrs()also got faster. (patch by Arman Luthra)#2919, #2920, [Windows]:
Process.threads()is around 25x faster,Process.ppid()andProcess.children()around 3.5x. They no longer snapshot every thread / process on the system withCreateToolhelp32Snapshot, and readNtQuerySystemInformation(SystemProcessInformation)in one shot instead. As a side effectProcess.threads()no longer silently misses the threads which could not be opened due toAccessDenied.#2922, [Windows]:
Process.ppid()is around 58x faster (99x on ARM64). Instead of fetching the whole process table to read one field, the parent PID is now read fromNtQueryInformationProcess(ProcessBasicInformation).#2923, [Windows]:
Process.status()is now part of theProcess.oneshot()group, so within that context (also used byProcess.as_dict()) it no longer costs an extra system-wide query. Reading 4 methods of that group in oneProcess.oneshot()block is now around 3.9x faster than reading them without it, up from 2x.#2932, [Windows]:
Process.open_files()is 140x to 400x faster (from 235 ms to 0.39 ms per call). It no longer enumerates every handle in the system withNtQuerySystemInformation(SystemExtendedHandleInformation), but per-process, viaNtQueryInformationProcess(ProcessHandleInformation), and the ones which are not files are skipped by object type index, before being duplicated. Also, the internal thread used to query handle names is now created once per call instead of once per handle.#2939: syscalls which can potentially block (disk devices, mount points, NIC drivers, etc) now release the GIL. Before, a slow psutil call would freeze all the other threads of the application for its whole duration.
Build and packaging
#2976, [Linux]: publish ppc64le and s390x wheels.
#2788, breaking: git tags renamed from
release-X.Y.ZtovX.Y.Z. Old tags are kept for backward compatibility. See migration guide.#2914, [macOS], breaking: Intel wheels now require macOS 10.15 (Catalina) or higher, up from 10.9. Older versions account for 0.01% of macOS downloads, and they must now build from source.
arm64wheels are unaffected: they already required macOS 11.#2915, breaking: stop publishing wheels for free-threaded CPython 3.13 (
cp313t). Free-threading was experimental in 3.13 and is officially not recommended. Publish onlycp314twheels.#2576: the C extension modules now use PEP 489 multi-phase initialization instead of single-phase, which is the preferred mechanism for extension modules. Runtime behavior is unchanged.
#2765: add a PR bot that uses Claude to summarize PR changes and update
changelog.rstandcredits.rstwhen commenting with /changelog.#2766: remove remaining Python 2.7 compatibility shims from
setup.py, simplifying the build infrastructure.#2844: removed docs/ from tarball. Tarball before: 586K. Tarball now: 396K.
#2883: the platform-specific C extension modules (
_psutil_linux,_psutil_windows, etc.) are now built as a single private module named_psutilon all platforms.#2909:
setup.pyno longer usesdistutils, which was removed from the stdlib in Python 3.12, and only relies onsetuptools.#2925: the C sources are now compiled in parallel, making builds 2x to 3.6x faster. This mostly benefits the platforms getting no wheels from PyPI (*BSD, Solaris, AIX), where
pip install psutilalways compiles. UsePSUTIL_BUILD_JOBSto cap the number of jobs.#2927: python dependencies (
make install-pydeps-*) are now installed withuvwhen available, saving around 10 secs for each CI run.
Documentation
#2757, #2760: split docs from a single HTML file into multiple new sections: /about, /adoption (#2763), /alternatives (#2775), /api-overview, /credits (#2764), /faq (#2769), /funding (#2797), /genindex (#2808), /glossary (#2774), /install, /migration (#2771), /performance (#2787), /platform, /recipes (#2761), /shell-equivalents (#2768), /stdlib-equivalents (#2781). The old
INSTALL.rstandCREDITSfiles, which lived in the root dir, moved there as well.Blog: new blog at /blog (#2825), built via the ablog Sphinx extension, with 20 posts imported from https://gmpy.dev, covering psutil topics from 2014 to 2026. Posts are searchable, have an Atom feed, use OpenGraph for a nice preview when shared on social media, and have a comments section backed by giscus and GitHub Discussions (#2879).
Theming: renewed, modern, custom theme, with a top bar (#2819), a toggable dark theme (#2803,
Shift+D), Monokai code snippets, a “last updated” stamp in the footer and an icon marking external URLs.Usability: right TOC sidebar (#2828), a COPY button on code snippets (#2761), a “copy page” button copying the page’s RsT source (#2981), a “back to top” button, the
psutil.prefix shown for all APIs, and search results styled as cards. Identifiers in code blocks (e.g.psutil.Process(),p.cpu_percent()) are now clickable and link to their API reference entry, via sphinx-codeautolink (#2826). Doc clarity was improved and long sentences shortened (#2745, #2801). New keyboard shortcuts (#2820):?shows the helper,Shift+Dtoggles dark/light mode,Ctrl+Kfocuses the search box,Up/Downnavigate the search results andEnteropens the selected one.Go to API definition: pressing
@on any page opens a menu that fuzzy-matches psutil’s function, class and method names and jumps to their API definition, like in Sublime Text or VS Code (#2995).Testing:
rstcheckwas replaced bysphinx-lint, plus a custom script detecting dead reference links in.rstfiles (#2767). Python code snippets are syntax-checked at build time (#2761). Newmake test-docswith sanity checks for the built HTML docs.Hosting: doc is no longer hosted on Read the Docs. It’s now self-hosted on GitHub Pages under a new domain, https://psutil.io, and URLs no longer carry the
/enlanguage and version prefixes, e.g. https://psutil.io/faq/ (#2790). It’s rebuilt and deployed automatically on every push tomaster(#2739). Past releases are also served, e.g. https://psutil.io/7.2/, with a version selector in the top bar (#2980).Misc: doc is built as part of CI (fails on error), all
.rstfiles are wrapped to 79 characters via https://github.com/giampaolo/rstwrap (#2823), and/sitemap.xmlwas added to help search engine discovery. New custom 404 page (#2829): hovering over the © copyright in the footer reveals an easter egg which takes you there.
Dropped support
#2872, breaking: Dropped support for Python 3.6 and 3.7. Minimum version is now 3.8.
#2893, [Windows], breaking: Dropped support for Windows Vista, 7, 8, 8.1 and their server counterparts. Minimum version is now Windows 10 / Server 2016. See migration guide.
#2936, [Windows], breaking: dropped support for PyPy older than 7.3.14 (December 2023).
#2987, [macOS], breaking: dropped support for macOS 10.7 and 10.8. Minimum version is now 10.9.
Bug fixes: cross-platform
#2793:
process_iter()was silently dropping zombie processes becauseZombieProcess(a subclass ofNoSuchProcess) was caught by the wrongexceptclause. Zombie processes are now yielded correctly.#2895:
Processmethods could wrongly raiseNoSuchProcess(“PID has been reused”) when the process creation time could not be determined, e.g. for zombies on NetBSD / OpenBSD or onAccessDeniedon Windows. An unknown creation time is no longer treated as proof of PID reuse.#2899: two
Processinstances for the same process could compare unequal if the creation time of either one could not be determined. They now compare equal, andhash(Process)is based on the PID alone.
Bug fixes: Linux
#2860, #2966, [Linux], critical:
Process.cpu_affinity()could crash the interpreter with a segfault whenPyLong_FromLong()returned NULL under memory pressure (the NULL is now checked and a properMemoryErroris raised instead), and on Python <= 3.11 it over-decref’ed the CPU numbers it returned, corrupting CPython’s small integer cache.#2857, [Linux], [SunOS], memleak: fix refcount leak in
disk_partitions()(Linux) andproc_environ()(SunOS) whenPyArg_ParseTuplefails: parse arguments before allocating the result container, matching the pattern used in the other 26 call sites. Also fix a copy-paste typo in SunOSproc_environ()where the post-decode NULL check examined the wrong variable (py_envnameinstead ofpy_envval), which could let a NULL value reachPyDict_SetItem.#2628, [Linux]:
cpu_freq()no longer takes offline CPU cores into account. They were reported with all-zero frequencies, which dragged down the averagecurrent,minandmaxvalues.#2715, [Linux]:
wait_pid_pidfd_open()(fromProcess.wait()) crashes withEINVALdue to kernel race condition.#2732, [Linux]:
net_if_stats(): handleEBUSYfromioctl(SIOCETHTOOL).#2770, [Linux]: fix
cpu_count()(logical=False) raisingValueErroron s390x architecture, where/proc/cpuinfouses spaces before the colon separator instead of a tab.#2809, [Linux]:
swap_memory()andvirtual_memory()raiseValueErrorif/proc/meminfocontains a field with no space after the colon, e.g.ShadowCallStack:10373888 kB, which occurs on arm64 when shadow call stacks exceed 10 GB.#2830, [Linux], [macOS], [BSD]:
Process.terminal()returnedNonefor terminals opened after the first call, e.g. a new/dev/pts/Nin a long running daemon. The list of terminal devices was cached forever, and is now refreshed when it doesn’t know a device.#2871, [Linux]:
Process.rlimit()returnedRLIM_INFINITYas the unsigned2**64-1instead of-1on Python 3.15+, which changedresource.prlimit()accordingly. psutil now maps it back topsutil.RLIM_INFINITYso the value stays consistent across Python versions.#2967, [Linux]:
cpu_freq()returnedNoneon ppc machines without cpufreq sysfs. On s390x it matched bothcpu MHz dynamicandcpu MHz static, reporting twice as many CPUs as the machine has.#2512, [Linux]:
cpu_freq()withpercpu=Truereturned one entry per cpufreq policy instead of one per CPU, so on hardware where a policy is shared by several CPUs (POWER9, Apple M1, RISC-V) it reported fewer entries thancpu_count(). Each policy is now asked which CPUs it affects. (patch by Julien Stephan)#2611: re-enable support for Android, which got broken on Python 3.13. Also include a working
disk_partitions()which no longer raisesPermissionError.
Bug fixes: Windows
#1967, [Windows], critical:
Process.open_files()could deadlock the calling process. On timeout, the internal thread querying a handle name was killed withTerminateThread(), which cannot terminate a thread blocked in the kernel (e.g. on a pipe with a pending read) and left locks and memory in an inconsistent state. The thread is now abandoned and cleans up after itself.#2859, [Windows], critical:
net_connections()/Process.net_connections()could crash with an invalidPy_DECREF(NULL)when argument parsing failed before the result list was allocated. The error path now usesPy_XDECREF(including the temporary address-family / socket-type objects).#2847, [Windows], critical:
cpu_stats()read the context switches and syscalls counts from a buffer it had just freed.#2934, [Windows], critical:
Process.memory_maps()could crash the calling process with a stack buffer overflow if the inspected process had a mapped file whose path is longer than 260 characters. The buffer size was passed toGetMappedFileNameW()in bytes instead of characters. Also, such paths are now returned in full instead of truncated.#2937, [Windows], critical:
disk_io_counters()could let a disk driver write past the end of theDISK_PERFORMANCEbuffer. When the driver asked for more space we retried passing a bigger size, but the buffer was a fixed size struct on the stack. It is now allocated (and grown) on the heap.#2943, [Windows], critical:
win_service_iter()could crash the interpreter instead of raising an exception if the service enumeration failed.#2946, [Windows], critical: if the number of process heaps changed while
heap_info()was running, it could read uninitialized memory and return bogusmmap_usedandheap_countvalues.#2972, [Windows], critical: on systems with more than 64 CPUs
cpu_times()withpercpu=Trueandcpu_stats()read uninitialized memory: the kernel only returns entries for the calling thread’s processor group, but the entries for the remaining CPUs were used as well.#2932, [Windows], memleak:
Process.open_files()leaked a thread and a handle for every name query which timed out (e.g. a pipe with a pending read), and could hang for around 1 minute if the process had a file open on an unreachable network share, where theos.stat()used to filter out directories went over the wire with no timeout.#2935, [Windows], memleak:
Process.kill()andProcess.terminate()leaked a process handle whenTerminateProcess()failed with an error other thanERROR_ACCESS_DENIED.#1007, [Windows]:
boot_time()no longer fluctuates by ~1 second across calls or across processes. It is now read atomically from the kernel viaNtQuerySystemInformation(SystemTimeOfDayInformation), replacing the oldtime.time() - uptime()computation that sampled two counters from Python and produced sub-second differences.#1959, [Windows]:
disk_partitions()could raiseUnicodeDecodeErroron systems whose ANSI code page is not UTF-8 (e.g. cp1251). It now uses the wide-char Windows APIs throughout.#2383, [Windows]:
WindowsService.description()may fail withERROR_FILE_NOT_FOUNDwhen the description points at a missing resource (e.g.WaaSMedicSvc), which also brokeWindowsService.as_dict(). Now it returns an empty string instead.#2655, [Windows]:
net_if_stats()returned4294967295(32-bit overflow) as the speed for network interfaces faster than ~4.29 Gbps (e.g. 5 Gbps NICs). Fixed by switching from the legacyGetIfTable()/MIB_IFROWAPI toGetIfEntry2()/MIB_IF_ROW2, which uses a 64-bitTransmitLinkSpeedfield.#2711, #2940, [Windows]:
net_if_addrs()was returningNonefor thebroadcastfield of network interfaces instead of the correct broadcast address, and could report an IPv4netmaskfor an IPv6 address of the same NIC (the netmask was reset once per interface instead of once per address).#2875, [Windows]:
sensors_battery()never returnedPOWER_TIME_UNKNOWNwhen the remaining battery time was unknown; it returned4294967295instead of-1due toBatteryLifeTimebeing passed as an unsigned integer.#2938, [Windows]:
disk_partitions()returned a differentoptsstring for volume mount points than for the drive they live on: the drive type (fixed,cdrom, …) was missing.#2941, [Windows]:
net_io_counters()raisedRuntimeError, losing the counters of all the other NICs, if a NIC was disabled or unplugged mid-call. Now it’s skipped.
Bug fixes: macOS
#2885, [macOS], critical:
Process.memory_full_info(),Process.memory_footprint()andProcess.threads()no longer usetask_for_pid()syscall, which can hang forever on headless VMs (e.g. CI runners). They now useproc_pidinfo(), which is more permissive and so raisesAccessDeniedless often.#2382, [macOS]:
cpu_freq()is now always defined on ARM64 and returnsNonewhen CPU frequency can’t be determined. Previously it was left undefined (or raisedRuntimeError) when thepmgrIORegistry entry or its frequency data was unavailable, e.g. on virtualized ARM64 like CI runners.#2411, [macOS]:
Process.cpu_times()andProcess.cpu_percent()calculation on macOS x86_64 (arm64 is fine) was highly inaccurate (41.67x lower).#2642, [macOS]: fix
cpu_freq()on Apple Silicon. On M4+ it returned values ~1000x too small because thevoltage-statesN-sramIORegistry tables switched from Hz to kHz; on M5-family chips it failed because the hardcoded table indexes were renumbered. The implementation now enumerates CPUvoltage-states*-sramtables dynamically, detects the unit per-value by magnitude, and filters CPU clusters from GPU/NPU tables via a per-table fmax threshold. Works uniformly from M1 through M5 Max. (patch by Bert Pluymers)#2726, [macOS]:
Process.num_ctx_switches()return an unusual high number due to a C type precision issue.#2841, [macOS]:
cpu_freq()could raiseSystemErrorwhen CPU frequency data is missing or invalid in the IORegistry (e.g. on Apple M5 chips). It now returnsNoneinstead (see #2382).#2853, [macOS]:
virtual_memory()andswap_memory()could raiseRuntimeError((ipc/mig) array not large enough) on newer macOS versions.#2854, [macOS]:
Process.cmdline()andProcess.environ()could raiseSystemErroraftersysctl(KERN_PROCARGS2)failed witherrno == 0. They now raiseAccessDeniedinstead.
Bug fixes: BSD
#2744, [NetBSD], critical: fix possible double
free()inswap_memory().#2848, [BSD], critical: fix a stack buffer overflow in
net_io_counters()when the kernel reports an unusually long interface name.#1534, [NetBSD]:
Process.exe()is now fetched natively viasysctl(KERN_PROC_PATHNAME)instead of reading the/proc/pid/exesymlink (a virtualization layer on NetBSD). (patch by Kamil Rytarowski)#1801, [FreeBSD]:
cpu_freq()could raiseUnicodeDecodeErrorwhen thedev.cpu.N.freq_levelssysctl returned bytes which are not valid UTF-8.#2746, [FreeBSD]:
Process.memory_maps(),rssandprivatefields are erroneously reported in memory pages instead of bytes. Other platforms (Linux, macOS, Windows) return bytes.#2782, [FreeBSD]:
cpu_count()logical=Falsereturn None on systems without hyper threading.#2791, [FreeBSD]: relax
psutil_sysctl()/psutil_sysctlbyname()to allow the kernel to return fewer bytes than the buffer (normal for variable-lengthsysctldata).#2795, [FreeBSD]: fix
cpu_freq()failing withRuntimeError: sysctlbyname('dev.cpu.0.freq_levels') size mismatchon some systems.#2811, #2813, [OpenBSD]:
virtual_memory()sharedreturned pages instead of bytes, plus it was overvalued (summed sharedvirtual+real, now we only returnreal).bufferswas always 0, and now returns the same value ascached, since OpenBSD does not distinguish between the 2.#2814, #2815, [NetBSD]:
virtual_memory()cachedis overvalued, since it includes anonymous pages, andsharedwas overvalued (summed sharedvirtual+real, now we only returnreal).#2822, [BSD]:
Process.cmdline()on NetBSD could raiseOSError: [Errno 14] Bad addressif the process about to exit. It now raisesNoSuchProcessinstead.#2888, [FreeBSD], [OpenBSD]:
Processmethods could wrongly raiseNoSuchProcess(“PID has been reused”) for a process still alive, after a system clock update (e.g. NTP). Fixed by disabling the PID reuse check (also on SunOS and AIX).#2902, [NetBSD], [OpenBSD]:
Process.cmdline()could fail withOSError(EINVAL)for a process which died mid-call (OpenBSD), or raise a brokenNoSuchProcesswhosestr()in turn raisedTypeError(NetBSD).#2903, [BSD]:
Process.nice()could raiseNoSuchProcessfor processes inSIDLstate (not yet fully initialized). It now retrieves the nice value viasysctl()instead ofgetpriority().#2905, [FreeBSD], [OpenBSD], [NetBSD]: the
savedfield ofProcess.gids()mistakenly reported the process saved user ID instead of the saved group ID. Bug existed since 2011.#2907, [NetBSD]: a process which is exiting, but is not a zombie yet, was not recognized as such.
Processmethods raisedNoSuchProcessinstead ofZombieProcess, andProcess.status()returned"sleeping"or"?". Also,STATUS_SUSPENDEDwas never returned byProcess.status(), despite being documented as NetBSD only, andProcess.environ()raisedOSErrorwithEINVAL/EFAULT/EBUSYfor a process which is exiting or is a zombie (it now returns an empty dict, or raisesNoSuchProcessif the process is gone).#2929, [NetBSD], [OpenBSD]:
Process.num_fds()returned a wrong, system-wide number which didn’t change when the process opened a file, andProcess.open_files()always returned an empty list.#2951, [OpenBSD]:
cpu_times()returned times averaged across CPUs instead of summed, like on all the other platforms. Now it sums the per-CPU counters.#2952, [OpenBSD]:
Process.environ()raisedOSError(EINVAL)for a process which started exiting, e.g. mid-way to becoming a zombie. Also, for consistency,Process.environ()for a zombie now raisesZombieProcesson all BSDs (NetBSD used to return an empty dict, see #2911).
Bug fixes: UNIX
#2877, [UNIX], critical: fix a one-byte stack buffer overflow in
users(). Whenut_hostfills the whole field it has no null terminator, and the terminator was written one byte past the end of the local buffer.#2789, [AIX], build-fail: fix compilation error caused by a typo (accidental space) in
psutil_net_io_counters(), introduced during a previous code reformatting.#2858, [SunOS], memleak:
disk_io_counters()leaked the result dictionary whenkstat_read()failed mid-iteration; the error path now goes through the existing cleanup block.#2778, [UNIX]:
net_if_addrs()skips interfaces with no addresses, which are typically virtual IPv4/IPv6 tunnel interfaces. Now they are included in the returned dict withfamily==socket.AF_UNSPECand an empty list of addresses. Main reason: it creates an inconsistency withnet_io_counters()andnet_if_stats()which do return these interface names.#2964, [POSIX]:
net_if_addrs()returned the interface’s own address asbroadcastfor/32IPv4 addresses. A single-host network has no broadcast address, soNoneis returned now.#2953, [SunOS]:
Process.gids()returned apuidsnamedtuple instead ofpgids.Process.nice()was offset by +20 compared togetpriority(3).Process.net_connections()returned UNIX sockets withtype=-1andfd=-1. Also,Process.net_connections()now raisesZombieProcessinstead ofRuntimeErrorfor zombie processes.
7.2.2 — 2026-01-28¶
Performance
#2705, [Linux], [macOS], [BSD]:
Process.wait()no longer uses a busy loop. It now usespidfd_open()+poll()on Linux (requires Linux >= 5.3 and Python >= 3.9), andkqueue()on macOS and BSD.
Bug fixes
#2701, [macOS], build-fail: fix compilation error on macOS < 10.7. (patch by Sergey Fedorov)
#2707, [macOS], memleak: fix potential memory leaks in error paths of
Process.memory_full_info()andProcess.threads().#2708, [macOS]:
Process.cmdline()andProcess.environ()may fail withOSError: [Errno 0] Undefined error(fromsysctl(KERN_PROCARGS2)). They now raiseAccessDeniedinstead.
7.2.1 — 2025-12-29¶
Bug fixes
#2699, [FreeBSD], [NetBSD]:
heap_info()does not detect small allocations (<= 1K). In order to fix that, we now flush internal jemalloc cache before fetching the metrics.
7.2.0 — 2025-12-23¶
New APIs
#1275: new
heap_info()andheap_trim()functions, providing direct access to the platform’s native C heap allocator (glibc, mimalloc, libmalloc). Useful to create tools to detect memory leaks.
Build and packaging
#2680, breaking: unit tests are no longer installed / part of the distribution. They now live under
tests/instead ofpsutil/tests, soimport psutil.testsno longer works (it was never documented to begin with).#2403, [Linux]: publish wheels for Linux musl.
Bug fixes
#2684, [FreeBSD], build-fail: compilation fails on FreeBSD 14 due to missing include.
#2691, [Windows], memleak: fix memory leak in
net_if_stats()due to missingPy_CLEAR.
7.1.3 — 2025-11-02¶
Internals
#2667: enforce
clang-formaton all C and header files. It is now the mandatory formatting style for all C sources.#2676, #2678: replace unsafe
sprintf/snprintf/sprintf_swithstr_format, andstrlcat/strlcpywithstr_copy/str_append. Unifies string handling across platforms.
Bug fixes
#2677, [Windows], critical: fix MAC address string construction in
net_if_addrs()(buffer overflow / misformat risk).#2679, [OpenBSD], [NetBSD], build-fail: can’t build due to C syntax error.
#2672, [macOS], [BSD]: increase the chances to recognize zombie processes and raise the appropriate exception (
ZombieProcess).#2674, [Windows]:
disk_usage()could truncate values on 32-bit platforms, potentially reporting incorrecttotal,free,usedspace for drives larger than 4GB.#2675, [macOS]:
Process.status()incorrectly returnsSTATUS_RUNNINGfor 99% of the processes.
7.1.2 — 2025-10-25¶
Build and packaging
#2657, breaking: stop publishing prebuilt Linux and Windows wheels for 32-bit Python. 32-bit CPython is still supported, but psutil must now be built from source.
#2565: produce wheels for free-thread cPython 3.13 and 3.14. (patch by Lysandros Nikolaou)
Bug fixes
#2658, [macOS], critical: double
free()inProcess.environ()when it fails internally. This posed a risk of segfault.#2662, [macOS], critical: massive C code cleanup to guard against possible segfaults which were (not so) sporadically spotted on CI.
#2650, [macOS]:
Process.cmdline()andProcess.environ()may incorrectly raiseNoSuchProcessinstead ofZombieProcess.
7.1.1 — 2025-10-19¶
Internals
#2646, [SunOS]: add CI test runner for SunOS.
Dropped support
#2645, [SunOS], breaking: dropped support for SunOS 10.
Bug fixes
#2641, [SunOS], build-fail: cannot compile psutil from sources due to missing C include.
#2357, [SunOS]:
Process.cmdline()does not handle spaces properly. (patch by Ben Raz)
7.1.0 — 2025-09-17¶
Build and packaging
#2581, [Windows]: publish ARM64 wheels. (patch by Matthieu Darbois)
Internals
#2575: introduced
dprintCLI tool to format .yml and .md files.
Dropped support
#2571, [FreeBSD], breaking: Dropped support for FreeBSD 8 and earlier. FreeBSD 8 was maintained from 2009 to 2013.
Bug fixes
#2545, [SunOS], critical: Fix handling of
MIB2_UDP_ENTRYinnet_connections().#2586, [macOS], critical: fixed different places in C code which can trigger a segfault.
#2610, [macOS], critical: fix
cpu_freq()segfault on ARM architectures.#2473, [macOS], build-fail: Fix build issue on macOS 11 and lower.
#2494, [Windows]:
Process.memory_maps(),Process.exe()andProcess.open_files()now properly handle UNC paths (e.g.\\??\\C:\\Windows\\Temp→C:\\Windows\\Temp). (patch by Ben Peddell)#2506, [Windows]: Windows service APIs had issues with unicode services using special characters in their name.
#2514, [Linux]:
Process.cwd()sometimes fail withFileNotFoundErrordue to a race condition.#2526, [Linux]:
Process.create_time()now uses a monotonic clock, preventingProcess.is_running()from returning wrong results after system clock updates. (patch by Jonathan Kohler)#2528, [Linux]:
Process.children()may raisePermissionError. It will now raiseAccessDeniedinstead.#2540, [macOS]:
boot_time()is off by 45 seconds (C precision issue).#2541, #2570, #2578, [Linux], [macOS], [NetBSD]:
Process.create_time()does not reflect system clock updates.#2542: if system clock is updated
Process.children()andProcess.parent()may not be able to return the right information.#2552, [Windows]:
boot_time()didn’t take into account the time spent during suspend / hibernation.#2560, [Linux]:
Process.memory_maps()may crash withIndexErroron RISCV64 due to a malformed/proc/pid/smapsfile. (patch by Julien Stephan)#2604, [Linux]:
virtual_memory()usedfield does not match recent versions offreeCLI utility. (patch by Isaac K. Ko)#2605, [Linux]:
sensors_battery()reports a negative amount for seconds left.#2607, [Windows]:
WindowsService.description()method may fail withERROR_NOT_FOUND. Now it returns an empty string instead.
7.0.0 — 2025-02-13¶
New APIs
#669, [Windows]:
net_if_addrs()also returns thebroadcastaddress instead ofNone.
API changes
#2490, breaking: remove long deprecated
Process.memory_info_ex()(deprecated since 4.0.0). UseProcess.memory_full_info()instead.
Dropped support
#2480, breaking: drop Python 2.7 support. Latest version supporting it is psutil 6.1.X (
pip2 install psutil==6.1.*).
Bug fixes
#2496, [Linux], critical: Avoid segfault (a cPython bug) on
Process.memory_maps()for processes that use hundreds of GBs of memory.#2502, [macOS]:
virtual_memory()now useshost_statistics64(same asvm_stat), more accurate.
6.1.1 — 2024-12-19¶
Internals
#2471: use Vulture CLI tool to detect dead code.
Bug fixes
#2418, [Linux]: fix race condition in case
/proc/pid/statdoes not exist, but/proc/piddoes, resulting inFileNotFoundError.#2470, [Linux]:
users()may return “localhost” instead of the actual IP address of the user logged in.
6.1.0 — 2024-10-17¶
Performance
#2366, [Windows]: drastically speedup
process_iter()by using process “fast” create time to determine process identity.#2457, [AIX]: significantly improve the speed of
Process.open_files()for some edge cases.
Internals
#2446: use pytest instead of unittest.
#2448: add
make install-sysdepstarget to install the necessary system dependencies (python-dev, gcc, etc.) on all supported UNIX flavors.#2449: add
make install-pydeps-testandmake install-pydeps-devtargets. They can be used to install dependencies meant for running tests and for local development. They can also be installed viapip install .[test]andpip install .[dev].#2456: allow running tests via
python3 -m psutil.testseven ifpytestis not installed.
Bug fixes
#2427, critical: psutil (segfault) on import in the free-threaded (no GIL) version of Python 3.13. (patch by Sam Gross)
#2455, [Linux]:
IndexErrormay occur when reading/proc/pid/statand field 40 (blkio_ticks) is missing.#2460, [OpenBSD]:
Process.num_fds()andProcess.open_files()may fail withNoSuchProcessfor PID 0. Instead, we now return “null” values (0and[]respectively).
6.0.0 — 2024-06-18¶
New APIs
#2396: a new
process_iter.cache_clear()API can be used to clearprocess_iter()internal cache.
API changes
#2109, breaking: the named tuple returned by
disk_partitions()no longer has themaxfileandmaxpathfields (they can be very slow to retrieve on NFS).#2407, breaking: rename
Process.connections()toProcess.net_connections(). Old name still works but is deprecated.
Performance
#2396, breaking:
process_iter()no longer preemptively checks whether PIDs have been reused, making it around 20x faster. UseProcess.is_running()on yielded instances instead (it also removes reused PIDs from the internal cache).
Build and packaging
#2369, [Windows], build-fail: wheels failed to build. Fixed by upgrading
cibuildwheel.#2375, [macOS]: provide arm64 wheels. (patch by Matthieu Darbois)
#2401, Support building with free-threaded CPython 3.13. (patch by Sam Gross)
#2425, [Linux]: provide aarch64 wheels. (patch by Matthieu Darbois / Ben Raz)
Internals
#2366, [Windows]: log debug message when using slower process APIs.
Bug fixes
#2360, [macOS], build-fail: can’t compile on macOS < 10.13. (patch by Ryan Schmidt)
#2362, [macOS], build-fail: can’t compile on macOS 10.11. (patch by Ryan Schmidt)
#2365, [macOS], build-fail: can’t compile on macOS < 10.9. (patch by Ryan Schmidt)
#2412, [macOS], build-fail: can’t compile on macOS 10.4 PowerPC due to missing
MNT_constants.#2250, [NetBSD]:
Process.cmdline()sometimes fail withEBUSYfor long cmdlines. Now retries up to 50 times, returning an empty list as last resort.#2254, [Linux]: offline cpus raise
NotImplementedErrorincpu_freq()(patch by Shade Gladden)#2272: Add pickle support to psutil Exceptions.
#2359, [Windows]:
pid_exists()disagrees withProcesson whether a pid exists whenERROR_ACCESS_DENIED.#2395, [OpenBSD]:
pid_exists()erroneously return True if the argument is a thread ID (TID) instead of a PID (process ID).
5.9.8 — 2024-01-19¶
Performance
#2343, [FreeBSD]: filter
net_connections()in C instead of Python, ~4x faster. Only requested connection types are now retrieved.
Internals
#2349: adopted black formatting style.
Bug fixes
#930, [NetBSD], critical, memleak:
net_connections()implementation was broken. It could either leak memory or core dump.#2345, [Linux], build-fail: fix compilation on older compiler missing
NIC_DUPLEX_UNKNOWN.#2340, [NetBSD]: if process is terminated,
Process.cwd()will return an empty string instead of raisingNoSuchProcess.#2222, [macOS]:
cpu_freq()now returns fixed values forminandmaxfrequencies in all Apple Silicon chips.
5.9.7 — 2023-12-17¶
Internals
#2324: enforce Ruff rule
raw-string-in-exception, which helps providing clearer tracebacks when exceptions are raised by psutil.
Bug fixes
5.9.6 — 2023-10-15¶
API changes
#1703:
cpu_percent()andcpu_times_percent()are now thread safe.#2266: if
Processclass is passed a very high PID, raiseNoSuchProcessinstead ofOverflowError. (patch by Xuehai Pan)#2290: PID reuse is now preemptively checked for
Process.ppid()andProcess.parents().
Internals
#2312: use
rufflinter instead offlake8 + isort.
Dropped support
#2246, breaking: drop python 3.4 & 3.5 support. (patch by Matthieu Darbois)
Bug fixes
#2241, [NetBSD], build-fail: can’t compile On NetBSD 10.99.3/amd64. (patch by Thomas Klausner)
#2195, [Linux]: no longer print exception at import time in case
/proc/statcan’t be read due to permission error. Redirect it toPSUTIL_DEBUGinstead.#2245, [Windows]: fix var unbound error on possibly in
swap_memory()(patch by student_2333)#2268:
bytes2human()utility function was unable to properly represent negative values.#2252, [Windows]:
disk_usage()fails on Python 3.12+. (patch by Matthieu Darbois)#2284, [Linux]:
Process.memory_full_info()may incorrectly raiseZombieProcessif it’s determined via/proc/pid/smaps_rollup. Instead we now fallback on reading/proc/pid/smaps.#2287, [OpenBSD], [NetBSD]:
Process.is_running()erroneously returnFalsefor zombie processes, because creation time cannot be determined.#2288, [Linux]: correctly raise
ZombieProcessonProcess.exe(),Process.cmdline()andProcess.memory_maps()instead of returning a “null” value.#2290: differently from what stated in the doc, PID reuse is not preemptively checked for
Process.nice()(set),Process.ionice(), (set),Process.cpu_affinity()(set),Process.rlimit()(set),Process.parent().#2308, [OpenBSD]:
Process.threads()always fail withAccessDenied(also as root).
5.9.5 — 2023-04-17¶
API changes
#2230, [OpenBSD]:
net_connections()rewritten from scratch: now retrievessocket.AF_UNIXsocket paths, is faster, and no longer produces duplicates.#2238:
Process.cwd()now consistently returns""on all platforms when the directory can’t be determined.#2239, [UNIX]: for zombie processes, return the truncated
Process.name()(15 chars) instead of raisingZombieProcesswhen the full name can’t be determined fromProcess.cmdline().
Internals
#2196: in case of exception, display a cleaner error traceback by hiding the
KeyErrorbit deriving from a missed cache hit.#2217: print the full traceback when a
DeprecationWarningorUserWarningis raised.#2240, [NetBSD], [OpenBSD]: add CI testing on every commit for NetBSD and OpenBSD platforms (python 3 only).
Bug fixes
#2164, [Linux], build-fail: compilation fails on kernels < 2.6.27 (e.g. CentOS 5).
#2186, [FreeBSD], build-fail: compilation fails with Clang 15. (patch by Po-Chuan Hsieh)
#1043, [OpenBSD]
net_connections()returns duplicate entries.#1915, [Linux]: on certain kernels,
"MemAvailable"field from/proc/meminforeturns0(possibly a kernel bug), in which case we calculate an approximation foravailablememory which matches “free” CLI utility.#2191, [Linux]:
disk_partitions(): do not unnecessarily read/proc/filesystemsand raiseAccessDeniedunless user specifiedall=Falseargument.#2216, [Windows]: fix tests when running in a virtual environment (patch by Matthieu Darbois)
#2225, [POSIX]:
users()loses precision forstartedfield (off by 1 minute).#2229, [OpenBSD]: unable to properly recognize zombie processes.
NoSuchProcessmay be raised instead ofZombieProcess.#2231, [NetBSD]:
availablevirtual_memory()is higher thantotal.#2234, [NetBSD]:
virtual_memory()metrics are wrong:availableandusedare too high. We now match values shown by htop CLI utility.#2236, [NetBSD]:
Process.num_threads()andProcess.threads()return threads that are already terminated.#2237, [OpenBSD], [NetBSD]:
Process.cwd()may raiseFileNotFoundErrorif cwd no longer exists. Return an empty string instead.
5.9.4 — 2022-11-07¶
Build and packaging
#2102: use Limited API when building wheels with CPython 3.6+ on Linux, macOS and Windows. (patch by Matthieu Darbois)
Bug fixes
#2156, [Linux], build-fail: compilation may fail on very old gcc compilers due to missing
SPEED_UNKNOWNdefinition. (patch by Amir Rossert)#2010, [macOS], build-fail: on MacOS, arm64
IFM_1000_TXandIFM_1000_Tare the same value, causing a build failure. (patch by Lawrence D’Anna)#2077, [Windows]: Use system-level values for
virtual_memory(). (patch by Daniel Widdis)#2160, [Windows]: get
swap_memory()percentusage from performance counters. (patch by Daniel Widdis)
5.9.3 — 2022-10-18¶
Build and packaging
#2040, [macOS]: provide wheels for arm64 architecture. (patch by Matthieu Darbois)
Internals
#2153, [macOS] Fix race condition in
test_posix.TestProcess.test_cmdline. (patch by Matthieu Darbois)
Bug fixes
#2135, [macOS], critical:
Process.environ()may contain garbage data. Fix out-of-bounds read aroundsysctl_procargs. (patch by Bernhard Urban-Forster)#2138, [Linux], build-fail: can’t compile psutil on Android due to undefined
ethtool_cmd_speedsymbol.#2116, [macOS]:
net_connections()fails withRuntimeError.#2142, [POSIX]:
net_if_stats()‘sflagson Python 2 returned unicode instead of str. (patch by Matthieu Darbois)#2147, [macOS] Fix disk usage report on macOS 12+. (patch by Matthieu Darbois)
#2150, [Linux]
Process.threads()may raiseNoSuchProcess. Fix race condition. (patch by Daniel Li)
5.9.2 — 2022-09-04¶
Bug fixes
#2093, [FreeBSD]:
pids()may fail with ENOMEM. Dynamically increase themalloc()buffer size until it’s big enough.#2095, [Linux]:
net_if_stats()returns incorrect interface speed for 100GbE network cards.#2113, [FreeBSD]:
virtual_memory()may raise ENOMEM due to missing#include <sys/param.h>directive. (patch by Peter Jeremy)#2128, [NetBSD]:
swap_memory()was miscalculated. (patch by Thomas Klausner)
5.9.1 — 2022-05-20¶
New APIs
#2037: add
flagsfield tonet_if_stats().#2057, [OpenBSD]: add support for
cpu_freq().
Performance
#2050, [Linux]: increase read(2) buffer size from 1k to 32k when reading
/procpseudo files line by line.#2107, [Linux]:
Process.memory_full_info()now reads/proc/pid/smaps_rollupinstead of/proc/pid/smaps(5x faster).
Dropped support
#1053, breaking: drop Python 2.6 support. (patches by Matthieu Darbois and Hugo van Kemenade)
Bug fixes
#2048:
AttributeErroris raised ifpsutil.Errorclass is raised manually and passed throughstr.#2049, [Linux]:
cpu_freq()erroneously returnscurrentvalue in GHz whileminandmaxare in MHz.#2050, [Linux]:
virtual_memory()may raiseValueErrorif running in a LCX container.
5.9.0 — 2021-12-29¶
New platforms
#1996, [BSD]: add support for MidnightBSD. (patch by Saeed Rasooli)
API changes
#1992:
NoSuchProcessmessage now specifies if the PID has been reused. Error classes now have improved__repr__and__str__.#1999, [Linux]:
disk_partitions(): convert/dev/rootdevice (an alias used on some Linux distros) to real root device path.
Performance
#1851, [Linux]:
cpu_freq()reads from/proc/cpuinfoinstead of many files in/sysfs, faster on systems with many CPUs. (patch by marxin)
Documentation
#2042: rewrite HISTORY.rst to use hyperlinks pointing to psutil API doc.
Internals
#2005:
PSUTIL_DEBUGmode now prints file name and line number of the debug messages coming from C extension modules.
Bug fixes
#1953, [Windows], critical:
disk_partitions()crashes due to insufficient buffer len. (patch by MaWe2019)#1965, [Windows], critical: fix “Fatal Python error: deallocating None” when calling
users()multiple times.#1990, [Windows], memleak: starting a
WindowsServiceleaked a service handle.#1512, [macOS]: sometimes
Process.connections()will crash withEOPNOTSUPPfor one connection; this is now ignored.#1598, [Windows]:
disk_partitions()only returns mount points on drives where it first finds one.#1874, [SunOS]: swap output error due to incorrect range.
#1892, [macOS]:
cpu_freq()broken on Apple M1. Also,minandmaxare set to 0 if they can’t be determined, instead of raising an exception.#1901, [macOS]:
Process.open_files(),Process.connections()and others could randomly raiseAccessDeniedbecause the internal buffer ofproc_pidinfo(PROC_PIDLISTFDS)was too small. Now dynamically increased until sufficient.#1904, [Windows]:
OpenProcessfails withERROR_SUCCESSdue toGetLastError()called aftersprintf(). (patch by @alxchk)#1913, [Linux]:
wait_procs()should catchsubprocess.TimeoutExpiredexception.#1919, [Linux]:
sensors_battery()can raiseTypeErroron PureOS.#1921, [Windows]:
swap_memory()shows committed memory instead of swap.#1940, [Linux]: psutil does not handle
ENAMETOOLONGwhen accessing process file descriptors in procfs. (patch by Nikita Radchenko)#1948:
memoize_when_activateddecorator is not thread-safe. (patch by Xuehai Pan)#1980, [Windows]: 32bit / WoW64 processes fails to read
Process.name()longer than 128 characters. (patch by PetrPospisil)#1991:
process_iter()is not thread safe and can raiseTypeErrorif invoked from multiple threads.#1956, [macOS]:
Process.cpu_times()reports incorrect timings on M1 machines. (patch by Olivier Dormond)#2023, [Linux]:
cpu_freq()return order is wrong on systems with more than 9 CPUs.
5.8.0 — 2020-12-19¶
New APIs
#1863:
disk_partitions()exposes 2 extra fields:maxfileandmaxpath, which are the maximum file name and path name length.
New platforms
#1872, [Windows]: added support for PyPy 2.7.
Build and packaging
#1879: provide pre-compiled wheels for Linux and macOS (yey!).
Internals
#1880: switch CI from Travis/Cirrus to GitHub Actions (Linux, macOS, FreeBSD). AppVeyor still used for Windows.
Bug fixes
#1708, [Linux]: get rid of
sensors_temperatures()duplicates. (patch by Tim Schlueter).#1839, [Windows]: always raise
AccessDeniedinstead ofWindowsErrorwhen failing to query 64 processes from 32 bit ones by usingNtWoW64APIs.#1866, [Windows]:
Process.exe(),Process.cmdline(),Process.environ()may raise “[WinError 998] Invalid access to memory location” on Python 3.9 / VS 2019.#1874, [SunOS]: wrong swap output given when encrypted column is present.
#1875, [Windows]:
Process.username()may raiseERROR_NONE_MAPPEDif the SID has no corresponding account name. In this caseAccessDeniedis now raised.#1886, [macOS]:
EIOerror may be raised onProcess.cmdline()andProcess.environ(). Now it gets translated intoAccessDenied.#1887, [Windows]:
OpenProcessmay fail with “[WinError 0] The operation completed successfully”.” Turn it intoAccessDeniedorNoSuchProcessdepending on whether the PID is alive.#1891, [macOS]: get rid of deprecated
getpagesize().
5.7.3 — 2020-10-24¶
New APIs
#809, [FreeBSD]: add support for
Process.rlimit().#893, [BSD]: add support for
Process.environ()(patch by Armin Gruner)
API changes
#1830, [POSIX]:
net_if_stats()isupalso checks whether the NIC is running (meaning Wi-Fi or ethernet cable is connected). (patch by Chris Burger)#1837, [Linux]: improved battery detection and charge
secsleftcalculation (patch by @aristocratos)
Bug fixes
#1823, [Windows], critical:
Process.open_files()may cause a segfault due to a NULL pointer.#1791, [macOS], build-fail: fix missing include for
getpagesize().#1620, [Linux]:
cpu_count()withlogical=Falseresult is incorrect on systems with more than one CPU socket. (patch by Vincent A. Arcila)#1738, [macOS]:
Process.exe()may raiseFileNotFoundErrorif process is still alive but the exe file which launched it got deleted.#1838, [Linux]:
sensors_battery(): ifpercentcan be determined but not the remaining values, still return a result instead ofNone. (patch by @aristocratos)
5.7.2 — 2020-07-15¶
Bug fixes
wheels for 2.7 were inadvertently deleted.
5.7.1 — 2020-07-15¶
New platforms
#1768, [Windows]: added support for Windows Nano Server. (contributed by Julien Lebot)
API changes
#1747:
Process.wait()return value is cached so that the exit code can be retrieved on then next call.#1747, [POSIX]:
Process.wait()on POSIX now returns an enum, showing the negative signal which was used to terminate the process. It returns something like<Negsignal.SIGTERM: -15>.#1747:
Processclass provides more info about the process onstr()andrepr()(status and exit code).
Performance
#1741, [POSIX]:
make buildnow runs in parallel on Python >= 3.6 and it’s about 15% faster.
Internals
#1709: parallel tests on POSIX (
make test-parallel). They’re twice as fast!#1757: memory leak tests are now stable.
Bug fixes
#1781, critical:
getloadavg()can crash the Python interpreter. (patch by Ammar Askar)#1726, [Linux]:
cpu_freq()parsing should use spaces instead of tabs on ia64. (patch by Michał Górny)#1760, [Linux]:
Process.rlimit()does not handle long long type properly.#1766, [macOS]:
NoSuchProcessmay be raised instead ofZombieProcess.
5.7.0 — 2020-02-18¶
New platforms
#1637, [SunOS]: add partial support for old SunOS 5.10 Update 0 to 3.
#1686, [Windows]: added support for PyPy on Windows.
API changes
#1648, [Linux]:
sensors_temperatures()looks into an additional/sys/device/directory for additional data. (patch by Javad Karabi)#1677, [Windows]:
Process.exe()will succeed for all process PIDs (instead of raisingAccessDenied).#1693, [Windows]:
boot_time(),Process.create_time()andusers()’s login time now have 1 micro second precision (before the precision was of 1 second).
Performance
#1679, [Windows]:
net_connections()andProcess.connections()are 10% faster.
Internals
#1671, [FreeBSD]: add CI testing/service for FreeBSD (Cirrus CI).
#1682, [PyPy]: added CI / test integration for PyPy via Travis.
Dropped support
#1652, [Windows], breaking: dropped support for Windows XP and Windows Server 2003. Minimum supported Windows version now is Windows Vista.
Bug fixes
#1646, [FreeBSD], critical: many
Processmethods may cause a segfault due to a backward incompatible change in a C type on FreeBSD 12.0.#1695, [Linux], build-fail: could not compile on kernels <= 2.6.13 due to
PSUTIL_HAS_IOPRIOnot being defined. (patch by Anselm Kruis)#1538, [NetBSD]:
Process.cwd()may returnENOENTinstead ofNoSuchProcess.#1627, [Linux]:
Process.memory_maps()can raiseKeyError.#1642, [SunOS]: querying basic info for PID 0 results in
FileNotFoundError.#1656, [Windows]:
Process.memory_full_info()raisesAccessDeniedeven for the current user andos.getpid().#1660, [Windows]:
Process.open_files()rewritten with proper error handling.#1662, [Windows]:
Process.exe()may raise “[WinError 0] The operation completed successfully”.#1665, [Linux]:
disk_io_counters()does not take into account extra fields added to recent kernels. (patch by Mike Hommey)#1672: use the right C type when dealing with PIDs (int or long).
#1673, [OpenBSD]:
Process.connections(),Process.num_fds()andProcess.threads()raised wrong exception if process is gone.#1674, [SunOS]:
disk_partitions()may raiseOSError.#1684, [Linux]:
disk_io_counters()may raiseValueErroron systems not having/proc/diskstats.
5.6.7 — 2019-11-26¶
Bug fixes
#1630, [Windows], build-fail: can’t compile source distribution due to C syntax error.
5.6.6 — 2019-11-25¶
Bug fixes
#1616, critical: use of
Py_DECREFinstead ofPy_CLEARwill result in doublefree()and segfault (CVE-2019-18874). (patch by Riccardo Schirone)#1619, [OpenBSD], build-fail: compilation fails due to C syntax error. (patch by Nathan Houghton)
#1179, [Linux]:
Process.cmdline()now handles processes that use inappropriate chars to separate args.
5.6.5 — 2019-11-06¶
Bug fixes
#1615, build-fail: remove
pyproject.tomlas it was causing installation issues.
5.6.4 — 2019-11-04¶
New APIs
#1527, [Linux]: added
Process.cpu_times()iowaitcounter, which is the time spent waiting for blocking I/O to complete.
Build and packaging
#1565: add PEP 517/8 build backend and requirements specification for better pip integration. (patch by Bernát Gábor)
Bug fixes
#1126, [Linux], critical:
Process.cpu_affinity()segfaults on CentOS 5 / manylinux.Process.cpu_affinity()support for CentOS 5 was removed.#1528, [AIX], build-fail: compilation error on AIX 7.2 due to 32 vs 64 bit differences. (patch by Arnon Yaari)
#1606, [SunOS], build-fail: compilation fails on SunOS 5.10. (patch by vser1)
#875, [Windows]:
Process.cmdline(),Process.environ()orProcess.cwd()may occasionally fail withERROR_PARTIAL_COPYwhich now gets translated toAccessDenied.#1535:
typeandfamilyfields returned bynet_connections()are not always turned into enums.#1536, [NetBSD]:
Process.cmdline()erroneously raiseZombieProcesserror if cmdline has non encodable chars.#1546: usage percent may be rounded to 0 on Python 2.
#1552, [Windows]:
getloadavg()math for calculating 5 and 15 mins values is incorrect.#1568, [Linux]: use CC compiler env var if defined.
#1570, [Windows]:
NtWow64*syscalls fail to raise the proper error code#1585, [macOS]: avoid calling
close()(in C) on possible negative integers. (patch by Athos Ribeiro)
5.6.3 — 2019-06-11¶
New APIs
#1494, [AIX]: added support for
Process.environ(). (patch by Arnon Yaari)
Bug fixes
#1276, [AIX]: can’t get whole
Process.cmdline(). (patch by Arnon Yaari)#1501, [Windows]:
Process.cmdline()andProcess.exe()raise unhandled “WinError 1168 element not found” exceptions for “Registry” and “Memory Compression” pseudo processes on Windows 10.#1526, [NetBSD]:
Process.cmdline()could raiseMemoryError. (patch by Kamil Rytarowski)
5.6.2 — 2019-04-26¶
New APIs
#604, [Windows]: add new
getloadavg(), returning system load average calculation, including on Windows (emulated). (patch by Ammar Askar)#1476, [Windows]:
Process.ionice()can now set high I/O priority. New constants:IOPRIO_VERYLOW,IOPRIO_LOW,IOPRIO_NORMAL,IOPRIO_HIGH.
API changes
#1404, [Linux]:
cpu_count()withlogical=Falsefalls back to reading/sys/devices/system/cpu/*/topology/core_idif/proc/cpuinfodoesn’t provide the info.
Documentation
#1464: various docfixes (always point to Python 3 doc, fix links, etc.).
Internals
#1458: provide coloured test output. Also show failures on
KeyboardInterrupt.#1478: add make command to re-run tests failed on last run.
#1462, [Linux]: (tests) make tests invariant to
LANGsetting (patch by Benjamin Drung)#1463: scripts/cpu_distribution.py was broken.
Bug fixes
#1480, [Windows], critical:
cpu_count()withlogical=Falsecould cause a crash due to fixed read violation. (patch by Samer Masterson)#1491, [SunOS], memleak:
net_if_addrs(): usefree()againstifapstruct on error. (patch by Agnewee)#1223, [Windows]:
boot_time()may return incorrect value on Windows XP.#1456, [Linux]:
cpu_freq()returnsNoneinstead of 0.0 whenminandmaxfields can’t be determined. (patch by Alex Manuskin)#1470, [Linux]:
disk_partitions(): fix corner case when/etc/mtabdoesn’t exist. (patch by Cedric Lamoriniere)#1471, [SunOS]:
Process.name()andProcess.cmdline()can returnSystemError. (patch by Daniel Beer)#1472, [Linux]:
cpu_freq()does not return all CPUs on Raspberry-pi 3.#1474: fix formatting of
psutil.tests()which mimicsps auxoutput.#1475, [Windows]:
OSError.winerrorattribute wasn’t properly checked resulting inWindowsError(ERROR_ACCESS_DENIED)being raised instead ofAccessDenied.#1477, [Windows]: wrong or absent error handling for private
NTSTATUSWindows APIs. Different process methods were affected by this.#1486, [AIX], [SunOS]:
AttributeErrorwhen interacting withProcessmethods involved intoProcess.oneshot()context.#1493, [Linux]:
cpu_freq(): handle the case where/sys/devices/system/cpu/cpufreq/exists but it’s empty.
5.6.1 — 2019-03-11¶
Bug fixes
#1448, [Windows], critical: crash on import due to
rtlIpv6AddressToStringAnot available on Wine.#1451, [Windows], critical:
Process.memory_full_info()segfaults.NtQueryVirtualMemoryis now used instead ofQueryWorkingSetto calculate USS memory.#1329, [AIX], build-fail: psutil doesn’t compile on AIX 6.1. (patch by Arnon Yaari)
5.6.0 — 2019-03-05¶
New APIs
#1433: new
Process.parents()method. (idea by Ghislain Le Meur)
API changes
#1291, [macOS], critical, breaking:
Process.memory_maps()was removed because inherently broken (segfault) for years.#1420, [Windows]: in case of exception
disk_usage()now also shows the path name.
Performance
#1379, [Windows]:
Process.suspend()andProcess.resume()now useNtSuspendProcess/NtResumeProcessinstead of stopping / resuming all threads. Faster and more reliable.#1422, [Windows]: DLL-loaded Windows APIs are now loaded once on startup instead of per function call, significantly faster.
#1426, [Windows]:
PAGESIZEand number of processors is now calculated on startup.
Internals
#1428: in case of error, the traceback message now shows the underlying C function called which failed.
#1442: Python 3 is now the default interpreter used by Makefile.
Bug fixes
#1411, [BSD], critical, memleak: lack of
Py_DECREFcould cause segmentation fault on process instantiation.#1353:
process_iter()is now thread safe (it rarely raisedTypeError).#1394, [Windows]:
Process.name()andProcess.exe()may erroneously return “Registry” or fail with “[Error 0] The operation completed successfully”.QueryFullProcessImageNameWis now used instead ofGetProcessImageFileNameWin order to prevent that.#1419, [Windows]:
Process.environ()raisesNotImplementedErrorwhen querying a 64-bit process in 32-bit-WoW mode. Now it raisesAccessDenied.#1427, [macOS]:
Process.cmdline()andProcess.environ()may erroneously raiseOSErroron failedmalloc().#1429, [Windows]:
SE DEBUGwas not properly set for current process. It is now, and it should result in lessAccessDeniedexceptions for low PID processes.#1432, [Windows]:
Process.memory_info_ex()’s USS memory is miscalculated because we’re not using the actual systemPAGESIZE.#1439, [NetBSD]:
Process.connections()may return incomplete results if usingProcess.oneshot().#1447: original exception wasn’t turned into
NoSuchProcess/AccessDeniedexceptions when usingProcess.oneshot()context manager.
5.5.1 — 2019-02-15¶
API changes
#1384, [Windows]: on Windows >= 8.1,
Process.cmdline()falls back toNtQueryInformationProcessonERROR_ACCESS_DENIED. (patch by EccoTheFlintstone)
Bug fixes
#1408, [AIX], build-fail: psutil won’t compile on AIX 7.1 due to missing header. (patch by Arnon Yaari)
#1394, [Windows]:
Process.exe()returns “[Error 0] The operation completed successfully” when Python process runs in “Virtual Secure Mode”.#1402: psutil exceptions’
repr()show the internal private module path.
5.5.0 — 2019-01-23¶
New APIs
#1350, [FreeBSD]: added support for
sensors_temperatures(). (patch by Alex Manuskin)#1352, [FreeBSD]: added support for
cpu_freq(). (patch by Alex Manuskin)
Bug fixes
#1111:
Process.oneshot()is now thread safe.#1354, [Linux]:
disk_io_counters()fails on Linux kernel 4.18+.#1357, [Linux]:
Process.memory_maps()andProcess.io_counters()methods are no longer exposed if not supported by the kernel.#1368, [Windows]: fix
Process.ionice()mismatch. (patch by EccoTheFlintstone)#1370, [Windows]: improper usage of
CloseHandle()may lead to override the original error code when raising an exception.#1373: incorrect handling of cache in
Process.oneshot()context causesProcessinstances to return incorrect results.#1376, [Windows]:
OpenProcessnow usesPROCESS_QUERY_LIMITED_INFORMATIONwhere possible, reducingAccessDeniedfor system processes.#1376, [Windows]: check if variable is
NULLbeforefree()ing it. (patch by EccoTheFlintstone)
5.4.8 — 2018-10-30¶
API changes
#1197, [Linux]:
cpu_freq()falls back to/proc/cpuinfoif/sys/devices/system/cpu/*is not available.#1310, [Linux]:
sensors_temperatures()falls back to/sys/class/thermalif/sys/class/hwmonis not available (e.g. Raspberry Pi). (patch by Alex Manuskin)
Build and packaging
#1320, [POSIX]: better compilation support when using g++ instead of GCC. (patch by Jaime Fullaondo)
Bug fixes
#715: do not print exception on import time in case
cpu_times()fails.#1004, [Linux]:
Process.io_counters()may raiseValueError.#1277, [macOS]: available and used memory (
virtual_memory()) metrics are not accurate.#1294, [Windows]:
Process.connections()may sometimes fail with intermittent0xC0000001. (patch by Sylvain Duchesne)#1307, [Linux]:
disk_partitions()does not honourPROCFS_PATH.#1320, [AIX]: system CPU times (
cpu_times()) were being reported with ticks unit as opposed to seconds. (patch by Jaime Fullaondo)#1332, [macOS]: psutil debug messages are erroneously printed all the time. (patch by Ilya Yanok)
#1346, [SunOS]:
net_connections()returns an empty list. (patch by Oleksii Shevchuk)
5.4.7 — 2018-08-14¶
New APIs
#1309, [Linux]: added
STATUS_PARKEDconstant forProcess.status().
API changes
#1286, [macOS]:
OSXconstant is now deprecated in favor of newMACOS.#1321, [Linux]:
disk_io_counters()falls back to/sys/blockif/proc/diskstatsis not available. (patch by Lawrence Ye)
Bug fixes
#1209, [macOS]:
Process.memory_maps()may fail withEINVALdue to poortask_for_pid()syscall.AccessDeniedis now raised instead.#1278, [macOS]:
Process.threads()incorrectly return microseconds instead of seconds. (patch by Nikhil Marathe)#1279, [Linux], [macOS], [BSD]:
net_if_stats()may returnENODEV.#1294, [Windows]:
Process.connections()may sometime fail withMemoryError. (patch by @sylvainduchesne)#1305, [Linux]:
disk_io_counters()may report inflated r/w bytes values.#1309, [Linux]:
Process.status()is unable to recognizeidleandparkedstatuses (returns"?").#1313, [Linux]:
disk_io_counters()can report inflated values due to counting base disk device and its partition(s) twice.#1323, [Linux]:
sensors_temperatures()may fail withValueError.
5.4.6 — 2018-06-07¶
API changes
#1273:
net_if_addrs()named tuple’s name has been renamed fromsnictosnicaddr.
Bug fixes
#1258, [Windows], critical:
Process.username()may cause a segfault (Python interpreter crash). (patch by Jean-Luc Migot)#1274, [Linux]: there was a small chance
Process.children()may swallowAccessDeniedexceptions.
5.4.5 — 2018-04-13¶
Bug fixes
#1268: setup.py’s
extra_requireparameter requires latest setuptools version, breaking quite a lot of installations.
5.4.4 — 2018-04-13¶
New APIs
#1239, [Linux]: expose kernel
slabmemory field forvirtual_memory(). (patch by Maxime Mouial)
API changes
#771, [Windows], breaking:
cpu_count()withlogical=Falseon Windows XP and Vista is no longer supported and returnsNone.
Bug fixes
#1194, [SunOS], critical: fix double
free()inProcess.cpu_num(). (patch by Georg Sauthoff)#694, [SunOS]:
Process.cmdline()could be truncated at the 15th character when reading it from/proc. An extra effort is made by reading it from process address space first. (patch by Georg Sauthoff)#771, [Windows]:
cpu_count()(both logical and cores) return a wrong (smaller) number on systems using process groups (> 64 cores).#771, [Windows]:
cpu_times()withpercpu=Truereturn fewer CPUs on systems using process groups (> 64 cores).#771, [Windows]:
cpu_stats()andcpu_freq()may return incorrect results on systems using process groups (> 64 cores).#1193, [SunOS]: return uid/gid from
/proc/pid/psinfoif there aren’t enough permissions for/proc/pid/cred. (patch by Georg Sauthoff)#1194, [SunOS]: return nice value from
psinfoasgetpriority()doesn’t support real-time processes. (patch by Georg Sauthoff)#1194, [SunOS]: fix undefined behavior related to strict-aliasing rules and warnings. (patch by Georg Sauthoff)
#1210, [Linux]:
cpu_percent()steal time may remain stuck at 100% due to Linux erroneously reporting a decreased steal time between calls. (patch by Arnon Yaari)#1216, [Windows]: fix compatibility with Python 2.6 (patch by Dan Vinakovsky)
#1222, [Linux]:
Process.memory_full_info()was erroneously summing “Swap:” and “SwapPss:”. Same for “Pss:” and “SwapPss”. Not anymore.#1224, [Windows]:
Process.wait()may erroneously raiseTimeoutExpired.#1238, [Linux]:
sensors_battery()may returnNonein case battery is not listed as “BAT0” under/sys/class/power_supply.#1240, [Windows]:
cpu_times()float loses accuracy in a long running system. (patch by stswandering)#1245, [Linux]:
sensors_temperatures()may fail withIOError“no such file”.#1255, [FreeBSD]:
swap_memory()stats were erroneously represented in KB. (patch by Denis Krienbühl)
5.4.3 — 2018-01-01¶
API changes
#775, [Windows]:
disk_partitions()return mount points.
Bug fixes
5.4.2 — 2017-12-07¶
New APIs
#1173: add
PSUTIL_DEBUGenvironment variable to print debug messages on stderr.#1177, [macOS]: added support for
sensors_battery(). (patch by Arnon Yaari)
API changes
#1188:
Process.memory_info_ex()now warns withFutureWarninginstead ofDeprecationWarning.
Performance
#1183:
Process.children()is 2x faster on POSIX and 2.4x faster on Linux.
Internals
#1172, [Windows]:
make testdoes not work.
Bug fixes
#1152, [Windows]:
disk_io_counters()may return an empty dict.#1169, [Linux]:
users()hostnamereturns username instead. (patch by janderbrain)#1179, [Linux]:
Process.cmdline()can now split args for processes that overwrite/proc/pid/cmdlinewith spaces instead of null bytes.#1181, [macOS]:
Process.memory_maps()may raiseENOENT.#1187, [macOS]:
pids()does not return PID 0 on recent macOS versions.
5.4.1 — 2017-11-08¶
New APIs
#1164, [AIX]: add support for
Process.num_ctx_switches(). (patch by Arnon Yaari)
Internals
#1151:
python -m psutil.testsfail.
Dropped support
#1053, breaking: drop Python 3.3 support (psutil still works but it’s no longer tested).
Bug fixes
#1154, [AIX], build-fail: psutil won’t compile on AIX 6.1.0. (patch by Arnon Yaari)
#1150, [Windows]: when a process is terminated now the exit code is set to
SIGTERMinstead of0. (patch by Akos Kiss)#1167, [Windows]:
net_io_counters()packets count now include also non-unicast packets. (patch by Matthew Long)
5.4.0 — 2017-10-12¶
New platforms
#1123, [AIX]: added support for AIX platform. (patch by Arnon Yaari)
Bug fixes
#1127, [macOS], critical: invalid reference counting in
Process.open_files()may lead to segfault. (patch by Jakub Bacic)#1133, [Windows], build-fail: can’t compile on newer versions of Visual Studio 2017 15.4. (patch by Max Bélanger)
#1138, [Linux], build-fail: can’t compile on CentOS 5.0 and RedHat 5.0. (patch by Prodesire)
#1009, [Linux]:
sensors_temperatures()may crash withIOError.#1012, [Windows]:
disk_io_counters()read_timeandwrite_timewere expressed in tens of micro seconds instead of milliseconds.#1129, [Linux]:
sensors_fans()may crash withIOError. (patch by Sebastian Saip)#1131, [SunOS]: fix compilation warnings. (patch by Arnon Yaari)
5.3.1 — 2017-09-10¶
Build and packaging
#1120, [Windows], breaking:
.exefiles are no longer uploaded on PyPI as per PEP-527. Only wheels are provided.
Documentation
#1124: documentation moved to http://psutil.readthedocs.io
Bug fixes
#1105, [FreeBSD], build-fail: psutil does not compile on FreeBSD 12.
#1125, [BSD]:
net_connections()raisesTypeError.
5.3.0 — 2017-09-01¶
New APIs
#802:
disk_io_counters()andnet_io_counters()no longer wrap (restart from 0). New nowrap argument.#1025:
process_iter()accepts new attrs and ad_value parameters to invokeProcess.as_dict()inline.#1051:
disk_usage()on Python 3 is now able to accept bytes.#1091, [SunOS]: implemented
Process.environ(). (patch by Oleksii Shevchuk)
API changes
#1039, breaking: returned types consolidation. 1) Windows /
Process.cpu_times(): fields #3 and #4 were int instead of float. 2) Linux / FreeBSD / OpenBSD:Process.connections()raddris now set to""instead ofNonewhen retrieving UNIX sockets.#1040, breaking: all strings are encoded by using OS fs encoding.
#1040, breaking: the following Windows APIs on Python 2 now return a string instead of unicode:
Process.memory_maps()’spathfield,WindowsService.binpath(),WindowsService.description(),WindowsService.display_name(),WindowsService.username().#928:
net_connections()andProcess.connections()laddrandraddrare now named tuples.#1015:
swap_memory()now reads/proc/meminfoinstead ofsysinfo()syscall, so it works withPROCFS_PATHfor containers.#1040: implemented full unicode support.
#1079, [FreeBSD]:
net_connections()fdnumber is now being set for real (instead of-1). (patch by Gleb Smirnoff)
Build and packaging
#1060: source distribution now only includes relevant files.
Internals
#1058: test suite now enables all warnings by default.
Bug fixes
#1064, [NetBSD], critical:
swap_memory()may segfault in case of error.#1042, [FreeBSD], build-fail: psutil won’t compile on FreeBSD 12.
#1033, [macOS], [FreeBSD], memleak: memory leak for
net_connections()andProcess.connections()when retrieving UNIX sockets (kind='unix').#1047, [Windows], memleak:
Process.username(): memory leak in case exception is thrown.#1050, [Windows], memleak:
Process.memory_maps()leaks memory.#1067, [NetBSD], memleak:
Process.cmdline()leaks memory if process has terminated.#1068, [OpenBSD], memleak:
net_connections()leaks memory ifsysctl()fails.#989, [Windows]:
boot_time()may return a negative value.#1007, [Windows]:
boot_time()can have a 1 sec fluctuation between calls. The first call value is now cached.#1013, [FreeBSD]:
net_connections()may return incorrect PID. (patch by Gleb Smirnoff)#1014, [Linux]:
Processclass can mask legitimateENOENTexceptions asNoSuchProcess.#1016:
disk_io_counters()raisesRuntimeErroron a system with no disks.#1017:
net_io_counters()raisesRuntimeErroron a system with no network cards installed.#1021, [Linux]:
Process.open_files()may erroneously raiseNoSuchProcessinstead of skipping a file which gets deleted while open files are retrieved.#1029, [macOS], [FreeBSD]:
Process.connections()withfamily=unixon Python 3 doesn’t properly handle unicode paths and may raiseUnicodeDecodeError.#1040: fixed many unicode related issues such as
UnicodeDecodeErroron Python 3 + POSIX and invalid encoded data on Windows.#1044, [macOS]: different
Processmethods incorrectly raiseAccessDeniedfor zombie processes.#1046, [Windows]:
disk_partitions()on Windows overrides user’sSetErrorMode.#1048, [Windows]:
users()’shostfield report an invalid IP address.#1055:
cpu_count()is no longer cached (CPUs can be disabled at runtime on Linux).Process.cpu_percent()also affected.#1058: fixed Python warnings.
#1062:
disk_io_counters()andnet_io_counters()raiseTypeErrorif no disks or NICs are installed on the system.#1063, [NetBSD]:
net_connections()may list incorrect sockets.#1065, [OpenBSD]:
Process.cmdline()may raiseSystemError.#1069, [FreeBSD]:
Process.cpu_num()may return 255 for certain kernel processes.#1071, [Linux]:
cpu_freq()may raiseIOErroron old RedHat distros.#1074, [FreeBSD]:
sensors_battery()raisesOSErrorin case of no battery.#1075, [Windows]:
net_if_addrs():inet_ntop()return value is not checked.#1077, [SunOS]:
net_if_addrs()shows garbage addresses on SunOS 5.10. (patch by Oleksii Shevchuk)#1077, [SunOS]:
net_connections()does not work on SunOS 5.10. (patch by Oleksii Shevchuk)#1079, [FreeBSD]:
net_connections()didn’t list locally connected sockets. (patch by Gleb Smirnoff)#1085:
cpu_count()return value is now checked and forced toNoneif <= 1.#1087:
Process.cpu_percent()guard againstcpu_count()returningNoneand assumes 1 instead.#1093, [SunOS]:
Process.memory_maps()shows wrong 64 bit addresses.#1094, [Windows]: fix
pid_exists()returning wrong result. AllOpenProcessAPIs now verify the PID is actually running.#1098, [Windows]:
Process.wait()may erroneously return sooner, when the PID is still alive.#1099, [Windows]:
Process.terminate()may raiseAccessDeniedeven if the process already died.#1101, [Linux]:
sensors_temperatures()may raiseENODEV.
5.2.2 — 2017-04-10¶
Bug fixes
#1000: fixed some setup.py warnings.
#1002, [SunOS]: remove C macro which will not be available on new Solaris versions. (patch by Danek Duvall)
#1004, [Linux]:
Process.io_counters()may raiseValueError.#1006, [Linux]:
cpu_freq()may returnNoneon some Linux versions does not support the function. Let’s not make the function available instead.#1009, [Linux]:
sensors_temperatures()may raiseOSError.#1010, [Linux]:
virtual_memory()may raiseValueErroron Ubuntu 14.04.
5.2.1 — 2017-03-24¶
Bug fixes
#981, [Linux]:
cpu_freq()may return an empty list.#993, [Windows]:
Process.memory_maps()on Python 3 may raiseUnicodeDecodeError.#996, [Linux]:
sensors_temperatures()may not show all temperatures.#997, [FreeBSD]:
virtual_memory()may fail due to missingsysctlparameter on FreeBSD 12.
5.2.0 — 2017-03-05¶
New APIs
#974, [Linux]: Add
sensors_fans()function. (patch by Nicolas Hennion)#976, [Windows]:
Process.io_counters()has 2 new fields:other_countandother_bytes.#976, [Linux]:
Process.io_counters()has 2 new fields:read_charsandwrite_chars.
Bug fixes
#985, [Windows], critical: Fix a crash in
Process.open_files()when the worker thread forNtQueryObjecttimes out.#872, [Linux], build-fail: can now compile on Linux by using MUSL C library.
#986, [Linux]:
Process.cwd()may raiseNoSuchProcessinstead ofZombieProcess.
5.1.3 — 2017-02-07¶
Bug fixes
#971, [Linux]:
sensors_temperatures()didn’t work on CentOS 7.#973:
cpu_percent()may raiseZeroDivisionError.
5.1.2 — 2017-02-03¶
Bug fixes
#966, [Linux]:
sensors_battery()power_pluggedmay erroneously returnNoneon Python 3.#968, [Linux]:
disk_io_counters()raisesTypeErroron Python 3.#970, [Linux]:
sensors_battery()nameandlabelfields on Python 3 are bytes instead of str.
5.1.1 — 2017-02-03¶
API changes
#966, [Linux]:
sensors_battery()percentis a float and is more precise.
Bug fixes
#964, [Windows]:
Process.username()andusers()may return badly decoded character on Python 3.#965, [Linux]:
disk_io_counters()may miscalculate sector size and report the wrong number of bytes read and written.#966, [Linux]:
sensors_battery()may fail withFileNotFoundError.#966, [Linux]:
sensors_battery()power_pluggedmay lie.
5.1.0 — 2017-02-01¶
New APIs
#357: added
Process.cpu_num()(what CPU a process is on).#371, [Linux]: added
sensors_temperatures().#941: added
cpu_freq()(CPU frequency).#955, [Linux], [Windows]: added
sensors_battery().#956:
Process.cpu_affinity()can now be passed[]argument as an alias to set affinity against all eligible CPUs.
Bug fixes
#948, build-fail: cannot install psutil with
PYTHONOPTIMIZE=2.#687, [Linux]:
pid_exists()no longer returnsTrueif passed a process thread ID.#950, [Windows]:
Process.cpu_percent()was calculated incorrectly and showed higher number than real usage.#951, [Windows]: the uploaded wheels for Python 3.6 64 bit didn’t work.
#959: psutil exception objects could not be pickled.
#960:
Popenwait()did not return the correct negative exit status if process is killed by a signal.#961, [Windows]:
WindowsService.description()method may fail withERROR_MUI_FILE_NOT_FOUND.
5.0.1 — 2016-12-21¶
Build and packaging
#939: tar.gz distribution went from 1.8M to 258K.
Bug fixes
#609, [SunOS], build-fail: psutil does not compile on Solaris 10.
#936, [Windows], build-fail: fix compilation error on VS 2013 (patch by Max Bélanger).
#811, [Windows]: provide a more meaningful error message if trying to use psutil on unsupported Windows XP.
#940, [Linux]:
cpu_percent()andcpu_times_percent()was calculated incorrectly asiowait,guestandguest_nicetimes were not properly taken into account.
5.0.0 — 2016-11-06¶
New APIs
#799: new
Process.oneshot()context manager (+2x faster in general, +2x to +6x on Windows).
Bug fixes
#933, [Windows], memleak: memory leak in
cpu_stats()andWindowsService.description()method.#932, [NetBSD]:
net_connections()andProcess.connections()may fail without raising an exception.#943: better error message in case of version conflict on import.
4.4.2 — 2016-10-26¶
Bug fixes
#931, [SunOS], build-fail: psutil no longer compiles on Solaris.
4.4.1 — 2016-10-25¶
Bug fixes
4.4.0 — 2016-10-23¶
New APIs
#874, [Windows]: make
net_if_addrs()also return thenetmask.
API changes
#887, [Linux]:
virtual_memory()availableandusedare more precise and matchfreeutility. Also handles LXC containers.
Internals
#891: scripts/procinfo.py has been updated and provides a lot more info.
Bug fixes
#514, [macOS], critical:
Process.memory_maps()can segfault.#926, [macOS], critical:
Process.environ()can crash the interpreter on Python 3 if the process environment contains an invalid unicode string.#783, [macOS]:
Process.status()may erroneously returnSTATUS_RUNNINGfor zombie processes.#798, [Windows]:
Process.open_files()returns and empty list on Windows 10.#825, [Linux]:
Process.cpu_affinity(): fix possible double close and use of unopened socket.#880, [Windows]: fix race condition inside
net_connections().#885:
ValueErroris raised if a negative integer is passed tocpu_percent()functions.#892, [Linux]:
Process.cpu_affinity()with[-1]as arg raisesSystemErrorwith no error set; nowValueErroris raised.#906, [BSD]:
disk_partitions()withall=Falsereturned an empty list. Now the argument is ignored and all partitions are always returned.#907, [FreeBSD]:
Process.exe()may fail withOSErrorENOENT.#908, [macOS], [BSD]: different process methods could errounesuly mask the real error for high-privileged PIDs and raise
NoSuchProcessandAccessDeniedinstead ofOSErrorandRuntimeError.#909, [macOS]:
Process.open_files()andProcess.connections()methods may raiseOSErrorwith no exception set if process is gone.#916, [macOS]: fix many compilation warnings.
4.3.1 — 2016-09-01¶
Build and packaging
#881:
make installnow works also when using a virtual env.
Bug fixes
#870, [Windows], memleak: handle leak inside
psutil_get_process_data.#854:
Process.as_dict()raisesValueErrorif passed an erroneous attrs name.#857, [SunOS]:
Process.cpu_times(),Process.cpu_percent(),Process.threads()andProcess.memory_maps()may raiseRuntimeErrorif attempting to query a 64bit process with a 32bit Python. “Null” values are returned as a fallback.#858:
Process.as_dict()should not callProcess.memory_info_ex()because it’s deprecated.#863, [Windows]:
Process.memory_maps()truncates addresses above 32 bits.#866, [Windows]:
win_service_iter()and services in general are not able to handle unicode service names / descriptions.#869, [Windows]:
Process.wait()may raiseTimeoutExpiredwith wrong timeout unit (ms instead of sec).
4.3.0 — 2016-06-18¶
Bug fixes
#812, [NetBSD], build-fail: fix compilation on NetBSD-5.x.
#810, [Windows]: Windows wheels are incompatible with pip 7.1.2.
#823, [NetBSD]:
virtual_memory()raisesTypeErroron Python 3.#829, [POSIX]:
disk_usage()percentfield takes root reserved space into account.#816, [Windows]: fixed
net_io_counters()values wrapping after 4.3GB in Windows Vista (NT 6.0) and above using 64bit values from newer win APIs.
4.2.0 — 2016-05-14¶
New APIs
#795, [Windows]: new APIs to deal with Windows services:
win_service_iter()andwin_service_get().#800, [Linux]:
virtual_memory()returns a newsharedfield.
Performance
#819, [Linux]: speedup
/procparsing:Process.ppid()+20% faster.Process.status()+28% faster.Process.name()+25% faster.Process.num_threads()+20% faster on Python 3.
Bug fixes
#797, [Linux]:
net_if_stats()may raiseOSErrorfor certain NIC cards.#813:
Process.as_dict()should ignore extraneous attribute names which gets attached to theProcessinstance.
4.1.0 — 2016-03-12¶
New APIs
#777, [Linux]:
Process.open_files()on Linux return 3 new fields:position,modeandflags.#779:
Process.cpu_times()returns two new fields,children_userandchildren_system(always set to 0 on macOS and Windows).#789, [Windows]:
cpu_times()return two new fields:interruptanddpc. Same forcpu_times_percent().#792: new
cpu_stats()function returning number of CPUctx_switches,interrupts,soft_interruptsandsyscalls.
Bug fixes
#780, [macOS], build-fail: psutil does not compile with some GCC versions.
#790, [macOS], build-fail: psutil won’t compile on macOS 10.4.
#774, [FreeBSD]:
net_io_counters()dropout is no longer set to 0 if the kernel provides it.#776, [Linux]:
Process.cpu_affinity()may erroneously raiseNoSuchProcess. (patch by @wxwright)#786:
net_if_addrs()may report incomplete MAC addresses.#788, [NetBSD]:
virtual_memory()buffersandsharedvalues were set to 0.
4.0.0 — 2016-02-17¶
New APIs
#523, [Linux], [FreeBSD]:
disk_io_counters()return a newbusy_timefield.#732:
Process.environ(). (patch by Frank Benkstein)#753, [Linux], [macOS], [Windows]: process USS and PSS (Linux) “real” memory stats. (patch by Eric Rahm)
#755:
Process.memory_percent()memtypeparameter.#756, [Linux]:
disk_io_counters()return 2 new fields:read_merged_countandwrite_merged_count.
Build and packaging
#660, [Windows]: make.bat is smarter in finding alternative VS install locations. (patch by @mpderbec)
Internals
#758: tests now live in psutil namespace.
#762: add scripts/procsmem.py.
Bug fixes
#751, [Linux], critical: fixed call to
Py_DECREFon possibleNULLobject.#704, [SunOS], build-fail: psutil does not compile on Solaris sparc.
#741, [OpenBSD], build-fail: psutil does not compile on mips64.
#764, [NetBSD], build-fail: fix compilation on NetBSD-6.x.
#685, [Linux]:
virtual_memory()provides wrong results on systems with a lot of physical memory.#734: on Python 3 invalid UTF-8 data is not correctly handled for
Process.name(),Process.cwd(),Process.exe(),Process.cmdline()andProcess.open_files()methods resulting inUnicodeDecodeErrorexceptions.'surrogateescape'error handler is now used as a workaround for replacing the corrupted data.#737, [Windows]: when the bitness of psutil and the target process was different,
Process.cmdline()andProcess.cwd()could return a wrong result or incorrectly report anAccessDeniederror.#754, [Linux]:
Process.cmdline()can be wrong in case of zombie process.#759, [Linux]:
Process.memory_maps()may return paths ending with" (deleted)".#761, [Windows]:
boot_time()wraps to 0 after 49 days.#766, [Linux]:
net_connections()can’t handle malformed/proc/net/unixfile.#767, [Linux]:
disk_io_counters()may raiseValueErroron 2.6 kernels and it’s broken on 2.4 kernels.#770, [NetBSD]:
disk_io_counters()metrics didn’t update.
3.4.2 — 2016-01-20¶
New APIs
#728, [SunOS]: exposed
PROCFS_PATHconstant to change the default location of/procfilesystem.
Bug fixes
#724, [FreeBSD]:
virtual_memory()totalis incorrect.#730, [FreeBSD]:
virtual_memory()crashes with “OSError: [Errno 12] Cannot allocate memory”.
3.4.1 — 2016-01-15¶
New platforms
#557, [NetBSD]: added NetBSD support. (contributed by Ryo Onodera and Thomas Klausner)
API changes
#718:
process_iter()is now thread safe.
Performance
#708, [Linux]:
net_connections()andProcess.connections()on Python 2 can be up to 3x faster in case of many connections. AlsoProcess.memory_maps()is slightly faster.
Bug fixes
#715, critical: don’t crash at import time if
cpu_times()fail for some reason.#714, [OpenBSD]:
virtual_memory()cachedvalue was always set to 0.#717, [Linux]:
Process.open_files()fails if deleted files still visible.#722, [Linux]:
swap_memory()no longer crashes ifsin/soutcan’t be determined due to missing/proc/vmstat.#724, [FreeBSD]:
virtual_memory()totalis slightly incorrect.
3.3.0 — 2015-11-25¶
New APIs
#558, [Linux]: exposed
PROCFS_PATHconstant to change the default location of/procfilesystem.
New platforms
#615, [OpenBSD]: added OpenBSD support. (contributed by Landry Breuil)
Bug fixes
#692, [POSIX]:
Process.name()is no longer cached as it may change.
3.2.2 — 2015-10-04¶
Bug fixes
#610, [SunOS], build-fail: fix build and tests on Solaris 10
#678, [Linux], build-fail: can’t install psutil due to bug in setup.py.
#688, [Windows], build-fail: compilation fails with MSVC 2015, Python 3.5. (patch by Mike Sarahan)
#690, [Windows], build-fail: can’t compile with MSVC 2015, which enforces the C++11 rule forbidding duplicate values in an unscoped enum.
#517, [SunOS]:
net_io_counters()failed to detect network interfaces correctly on Solaris 10#541, [FreeBSD]:
disk_io_counters()r/w times were expressed in seconds instead of milliseconds. (patch by dasumin)#623, [Linux]: process or system connections raises
ValueErrorif IPv6 is not supported by the system.
3.2.1 — 2015-09-03¶
Bug fixes
#677, [Linux], build-fail: can’t install psutil due to bug in setup.py.
3.2.0 — 2015-09-02¶
New APIs
#644, [Windows]: added support for
CTRL_C_EVENTandCTRL_BREAK_EVENTsignals to use withProcess.send_signal().
API changes
#663, [POSIX]:
net_if_addrs()now returns point-to-point (VPNs) addresses.#655, [Windows]: fix various unicode handling issues. On Python 2, string APIs now return encoded strings using
sys.getfilesystemencoding().
Internals
Bug fixes
#670, [Windows], critical: segfault of
net_if_addrs()in case of non-ASCII NIC names. (patch by sk6249)#659, [Linux], build-fail: compilation error on Suse 10. (patch by @maozguttman)
#664, [Linux], build-fail: compilation error on Alpine Linux. (patch by Bart van Kleef)
#672, [Windows], build-fail: compilation fails if using Windows SDK v8.0. (patch by Steven Winfield)
#513, [Linux]: fixed integer overflow for
RLIM_INFINITY#641, [Windows]: fixed many compilation warnings. (patch by Jeff Tang)
#652, [Windows]:
net_if_addrs()UnicodeDecodeErrorin case of non-ASCII NIC names.#655, [Windows]:
net_if_stats()UnicodeDecodeErrorin case of non-ASCII NIC names.#675, [Linux]:
net_connections():UnicodeDecodeErrormay occur when listing UNIX sockets.
3.1.1 — 2015-07-15¶
Bug fixes
#603, [Linux]:
Process.ionice()set value range is incorrect. (patch by spacewander)#645, [Linux]:
cpu_times_percent()may produce negative results.#656:
from psutil import *does not work.
3.1.0 — 2015-07-15¶
API changes
#534, [Linux]:
disk_partitions()added support for ZFS filesystems.
Documentation
Internals
#646, [Windows]: continuous tests integration for Windows with https://ci.appveyor.com/project/giampaolo/psutil.
#651: continuous code quality test integration with scrutinizer-ci.com
Bug fixes
#340, [Windows], critical:
Process.open_files()no longer hangs (uses a thread with timeout). (patch by Jeff Tang)#627, [Windows]:
Process.name()no longer raisesAccessDeniedfor pids owned by another user.#636, [Windows]:
Process.memory_info()raiseAccessDenied.5ae30c79, [POSIX]: raise exception if trying to send signal to PID 0 as it will affect
os.getpid()‘s process group and not PID 0.#639, [Linux]:
Process.cmdline()can be truncated.#640, [Linux]:
*connectionsfunctions may swallow errors and return an incomplete list of connections.#642:
repr()of exceptions is incorrect.#653, [Windows]: add
inet_ntop()function for Windows XP to support IPv6.#641, [Windows]: replace deprecated string functions with safe equivalents.
3.0.1 — 2015-06-18¶
Bug fixes
#635, [POSIX], critical: crash on module import if
enumpackage is installed on Python < 3.4.#632, [Linux]: better error message if cannot parse process UNIX connections.
#634, [Linux]:
Process.cmdline()does not include empty string arguments.
3.0.0 — 2015-06-13¶
New APIs
#250: new
net_if_stats()returning NIC statistics (isup,duplex,speed,mtu).#376: new
net_if_addrs()returning all NIC addresses a-laifconfig.
API changes
#594, breaking: all deprecated APIs were removed.
#469: on Python >= 3.4
IOPRIO_CLASS_*and*_PRIORITY_CLASSconstants returned byProcess.ionice()andProcess.nice()are enums instead of plain integers.#582: connection constants returned by
net_connections()andProcess.connections()were turned from int to enums on Python > 3.4.#589:
Process.cpu_affinity()accepts any kind of iterable (set, tuple, …), not only lists.#599, [Windows]:
Process.name()can now be determined for all processes even when running as a limited user.
Build and packaging
#587: move native extension into the package.
Internals
#581: add
.gitignore. (patch by Gabi Davar)#602: pre-commit GIT hook.
#629: enhanced support for
pytestandnosetest runners.#616, [Windows]: add
inet_ntop()function for Windows XP.
Bug fixes
#512, [BSD], critical: fix segfault in
net_connections().#586, [FreeBSD], critical:
Process.cpu_affinity()segfaults on set in case an invalid CPU number is provided.#593, [FreeBSD], critical:
Process.memory_maps()segfaults.#607, [Linux], build-fail: can’t compile on old RedHat versions where
DUPLEX_UNKNOWNis not defined.#428, [POSIX]: correct handling of zombie processes on POSIX. Introduced new
ZombieProcessexception class.#555, [Linux]:
users()correctly handles":0"as an alias for"localhost".#579, [Windows]: fixed
Process.open_files()for PID > 64K.#579, [Windows]: fixed many compiler warnings.
#585, [FreeBSD]:
net_connections()may raiseKeyError.#606:
Process.parent()may swallowNoSuchProcessexceptions.#611, [SunOS]:
net_io_counters()has send and received swapped#614, [Linux]::
cpu_count()withlogical=Falsereturn the number of sockets instead of cores.#618, [SunOS]: swap tests fail on Solaris when run as normal user.
#628, [Linux]:
Process.name()truncates string in case it contains spaces or parentheses.
2.2.1 — 2015-02-02¶
Bug fixes
#572, [Linux]: fix “ValueError: ambiguous inode with multiple PIDs references” for
Process.connections(). (patch by Bruno Binet)
2.2.0 — 2015-01-06¶
New APIs
#569, [FreeBSD]: add support for
Process.cpu_affinity()on FreeBSD.
Internals
#553: add scripts/pstree.py.
#568: add scripts/pidof.py.
Dropped support
#521, breaking: drop support for Python 2.4 and 2.5.
Bug fixes
#496, [SunOS], critical: can’t import psutil.
#556, [Linux], memleak: lots of file handles were left open.
#569, [FreeBSD], memleak: fix memory leak in
cpu_count()withlogical=False.#547, [POSIX]:
Process.username()may raiseKeyErrorif UID can’t be resolved.#551, [Windows]: get rid of the unicode hack for
net_io_counters()NIC names.#561, [Linux]:
net_connections()might skip some legitimate UNIX sockets. (patch by spacewander)#564: C extension version mismatch is now detected at import time.
#565, [Windows]: use proper encoding for
Process.username()andusers(). (patch by Sylvain Mouquet)#567, [Linux]: in the alternative implementation of
Process.cpu_affinity()PyList_AppendandPy_BuildValuereturn values are not checked.#571, [Linux]:
Process.open_files()might swallowAccessDeniedexceptions and return an incomplete list of open files.
2.1.3 — 2014-09-26¶
Bug fixes
#536, [Linux], build-fail: fix “undefined symbol: CPU_ALLOC” compilation error.
2.1.2 — 2014-09-21¶
Build and packaging
#505, [Windows]: distribution as wheel packages.
Internals
#407: project moved from Google Code to Github; code moved from Mercurial to Git.
#492: use
toxto run tests on multiple Python versions. (patch by msabramo)#511: add scripts/ps.py.
Bug fixes
#340, [Windows], critical:
Process.open_files()no longer hangs. (patch by Jeff Tang)#501, [Windows]:
disk_io_counters()may return negative values.#503, [Linux]: in rare conditions
Process.exe(),Process.open_files()andProcess.connections()can raiseOSError(ESRCH)instead ofNoSuchProcess.#504, [Linux]: can’t build RPM packages via setup.py
#506, [Linux]: Python 2.4 support was broken.
#522, [Linux]:
Process.cpu_affinity()might returnEINVAL. (patch by David Daeschler)#529, [Windows]:
Process.exe()may raise unhandledWindowsErrorexception for PIDs 0 and 4. (patch by Jeff Tang)#530, [Linux]:
disk_io_counters()may crash on old Linux distros (< 2.6.5) (patch by Yaolong Huang)#533, [Linux]:
Process.memory_maps()may raiseTypeErroron old Linux distros.
2.1.1 — 2014-04-30¶
Bug fixes
#446, [Windows]: fix encoding error when using
net_io_counters()on Python 3. (patch by Szigeti Gabor Niif)#460, [Windows]:
net_io_counters()wraps after 4G.#497, [Linux]:
net_connections()exceptions. (patch by Alexander Grothe)
2.1.0 — 2014-04-08¶
New APIs
#387: system-wide open connections a-la
netstat(addnet_connections()).
Bug fixes
#421, [SunOS], build-fail: psutil does not compile on SunOS 5.10. (patch by Naveed Roudsari)
#489, [Linux]:
disk_partitions()return an empty list.
2.0.0 — 2014-03-10¶
New APIs
#427: add
cpu_count().
API changes
#447:
wait_procs()timeout parameter is now optional.#452: make
Processinstances hashable and usable withset()s.
For the sake of consistency a lot of psutil APIs have been renamed. In most
cases accessing the old names will work but it will cause a
DeprecationWarning.
psutil.*module level constants have being replaced by functions:Old name
Replacement
psutil.NUM_CPUS
psutil.cpu_count()
psutil.BOOT_TIME
psutil.boot_time()
psutil.TOTAL_PHYMEM
virtual_memory.total
Renamed
psutil.*functions:Old name
Replacement
psutil.get_pid_list()
psutil.pids()
psutil.get_users()
psutil.users()
psutil.get_boot_time()
psutil.boot_time()
All
Processget_*methods lost theget_prefix. E.g.get_ext_memory_info()was renamed tomemory_info_ex(). Assumingp = psutil.Process():Old name
Replacement
p.get_children()
p.children()
p.get_connections()
p.connections()
p.get_cpu_affinity()
p.cpu_affinity()
p.get_cpu_percent()
p.cpu_percent()
p.get_cpu_times()
p.cpu_times()
p.get_ext_memory_info()
p.memory_info_ex()
p.get_io_counters()
p.io_counters()
p.get_ionice()
p.ionice()
p.get_memory_info()
p.memory_info()
p.get_memory_maps()
p.memory_maps()
p.get_memory_percent()
p.memory_percent()
p.get_nice()
p.nice()
p.get_num_ctx_switches()
p.num_ctx_switches()
p.get_num_fds()
p.num_fds()
p.get_num_threads()
p.num_threads()
p.get_open_files()
p.open_files()
p.get_rlimit()
p.rlimit()
p.get_threads()
p.threads()
p.getcwd()
p.cwd()
All
Processset_*methods lost theset_prefix. Assumingp = psutil.Process():Old name
Replacement
p.set_nice()
p.nice(value)
p.set_ionice()
p.ionice(ioclass, value=None)
p.set_cpu_affinity()
p.cpu_affinity(cpus)
p.set_rlimit()
p.rlimit(resource, limits=None)
Except for
pid, allProcessclass properties have been turned into methods. This is the only case which there are no aliases. Assumingp = psutil.Process():Old name
Replacement
p.name
p.name()
p.parent
p.parent()
p.ppid
p.ppid()
p.exe
p.exe()
p.cmdline
p.cmdline()
p.status
p.status()
p.uids
p.uids()
p.gids
p.gids()
p.username
p.username()
p.create_time
p.create_time()
#479, breaking: long deprecated
psutil.errormodule is gone; exception classes now live in “psutil” namespace only.#463: timeout parameter of
cpu_percent*functions defaults to 0.0 instead of 0.1, avoiding a common source of accidental slowdowns.Processinstances’retcodeattribute returned bywait_procs()has been renamed toreturncodefor consistency withsubprocess.Popen.
Performance
#477:
Process.cpu_percent()is about 30% faster. (suggested by crusaderky)#478, [Linux]: almost all APIs are about 30% faster on Python 3.X.
Build and packaging
#424, [Windows]: installer for Python 3.X 64 bit.
Documentation
#468: move documentation to readthedocs.com.
Internals
#453: tests on Python < 2.7 require
unittest2module.#459: add a Makefile for running tests and other repetitive tasks (also on Windows).
Bug fixes
#340, [Windows], critical:
Process.open_files()no longer hangs. (patch by jtang@vahna.net)#448, [Windows], memleak:
Process.children()andProcess.ppid()memory leak (patch by Ulrich Klank).#193:
Popenconstructor can throw an exception if the spawned process terminates quickly.#443, [Linux]: fix a potential overflow issue for
Process.cpu_affinity()(set) on systems with more than 64 CPUs.#457, [POSIX]:
pid_exists()always returnsTruefor PID 0.#461: named tuples are not pickle-able.
#466, [Linux]:
Process.exe()improper null bytes handling. (patch by Gautam Singh)#470:
wait_procs()might not wait. (patch by @crusaderky)#471, [Windows]:
Process.exe()improper unicode handling. (patch by alex@mroja.net)#473:
Popenwait()method does not setreturncodeattribute.#474, [Windows]:
Process.cpu_percent()is no longer capped at 100%.#476, [Linux]: encoding error for
Process.name()andProcess.cmdline().
1.2.1 — 2013-11-25¶
Bug fixes
#348, [Windows], critical: fixed “ImportError: DLL load failed” occurring on module import on Windows XP.
#425, [SunOS], critical: crash on import due to failure at determining
BOOT_TIME.#443, [Linux]:
Process.cpu_affinity()can’t set affinity on systems with more than 64 cores.
1.2.0 — 2013-11-20¶
New APIs
#440: new
wait_procs()utility function which waits for multiple processes to terminate.
API changes
#439: assume
os.getpid()if no argument is passed toProcessclass constructor.
Bug fixes
#348, [Windows], critical: fix “ImportError: DLL load failed” occurring on module import on Windows XP / Vista.
1.1.3 — 2013-11-07¶
Bug fixes
#442, [Linux], build-fail: psutil won’t compile on certain version of Linux because of missing prlimit(2) syscall.
1.1.2 — 2013-10-22¶
Bug fixes
#442, [Linux], build-fail: psutil won’t compile on Debian 6.0 because of missing prlimit(2) syscall.
1.1.1 — 2013-10-08¶
Bug fixes
#442, [Linux], build-fail: psutil won’t compile on kernels < 2.6.36 due to missing prlimit(2) syscall.
1.1.0 — 2013-09-28¶
New APIs
#412, [Linux]: add
Process.rlimit().
API changes
#408: turn
STATUS_*andCONN_*constants into plain Python strings.
Performance
#415, [Windows]:
Process.children()is an order of magnitude faster.#426, [Windows]:
Process.name()is an order of magnitude faster.#431, [POSIX]:
Process.name()is slightly faster because it unnecessarily retrieved alsoProcess.cmdline().
Build and packaging
#410: host tar.gz and Windows binary files are on PyPI.
Bug fixes
#413, [Windows], memleak:
Process.memory_info()leaks memory.#392, [Windows]:
cpu_times_percent()returns negative percentages.#408:
STATUS_*andCONN_*constants don’t properly serialize on JSON.#411, [Windows]: scripts/disk_usage.py may pop-up a GUI error.
#414, [Windows]:
Process.exe()on Windows XP may raiseERROR_INVALID_PARAMETER.#416:
disk_usage()doesn’t work well with unicode path names.#430, [Linux]:
Process.io_counters()report wrong number of r/w syscalls.#435, [Linux]:
net_io_counters()might report erreneous NIC names.#436, [Linux]:
net_io_counters()reports a wrongdropinvalue.
1.0.1 — 2013-07-12¶
Bug fixes
#405:
net_io_counters()pernic=Trueno longer works as intended in 1.0.0.
1.0.0 — 2013-07-10¶
New platforms
#18, [SunOS]: add Solaris support (yay!) (thanks Justin Venus)
API changes
#367:
Process.connections()statusis no longer a string but a constant object (psutil.CONN_*).Process.connections()local_addressandremote_addressfields renamed toladdrandraddr.psutil.network_io_counters() renamed to
net_io_counters().
Internals
#380: test suite exits with non-zero on failure. (patch by floppymaster)
#391: introduce unittest2 facilities and provide workarounds if unittest2 is not installed (Python < 2.7).
Bug fixes
#404, [Linux], build-fail:
sched_*affinity()are implicitly declared. (patch by Arfrever)#374, [Windows]: negative memory usage reported if process uses a lot of memory.
#379, [Linux]:
Process.memory_maps()may raiseValueError.#394, [macOS]: mapped memory regions of
Process.memory_maps()report incorrect file name.
0.7.1 — 2013-05-03¶
Bug fixes
#325, [BSD]:
virtual_memory()can raiseSystemError. (patch by Jan Beich)#370, [BSD]:
Process.connections()requires root. (patch by John Baldwin)#372, [BSD]: different process methods raise
NoSuchProcessinstead ofAccessDenied.
0.7.0 — 2013-04-12¶
New APIs
#328, [Windows]:
Process.ionice()support.#359: add
boot_time()as a substitute ofpsutil.BOOT_TIMEsince the latter cannot reflect system clock updates.#361, [Linux]:
cpu_times()now includes newsteal,guestandguest_nicefields available on recent Linux kernels. Also,cpu_percent()is more accurate.#362: add
cpu_times_percent()(per-CPU-time utilization as a percentage).
API changes
#246: psutil.error module is deprecated and scheduled for removal.
Internals
#233: code migrated to Mercurial (yay!)
Bug fixes
#313, [Linux], critical:
virtual_memory()andswap_memory()can crash on certain exotic Linux flavors having an incomplete/procinterface. If that’s the case we now set the unretrievable stats to0and raiseRuntimeWarninginstead.#341, [Linux], critical: psutil might crash on import due to error in retrieving system terminals map.
#333, [macOS], memleak: leak of Mach ports (patch by @rsesek)
#339, [FreeBSD], memleak:
get_pid_list()can allocate all the memory on system.#234, [Windows]:
disk_io_counters()fails to list certain disks.#264, [Windows]: use of
disk_partitions()may cause a message box to appear.#315, [macOS]: fix some compilation warnings.
#317, [Windows]: cannot set process CPU affinity above 31 cores.
#319, [Linux]:
Process.memory_maps()raisesKeyError‘Anonymous’ on Debian squeeze.#321, [POSIX]:
Process.ppid()property is no longer cached as the kernel may set the PPID to 1 in case of a zombie process.#323, [macOS]:
disk_io_counters()read_timeandwrite_timeparameters were reporting microseconds not milliseconds. (patch by Gregory Szorc)#331:
Process.cmdline()is no longer cached after first access as it may change.#337, [Linux]:
Processmethods not working because of a poor/procimplementation will raiseNotImplementedErrorrather thanRuntimeErrorandProcess.as_dict()will not blow up. (patch by Curtin1060)#338, [Linux]:
disk_io_counters()fails to find some disks.#344, [FreeBSD]:
swap_memory()might return incorrect results due tokvm_open(3)not being called. (patch by Jean Sebastien)#351, [Windows]: if psutil is compiled with MinGW32 (provided installers for py2.4 and py2.5 are)
disk_io_counters()will fail. (Patch by m.malycha)#356:
Process.parent()now checks whether parent PID has been reused in which case returnsNone.#365:
Process.nice()(set) should check PID has not been reused by another process.#366, [FreeBSD]:
Process.memory_maps(),Process.num_fds(),Process.open_files()andProcess.cwd()methods raiseRuntimeErrorinstead ofAccessDenied.
0.6.1 — 2012-08-16¶
API changes
#316:
Process.cmdline()property now makes a better job at guessing the process executable from the cmdline.Process.exe()can now return an empty string instead of raisingAccessDenied.
Bug fixes
#316:
Process.exe()was resolved in case it was a symlink.#318: Python 2.4 compatibility was broken.
0.6.0 — 2012-08-13¶
New APIs
#216, [POSIX]: add
Process.connections()UNIX sockets support.#222, [macOS]: add support for
Process.cwd().#261: add
Process.memory_info_ex().#311: add
virtual_memory()andswap_memory(). Old memory-related functions are deprecated. New example scripts: scripts/free.py and scripts/meminfo.py.#312:
net_io_counters()adds 4 new fields:errin,errout,dropinanddropout.
API changes
#295, [macOS]:
Process.exe()path is now determined by asking the OS instead of being guessed fromProcess.cmdline().#297, [macOS]:
Process.name(),Process.memory_info(),Process.memory_percent(),Process.cpu_times(),Process.cpu_percent(),Process.num_threads()no longer raiseAccessDeniedfor other users’ processes and are 2.5x faster.#301:
process_iter()now yields processes sorted by their PIDs.#304, [Windows]:
Process.create_time(),Process.cpu_times(),Process.cpu_percent(),Process.memory_info(),Process.memory_percent(),Process.num_handles(),Process.io_counters()no longer raiseAccessDeniedfor other users’ processes.psutil.phymem_usage()is deprecated (usevirtual_memory())psutil.virtmem_usage()is deprecated (useswap_memory())[Linux]:
psutil.phymem_buffers()is deprecated (usevirtual_memory())[Linux]:
psutil.cached_phymem()is deprecated (usevirtual_memory())
Performance
#220, [FreeBSD]:
net_connections()has been rewritten in C and no longer requireslsof.
Internals
#300: add scripts/pmap.py.
6e45ac1a: add scripts/netstat.py.
Bug fixes
#303, [Windows], critical: potential heap corruption in
Process.num_threads()andProcess.status()methods.#306, critical: at C level, errors are not checked when invoking
Py*functions which create or manipulate Python objects leading to potential memory related errors and/or segmentation faults.#305, [FreeBSD], build-fail: can’t compile on FreeBSD 9 due to removal of
utmp.h.#298, [macOS], [BSD], memleak: memory leak in
Process.num_fds().#299, memleak: potential memory leak every time
PyList_New(0)is used.#307, [FreeBSD]: values returned by
net_io_counters()are wrong.#308, [BSD], [Windows]:
psutil.virtmem_usage()wasn’t actually returning information about swap memory usage as it was supposed to do. It does now.#310:
Process.open_files()might not return files which can not be accessed due to limited permissions.AccessDeniedis now raised instead.
0.5.1 — 2012-06-29¶
API changes
#293, [Windows]:
Process.exe()path is now determined by asking the OS instead of being guessed fromProcess.cmdline().
Bug fixes
#292, [Linux]: race condition in process
Process.open_files(),Process.connections(),Process.threads().#294, [Windows]:
Process.cpu_affinity()is only able to set CPU #0.
0.5.0 — 2012-06-27¶
New APIs
#195, [Windows]: add
Process.num_handles().#209:
disk_partitions()now provides also mount options.#238, [Linux], [Windows]: add
Process.cpu_affinity().#242: add
recursive=TruetoProcess.children(): return all process descendants.#260: add
Process.memory_maps(). (Windows patch by @wj32, macOS patch by Jeremy Whitlock)#278: add
Process.as_dict().#284, [POSIX]: add
Process.num_fds().
API changes
#273:
psutil.get_process_list()is deprecated.#281:
Process.ppid(),Process.name(),Process.exe(),Process.cmdline()andProcess.create_time()are now cached after first access, soNoSuchProcessis no longer raised if the process is gone in the meantime.#282:
psutil.STATUS_*constants can now be compared by using their string representation.#290:
Process.nice()property is deprecated in favor of newget_nice()andset_nice()methods.
Performance
#245, [POSIX]:
Process.wait()incrementally consumes less CPU cycles.#258, [Linux]:
Process.memory_info()is now 0.5x faster.#262, [Windows]:
disk_partitions()was slow due to inspecting the floppy disk drive also when parameter isall=False.#283: speedup
Process.is_running()by caching its return value in case the process is terminated.#287:
process_iter()now cachesProcessinstances between calls.
Build and packaging
#274: psutil no longer requires
2to3at installation time in order to work with Python 3.
Dropped support
#257, [Windows], breaking: removed Windows 2000 support.
Bug fixes
#240, [macOS], critical: incorrect use of
free()forProcess.connections().#193:
Popenconstructor can throw an exception if the spawned process terminates quickly.#244, [POSIX]:
Process.wait()can hog CPU resources if called against a process which is not our children.#248, [Linux]:
net_io_counters()might return erroneous NIC names.#252, [Windows]:
Process.cwd()erroneously raiseNoSuchProcessfor processes owned by another user. It now raisesAccessDeniedinstead.#266, [Windows]:
psutil.get_pid_list()only shows 1024 processes. (patch by @amoser)#267, [macOS]:
Process.connections()returns wrong remote address. (Patch by Amoser)#272, [Linux]:
Process.open_files()potential race condition can lead to unexpectedNoSuchProcessexception. Also, we can get incorrect reports of not absolutized path names.#275, [Linux]:
Process.io_counters()erroneously raiseNoSuchProcesson old Linux versions. Where not available it now raisesNotImplementedError.#286:
Process.is_running()doesn’t actually check whether PID has been reused.#314:
Process.children()can sometimes return non-children.
0.4.1 — 2011-12-14¶
Bug fixes
#230, [Windows], [macOS], memleak: fix memory leak in
Process.connections().#236, [Windows], memleak: fix memory/handle leak in
Process.memory_info(),Process.suspend()andProcess.resume()methods.#228: some example scripts were not working with Python 3.
#232, [Linux]:
psutil.phymem_usage()can report erroneous values which are different thanfreecommand.
0.4.0 — 2011-10-29¶
New APIs
#150: add
net_io_counters()(macOS and Windows patch by Jeremy Whitlock)#154, [FreeBSD]: add support for
Process.cwd().#206: add
disk_io_counters()). (macOS and Windows patch by Jeremy Whitlock)#217:
Process.connections()now has a kind argument to filter for connections with different criteria.
API changes
#198:
Process.wait()withtimeout=0can now be used to make the function return immediately.
Performance
#221, [FreeBSD]:
Process.open_files()has been rewritten in C and no longer relies onlsof.
Build and packaging
#157, [Windows]: provide installer for Python 3.2 64-bit.
Internals
#213: add scripts/iotop.py.
#223: add scripts/top.py.
#227: add scripts/nettop.py.
Bug fixes
#188, [Linux], critical: psutil import error on Linux ARM architectures.
#200, [Linux], critical:
psutil.NUM_CPUSnot working on armel and sparc architectures and causing crash on module import.#218, [Linux], critical: crash at import time on Debian 64-bit because of a missing line in
/proc/meminfo.#226, [FreeBSD], critical: crash at import time on FreeBSD 7 and minor.
#144, [Linux]: no longer support 0 special PID.
#194, [POSIX]:
Process.cpu_percent()now reports a percentage over 100 on multi core processors.#197, [Linux]:
Process.connections()is broken on platforms not supporting IPv6.#201, [Linux]:
Process.connections()is broken on big-endian architectures.#211:
Processinstance can unexpectedly raiseNoSuchProcessif tested for equality with another object.
0.3.0 — 2011-07-08¶
New APIs
#125: add
cpu_times()andcpu_percent()per-cpu support.#163: add
Process.terminal().#171: add
get_phymem()andget_virtmem(). Oldtotal_*,avail_*andused_*memory functions are deprecated.#172: add
disk_usage().#174: add
disk_partitions().
Build and packaging
#179: setuptools is now used in setup.py
Bug fixes
#159, [Windows], memleak:
SetSeDebug()does not close handles or unset impersonation on return.#166, memleak:
Process.memory_info()leaks handles hogging system resources.#178, [macOS], memleak:
Process.threads()leaks memory.#164, [Windows]:
Process.wait()raises aTimeoutExceptionwhen a process returns-1.#165:
Process.status()raises an unhandled exception.#168:
cpu_percent()returns erroneous results when used in non-blocking mode. (patch by Philip Roberts)#180, [Windows]:
Process.num_threads()andProcess.threads()methods can raiseNoSuchProcessexception while process still exists.
0.2.1 — 2011-03-20¶
New APIs
#64: add
Process.io_counters().#116: add
Process.wait().#134: add
Process.threads().#137: add
Process.uids()andProcess.gids().#140: add
boot_time().#142: add
Process.nice().#143: add
Process.status().#147, [Linux]: add
Process.ionice().#148: add
Popenclass combiningsubprocess.PopenandProcessin a single interface.
API changes
#136, [FreeBSD]:
Process.exe()path is now determined by asking the kernel instead of guessing it from cmdline[0].Processuidandgidproperties are deprecated in favor ofuidsandgidsproperties.
Performance
#152, [macOS]:
Process.open_files()rewritten in C (no longer relies onlsof, 3x faster).#153, [macOS]:
Process.connections()rewritten in C (no longer relies onlsof, 3x faster).
Bug fixes
#83, [macOS]:
Process.cmdline()is empty on macOS 64-bit.#130, [Linux]: a race condition can cause
IOErrorexception be raised on if process disappears betweenopen()and the subsequentread()call.#145, [Windows]:
WindowsErrorwas raised instead ofAccessDeniedwhen usingProcess.resume()orProcess.suspend().#146, [Linux]:
Process.exe()property can raiseTypeErrorif path contains NULL bytes.#151, [Linux]:
Process.exe()andProcess.cwd()for PID 0 return inconsistent data.
0.2.0 — 2010-11-13¶
New APIs
#79: add
Process.open_files().#88: total system physical cached memory.
#88: total system physical memory buffers used by the kernel.
#91: add
Process.send_signal()andProcess.terminate()methods.#95:
NoSuchProcessandAccessDeniedexception classes now providepid,nameandmsgattributes.#97: add
Process.children().#103: add
Process.connections().#111: add
Process.exe().#123:
cpu_percent()andProcess.cpu_percent()accept a new interval parameter.#129: add
Process.threads().
New platforms
#107, [Windows]: add support for Windows 64 bit. (patch by cjgohlke)
#117, [Windows]: added support for Windows 2000.
API changes
#98:
Process.cpu_times()andProcess.memory_info()now return a named tuple instead of a tuple.#113: exception messages now include
Process.name()andProcess.pid.psutil.Process.pathproperty is deprecated and works as an alias forpsutil.Process.exeproperty.Process.kill(): signal argument was removed - to send a signal to the process useProcess.send_signal()method instead.cpu_times()returns a named tuple instead of a tuple.Process.cpu_percent()andcpu_percent()no longer returns immediately by default (see #123).
Performance
#114, [Windows]:
Process.username()rewritten in C (no longer uses WMI, much faster, pywin32 no longer required). (patch by @wj32)
Bug fixes
#81, [Windows], build-fail: psutil fails to compile with Visual Studio.
#86, [FreeBSD], build-fail: psutil didn’t compile against FreeBSD 6.x.
#102, [Windows], memleak: orphaned process handles obtained by using
OpenProcessin C were left behind every timeProcessclass was instantiated.#80: fixed warnings when installing psutil with easy_install.
#94:
Process.suspend()raisesOSErrorinstead ofAccessDenied.#111, [POSIX]:
pathandnameProcessproperties report truncated or erroneous values on POSIX.#120, [macOS]:
cpu_percent()always returning 100%.#112:
uidandgidproperties don’t change if process changes effective user/group id at some point.#126:
Process.ppid(),Process.uids(),Process.gids(),Process.name(),Process.exe(),Process.cmdline()andProcess.create_time()properties are no longer cached and correctly raiseNoSuchProcessexception if the process disappears.
0.1.3 — 2010-03-02¶
New APIs
#51, [Linux], [Windows]: add
Process.cwd().#71: add
Process.suspend()andProcess.resume().
New platforms
Performance
#59:
Process.is_running()is now 10 times faster.
Bug fixes
#49, [FreeBSD], memleak: possible memory leak due to missing
free()on error condition ingetcmdpath().#62, [Windows], memleak:
Process.cwd()leaked a string object on every call.#36:
Process.cpu_times()andProcess.memory_info()functions succeeded. also for dead processes while aNoSuchProcessexception is supposed to be raised.#48, [FreeBSD]: incorrect size for MIB array defined in
getcmdargs.#50, [macOS]: fixed
getcmdargs()memory fragmentation.#55, [Windows]:
test_pid_4was failing on Windows Vista.#57: some unit tests were failing on systems where no swap memory is available.
#58:
Process.is_running()is now called beforeProcess.kill()to make sure we are going to kill the correct process.#73, [macOS]: virtual memory size reported on includes shared library size.
#77:
NoSuchProcesswasn’t raised onProcess.create_time()ifProcess.kill()was used first.
0.1.2 — 2009-05-06¶
New APIs
#32: add
Process.cpu_times().#33: add
Process.create_time().#34: add
Process.cpu_percent().#38: add
Process.memory_info().#41: add
Process.memory_percent().#39: add
boot_time().#43: Total system virtual memory.
#46: Total system physical memory.
#44: Total system used/free virtual and physical memory.
Bug fixes
#36, [Windows]:
NoSuchProcessnot raised when accessing timing methods.#40, [FreeBSD], [macOS]: fix
test_get_cpu_timesfailures.#42, [Windows]:
Process.memory_percent()raisesAccessDenied.
0.1.1 — 2009-03-06¶
New APIs
#9, [macOS], [Windows]: add
Process.uidandProcess.gid, returning process UID and GID.#11: per-process parent object:
Process.parent()property returns aProcessobject representing the parent process, andProcess.ppid()returns the parent PID.#21, [Windows]:
AccessDeniedexception created for raising access denied errors fromOSErrororWindowsErroron individual platforms.#26:
process_iter()function to iterate over processes asProcessobjects with a generator.
New platforms
#4, [FreeBSD]: support for all functions of psutil.
API changes
#12, #15:
NoSuchProcessexception now raised when creating an object for a nonexistent process, or when retrieving information about a process that has gone away.Processobjects can now also be compared with == operator for equality (PID, name, command line are compared).
Bug fixes
#16, [Windows]: Special case for “System Idle Process” (PID 0) which otherwise would return an “invalid parameter” exception.
#17:
get_process_list()ignoresNoSuchProcessandAccessDeniedexceptions during building of the list.#22, [Windows]:
Process.kill()for PID 0 was failing with an unset exception.#23, [Linux], [macOS]: create special case for
pid_exists()with PID 0.#24, [Windows]:
Process.kill()for PID 0 now raisesAccessDeniedexception instead ofWindowsError.#30: psutil.get_pid_list() was returning two 0 PIDs.
0.1.0 — 2009-01-27¶
Initial release. Supports Linux, Windows, and macOS via per-platform backends
(_pslinux, _psmswindows, _psosx) with C extensions for Windows and
macOS.
New APIs
Processclass exposingpid,name,path, andcmdline, with akill()method.get_process_list()returning all running processes.ProcessInfovalue object passed between the public API and the platform backends.