psutil Changelog

What's new in psutil 5.9.8

Mar 25, 2024
  • Enhancements:
  • 2343, [FreeBSD]: filter net_connections() returned list in C instead of Python, and avoid to retrieve unnecessary connection types unless explicitly asked. E.g., on an IDLE system with few IPv6 connections this will run around 4 times faster. Before all connection types (TCP, UDP, UNIX) were retrieved internally, even if only a portion was returned.
  • 2342, [NetBSD]: same as above (#2343) but for NetBSD.
  • 2349: adopted black formatting style.
  • Bug fixes:
  • 930, [NetBSD], [critical]: net_connections() implementation was broken. It could either leak memory or core dump.
  • 2340, [NetBSD]: if process is terminated, Process.cwd() will return an empty string instead of raising NoSuchProcess.
  • 2345, [Linux]: fix compilation on older compiler missing DUPLEX_UNKNOWN.
  • 2222, [macOS]: cpu_freq() now returns fixed values for min and max frequencies in all Apple Silicon chips.

New in psutil 5.9.7 (Dec 18, 2023)

  • Enhancements
  • 2324: enforce Ruff rule raw-string-in-exception, which helps providing clearer tracebacks when exceptions are raised by psutil.
  • Bug fixes
  • 2325, [PyPy]: psutil did not compile on PyPy due to missing PyErr_SetExcFromWindowsErrWithFilenameObject cPython API.

New in psutil 5.9.6 (Oct 15, 2023)

  • Enhancements:
  • cpu_percent() and cpu_times_percent() are now thread safe, meaning they can be called from different threads and still return meaningful and independent results. Before, if (say) 10 threads called cpu_percent(interval=None) at the same time, only 1 thread out of 10 would get the right result.
  • If Process class is passed a very high PID, raise NoSuchProcess instead of OverflowError. (patch by Xuehai Pan)
  • Drop python 3.4 & 3.5 support. (patch by Matthieu Darbois)
  • PID reuse is now pre-emptively checked for Process.ppid() and Process.parents().
  • Use ruff Python linter instead of flake8 + isort. It's an order of magnitude faster + it adds a ton of new code quality checks.
  • Bug fixes:
  • [NetBSD]: can't compile On NetBSD 10.99.3/amd64. (patch by Thomas Klausner)
  • [Windows]: fix var unbound error on possibly in swap_memory() (patch by student_2333)
  • bytes2human() utility function was unable to properly represent negative values.
  • [Windows]: disk_usage() fails on Python 3.12+. (patch by Matthieu Darbois)
  • [OpenBSD], [NetBSD]: Process.is_running() erroneously return False for zombie processes, because creation time cannot be determined.
  • Differently from what stated in the doc, PID reuse is not pre-emptively checked for Process.nice() (set), Process.ionice(), (set), Process.cpu_affinity() (set), Process.rlimit() (set), Process.parent().
  • [OpenBSD]: Process.threads() always fail with AccessDenied (also as root).

New in psutil 5.9.5 (Apr 18, 2023)

  • Enhancements:
  • 2196: in case of exception, display a cleaner error traceback by hiding the KeyError bit deriving from a missed cache hit.
  • 2217: print the full traceback when a DeprecationWarning or UserWarning is raised.
  • 2230, [OpenBSD]: `psutil.net_connections`_ implementation was rewritten from scratch: - We're now able to retrieve the path of AF_UNIX sockets (before it was an
  • empty string)
  • The function is faster since it no longer iterates over all processes.
  • No longer produces duplicate connection entries.
  • 2238: there are cases where Process.cwd() cannot be determined (e.g. directory no longer exists), in which case we returned either None or an empty string. This was consolidated and we now return "" on all platforms.
  • 2239, [UNIX]: if process is a zombie, and we can only determine part of the its truncated Process.name() (15 chars), don't fail with ZombieProcess when we try to guess the full name from the Process.cmdline(). Just return the truncated name.
  • 2240, [NetBSD], [OpenBSD]: add CI testing on every commit for NetBSD and OpenBSD platforms (python 3 only).
  • Bug fixes:
  • 1043, [OpenBSD] `psutil.net_connections`_ returns duplicate entries.
  • 1915, [Linux]: on certain kernels, "MemAvailable" field from /proc/meminfo returns 0 (possibly a kernel bug), in which case we calculate an approximation for available memory which matches "free" CLI utility.
  • 2164, [Linux]: compilation fails on kernels < 2.6.27 (e.g. CentOS 5).
  • 2186, [FreeBSD]: compilation fails with Clang 15. (patch by Po-Chuan Hsieh)
  • 2191, [Linux]: disk_partitions(): do not unnecessarily read /proc/filesystems and raise AccessDenied unless user specified all=False argument.
  • 2216, [Windows]: fix tests when running in a virtual environment (patch by Matthieu Darbois)
  • 2225, [POSIX]: users() loses precision for started attribute (off by 1 minute).
  • 2229, [OpenBSD]: unable to properly recognize zombie processes. NoSuchProcess may be raised instead of ZombieProcess.
  • 2231, [NetBSD]: available virtual_memory() is higher than total.
  • 2234, [NetBSD]: virtual_memory() metrics are wrong: available and used are too high. We now match values shown by htop CLI utility.
  • 2236, [NetBSD]: Process.num_threads() and Process.threads() return threads that are already terminated.
  • 2237, [OpenBSD], [NetBSD]: Process.cwd() may raise FileNotFoundError if cwd no longer exists. Return an empty string instead.

New in psutil 5.9.4 (Nov 8, 2022)

  • Enhancements:
  • 2102: use Limited API when building wheels with CPython 3.6+ on Linux, macOS and Windows. This allows to use pre-built wheels in all future versions of cPython 3. (patch by Matthieu Darbois)
  • Bug fixes:
  • 2077, [Windows]: Use system-level values for virtual_memory(). (patch by Daniel Widdis)
  • 2156, [Linux]: compilation may fail on very old gcc compilers due to missing SPEED_UNKNOWN definition. (patch by Amir Rossert)
  • 2010, [macOS]: on MacOS, arm64 IFM_1000_TX and IFM_1000_T are the same value, causing a build failure. (patch by Lawrence D'Anna)

New in psutil 5.9.3 (Oct 19, 2022)

  • Enhancements:
  • 2040, [macOS]: provide wheels for arm64 architecture. (patch by Matthieu Darbois)
  • Bug fixes:
  • 2116, [macOS], [critical]: `psutil.net_connections`_ fails with RuntimeError.
  • 2135, [macOS]: Process.environ() may contain garbage data. Fix out-of-bounds read around sysctl_procargs. (patch by Bernhard Urban-Forster)
  • 2138, [Linux], [critical]: can't compile psutil on Android due to undefined ethtool_cmd_speed symbol.
  • 2142, [POSIX]: net_if_stats() 's flags on 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 raise NoSuchProcess. Fix race condition. (patch by Daniel Li)
  • 2153, [macOS] Fix race condition in test_posix.TestProcess.test_cmdline. (patch by Matthieu Darbois)

New in psutil 5.9.2 (Sep 5, 2022)

  • 2093, [FreeBSD], [critical]: pids() may fail with ENOMEM. Dynamically increase the malloc() buffer size until it's big enough.
  • 2095, [Linux]: net_if_stats() returns incorrect interface speed for 100GbE network cards.
  • 2113, [FreeBSD], [critical]: 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)

New in psutil 5.9.1 (May 22, 2022)

  • Enhancements:
  • Drop Python 2.6 support. (patches by Matthieu Darbois and Hugo van Kemenade)
  • [Linux]: increase read(2) buffer size from 1k to 32k when reading /proc pseudo files line by line. This should help having more consistent results.
  • [OpenBSD]: add support for cpu_freq().
  • [Linux]: Process.memory_full_info() (reporting process USS/PSS/Swap memory) now reads /proc/pid/smaps_rollup instead of /proc/pids/smaps, which makes it 5 times faster.
  • Bug fixes:
  • AttributeError is raised if psutil.Error class is raised manually and passed through str.
  • [Linux]: cpu_freq() erroneously returns curr value in GHz while min and max are in MHz.
  • [Linux]: virtual_memory() may raise ValueError if running in a LCX container.

New in psutil 5.9.0 (Dec 30, 2021)

  • Enhancements:
  • 1851, [Linux]: cpu_freq() is slow on systems with many CPUs. Read current frequency values for all CPUs from /proc/cpuinfo instead of opening many files in /sys fs. (patch by marxin)
  • 1992: NoSuchProcess message now specifies if the PID has been reused.
  • 1992: error classes (NoSuchProcess, AccessDenied, etc.) now have a better formatted and separated __repr__ and __str__ implementations.
  • 1996, [BSD]: add support for MidnightBSD. (patch by Saeed Rasooli)
  • 1999, [Linux]: disk_partitions(): convert /dev/root device (an alias used on some Linux distros) to real root device path.
  • 2005: PSUTIL_DEBUG mode now prints file name and line number of the debug messages coming from C extension modules.
  • 2042: rewrite HISTORY.rst to use hyperlinks pointing to psutil API doc.
  • Bug fixes:
  • 1456, [macOS], [critical]: cpu_freq() min and max are set to 0 if can't be determined (instead of crashing).
  • 1512, [macOS]: sometimes Process.connections() will crash with EOPNOTSUPP for one connection; this is now ignored.
  • 1598, [Windows]: disk_partitions() only returns mountpoints on drives where it first finds one.
  • 1874, [SunOS]: swap output error due to incorrect range.
  • 1892, [macOS]: cpu_freq() broken on Apple M1.
  • 1901, [macOS]: different functions, especially Process.open_files() and Process.connections(), could randomly raise AccessDenied because the internal buffer of proc_pidinfo(PROC_PIDLISTFDS) syscall was not big enough. We now dynamically increase the buffer size until it's big enough instead of giving up and raising AccessDenied, which was a fallback to avoid crashing.
  • 1904, [Windows]: OpenProcess fails with ERROR_SUCCESS due to GetLastError() called after sprintf(). (patch by alxchk)
  • 1913, [Linux]: wait_procs() should catch subprocess.TimeoutExpired exception.
  • 1919, [Linux]: sensors_battery() can raise TypeError on PureOS.
  • 1921, [Windows]: swap_memory() shows committed memory instead of swap.
  • 1940, [Linux]: psutil does not handle ENAMETOOLONG when accessing process file descriptors in procfs. (patch by Nikita Radchenko)
  • 1948, [critical]: memoize_when_activated decorator is not thread-safe. (patch by Xuehai Pan)
  • 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.
  • 1980, [Windows]: 32bit / WoW64 processes fails to read Process.name() longer than 128 characters resulting in AccessDenied. This is now fixed. (patch by PetrPospisil)
  • 1991, [critical]: process_iter() is not thread safe and can raise TypeError if 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.

New in psutil 5.8.0 (Dec 19, 2020)

  • Enhancements:
  • 1863: disk_partitions() exposes 2 extra fields: maxfile and maxpath, which are the maximum file name and path name length.
  • 1872: [Windows] added support for PyPy 2.7.
  • 1879: provide pre-compiled wheels for Linux and macOS (yey!).
  • 1880: get rid of Travis and Cirrus CI services (they are no longer free). CI testing is now done by GitHub Actions on Linux, macOS and FreeBSD (yes). AppVeyor is still being used for Windows CI.
  • Bug fixes:
  • 1708: [Linux] get rid of sensors_temperatures() duplicates. (patch by Tim Schlueter).
  • 1839: [Windows] always raise AccessDenied when failing to query 64 processes from 32 bit ones (NtWoW64 APIs).
  • 1866: [Windows] process exe(), cmdline(), environ() may raise "invalid access to memory location" on Python 3.9.
  • 1874: [Solaris] wrong swap output given when encrypted column is present.
  • 1875: [Windows] process username() may raise ERROR_NONE_MAPPED if the SID has no corresponding account name. In this case AccessDenied is now raised.
  • 1877: [Windows] OpenProcess may fail with ERROR_SUCCESS. Turn it into AccessDenied or NoSuchProcess depending on whether the PID is alive.
  • 1886: [macOS] EIO error may be raised on cmdline() and environment(). Now it gets translated into AccessDenied.
  • 1891: [macOS] get rid of deprecated getpagesize().

New in psutil 5.7.3 (Oct 24, 2020)

  • Bug fixes:
  • [Windows] Process.open_files() may cause a segfault due to a NULL pointer.

New in psutil 5.7.2 (Jul 15, 2020)

  • Bug fixes:
  • wheels for 2.7 were inadvertently deleted.

New in psutil 5.7.1 (Jul 15, 2020)

  • Enhancements:
  • 1729: parallel tests on UNIX (make test-parallel). They're twice as fast!
  • 1741: "make build/install" is now run in parallel and it's about 15% faster on UNIX.
  • 1747: Process.wait() on POSIX returns an enum, showing the negative signal which was used to terminate the process
  • 1747: Process.wait() return value is cached so that the exit code can be retrieved on then next call.
  • 1747: Process provides more info about the process on str() and repr() (status and exit code)
  • 1757: memory leak tests are now stable.
  • 1768: [Windows] added support for Windows Nano Server. (contributed by Julien Lebot)
  • Bug fixes:
  • 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] NoSuchProcess may be raised instead of ZombieProcess.
  • 1781: fix signature of callback function for getloadavg(). (patch by Ammar Askar)

New in psutil 5.7.0 (Feb 18, 2020)

  • Enhancements:
  • 1637: [SunOS] add partial support for old SunOS 5.10 Update 0 to 3.
  • 1648: [Linux] sensors_temperatures() looks into an additional /sys/device/ directory for additional data. (patch by Javad Karabi)
  • 1652: [Windows] dropped support for Windows XP and Windows Server 2003. Minimum supported Windows version now is Windows Vista.
  • 1671: [FreeBSD] add CI testing/service for FreeBSD (Cirrus CI).
  • 1677: [Windows] process exe() will succeed for all process PIDs (instead of raising AccessDenied).
  • 1679: [Windows] net_connections() and Process.connections() are 10% faster.
  • 1682: [PyPy] added CI / test integration for PyPy via Travis.
  • 1686: [Windows] added support for PyPy on Windows.
  • 1693: [Windows] boot_time(), Process.create_time() and users()'s login time now have 1 micro second precision (before the precision was of 1 second).
  • Bug fixes:
  • 1538: [NetBSD] process cwd() may return ENOENT instead of NoSuchProcess.
  • 1627: [Linux] Process.memory_maps() can raise KeyError.
  • 1642: [SunOS] querying basic info for PID 0 results in FileNotFoundError.
  • 1646: [FreeBSD] many Process methods may cause a segfault on FreeBSD 12.0 due to a backward incompatible change in a C type introduced in 12.0.
  • 1656: [Windows] Process.memory_full_info() raises AccessDenied even for the current user and os.getpid().
  • 1660: [Windows] Process.open_files() complete rewrite + check of errors.
  • 1662: [Windows] process exe() may raise WinError 0.
  • 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). Thus far (long) was almost always assumed, which is wrong on most platforms.
  • 1673: [OpenBSD] Process connections(), num_fds() and threads() returned improper exception if process is gone.
  • 1674: [SunOS] disk_partitions() may raise OSError.
  • 1684: [Linux] disk_io_counters() may raise ValueError on systems not having /proc/diskstats.
  • 1695: [Linux] could not compile on kernels <= 2.6.13 due to PSUTIL_HAVE_IOPRIO not being defined. (patch by Anselm Kruis)

New in psutil 5.6.7 (Nov 26, 2019)

  • Bug fixes:
  • 1630: [Windows] can't compile source distribution due to C syntax error.

New in psutil 5.6.5 (Nov 25, 2019)

  • Bug fixes:
  • 1615: remove pyproject.toml as it was causing installation issues.

New in psutil 5.6.3 (Jun 11, 2019)

  • Enhancements:
  • 1494: [AIX] added support for Process.environ(). (patch by Arnon Yaari)
  • Bug fixes:
  • 1276: [AIX] can't get whole cmdline(). (patch by Arnon Yaari)
  • 1501_: [Windows] Process cmdline() and exe() raise unhandled "WinError 1168 element not found" exceptions for "Registry" and "Memory Compression" psuedo processes on Windows 10.
  • 1526_: [NetBSD] process cmdline() could raise MemoryError. (patch by Kamil Rytarowski)

New in psutil 5.6.2 (Apr 30, 2019)

  • Enhancements:
  • 604: [Windows, Windows] add new psutil.getloadavg(), returning system load average calculation, including on Windows (emulated). (patch by Ammar Askar)
  • 1404: [Linux] cpu_count(logical=False) uses a second method (read from /sys/devices/system/cpu/cpu[0-9]/topology/core_id) in order to determine the number of physical CPUs in case /proc/cpuinfo does not provide this info.
  • 1458: provide coloured test output. Also show failures on KeyboardInterrupt.
  • 1464: various docfixes (always point to python3 doc, fix links, etc.).
  • 1476: [Windows] it is now possible to set process high I/O priority (ionice()).Also, I/O priority values are now exposed as 4 new constants: IOPRIO_VERYLOW, IOPRIO_LOW, IOPRIO_NORMAL, IOPRIO_HIGH.
  • 1478: add make command to re-run tests failed on last run.
  • Bug fixes:
  • 1223: [Windows] boot_time() may return value on Windows XP.
  • 1456: [Linux] cpu_freq() returns None instead of 0.0 when min/max not available (patch by Alex Manuskin)
  • 1462: [Linux] (tests) make tests invariant to LANG setting (patch by Benjamin Drung)
  • 1463: cpu_distribution.py script was broken.
  • 1470: [Linux] disk_partitions(): fix corner case when /etc/mtab doesn't exist. (patch by Cedric Lamoriniere)
  • 1471: [SunOS] Process name() and cmdline() can return SystemError. (patch by Daniel Beer)
  • 1472: [Linux] cpu_freq() does not return all CPUs on Rasbperry-pi 3.
  • 1474: fix formatting of psutil.tests() which mimicks 'ps aux' output.
  • 1475: [Windows] OSError.winerror attribute wasn't properly checked resuling in WindowsError being raised instead of AccessDenied.
  • 1477: [Windows] wrong or absent error handling for private NTSTATUS Windows APIs. Different process methods were affected by this.
  • 1480: [Windows] psutil.cpu_count(logical=False) could cause a crash due to fixed read violation. (patch by Samer Masterson)
  • 1486: [AIX, SunOS] AttributeError when interacting with Process methods involved into oneshot() context.
  • 1491: [SunOS] net_if_addrs(): free() ifap struct on error. (patch by Agnewee)
  • 1493: [Linux] cpu_freq(): handle the case where /sys/devices/system/cpu/cpufreq/ exists but is empty.

New in psutil 5.6.1 (Mar 12, 2019)

  • 1329: [AIX] psutil doesn't compile on AIX 6.1. (patch by Arnon Yaari)
  • 1448: [Windows] crash on import due to rtlIpv6AddressToStringA not available on Wine.
  • 1451: [Windows] Process.memory_full_info() segfaults. NtQueryVirtualMemory is now used instead of QueryWorkingSet to calculate USS memory.

New in psutil 5.6.0 (Mar 6, 2019)

  • Enhancements:
  • 1379: [Windows] Process suspend() and resume() now use NtSuspendProcess and NtResumeProcess instead of stopping/resuming all threads of a process. This is faster and more reliable (aka this is what ProcessHacker does).
  • 1420: [Windows] in case of exception disk_usage() now also shows the path name.
  • 1422: [Windows] Windows APIs requiring to be dynamically loaded from DLL libraries are now loaded only once on startup (instead of on per function call) significantly speeding up different functions and methods.
  • 1426: [Windows] PAGESIZE and number of processors is now calculated on startup.
  • 1428: in case of error, the traceback message now shows the underlying C function called which failed.
  • 1433: new Process.parents() method. (idea by Ghislain Le Meur)
  • 1437: pids() are returned in sorted order.
  • 1442: python3 is now the default interpreter used by Makefile.
  • Bug fixes:
  • 1353: process_iter() is now thread safe (it rarely raised TypeError).
  • 1394: [Windows] Process name() and exe() may erroneously return "Registry". QueryFullProcessImageNameW is now used instead of GetProcessImageFileNameW in order to prevent that.
  • 1411: [BSD] lack of Py_DECREF could cause segmentation fault on process instantiation.
  • 1419: [Windows] Process.environ() raises NotImplementedError when querying a 64-bit process in 32-bit-WoW mode. Now it raises AccessDenied.
  • 1427: [OSX] Process cmdline() and environ() may erroneously raise OSError on failed malloc().
  • 1429: [Windows] SE DEBUG was not properly set for current process. It is now, and it should result in less AccessDenied exceptions for low-pid processes.
  • 1432: [Windows] Process.memory_info_ex()'s USS memory is miscalculated because we're not using the actual system PAGESIZE.
  • 1439: [NetBSD] Process.connections() may return incomplete results if using oneshot().
  • 1447: original exception wasn't turned into NSP/AD exceptions when using Process.oneshot() ctx manager.

New in psutil 5.5.1 (Feb 16, 2019)

  • Enhancements
  • 1348: [Windows] on Windows >= 8.1 if Process.cmdline() fails due to ERROR_ACCESS_DENIED attempt using NtQueryInformationProcess + ProcessCommandLineInformation. (patch by EccoTheFlintstone)
  • Bug fixes
  • 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.
  • 1408: [AIX] psutil won't compile on AIX 7.1 due to missing header. (patch by Arnon Yaari)

New in psutil 5.5.0 (Jan 23, 2019)

  • Enhancements
  • 1350: [FreeBSD] added support for sensors_temperatures(). (patch by Alex Manuskin)
  • 1352: [FreeBSD] added support for CPU frequency. (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() and io_counters() method are no longer exposed if not supported by the kernel.
  • 1368: [Windows] fix psutil.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 causes Process instances to return incorrect results.
  • 1376: [Windows] OpenProcess() now uses PROCESS_QUERY_LIMITED_INFORMATION access rights wherever possible, resulting in less AccessDenied exceptions being thrown for system processes.
  • 1376: [Windows] check if variable is NULL before free()ing it. (patch by EccoTheFlintstone)

New in psutil 5.4.8 (Oct 30, 2018)

  • Enhancements:
  • [Linux] cpu_freq() is now implemented by parsing /proc/cpuinfo in case /sys/devices/system/cpu/* filesystem is not available.
  • [Linux] psutil.sensors_temperatures() now parses /sys/class/thermal in case /sys/class/hwmon fs is not available (e.g. Raspberry Pi). (patch by Alex Manuskin)
  • [Posix] better compilation support when using g++ instead of gcc. (patch by Jaime Fullaondo)
  • Bug fixes:
  • do not print exception on import time in case cpu_times() fails.
  • [Linux] Process.io_counters() may raise ValueError.
  • [OSX] available and used memory (psutil.virtual_memory()) metrics are not accurate.
  • [Windows] psutil.Process().connections() may sometimes fail with intermittent 0xC0000001. (patch by Sylvain Duchesne)
  • [Linux] disk_partitions() does not honour PROCFS_PATH.
  • [AIX] system CPU times (psutil.cpu_times()) were being reported with ticks unit as opposed to seconds. (patch by Jaime Fullaondo)
  • [OSX] psutil debug messages are erroneously printed all the time. (patch by Ilya Yanok)
  • [SunOS] net_connections() returns an empty list. (patch by Oleksii Shevchuk)

New in psutil 5.4.7 (Aug 16, 2018)

  • Enhancements:
  • 1286: [macOS] psutil.OSX constant is now deprecated in favor of new psutil.MACOS.
  • 1309: [Linux] added psutil.STATUS_PARKED constant for Process.status().
  • 1321: [Linux] add disk_io_counters() dual implementation relying on /sys/block filesystem in case /proc/diskstats is not available. (patch by Lawrence Ye)
  • Bug fixes:
  • 1209: [macOS] Process.memory_maps() may fail with EINVAL due to poor task_for_pid() syscall. AccessDenied is 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 return ENODEV.
  • 1294: [Windows] psutil.Process().connections() may sometime fail with MemoryError. (patch by sylvainduchesne)
  • 1305: [Linux] disk_io_stats() may report inflated r/w bytes values.
  • 1309: [Linux] Process.status() is unable to recognize "idle" and "parked" statuses (returns '?').
  • 1313: [Linux] disk_io_counters() can report inflated IO counters due to erroneously counting base disk device and its partition(s) twice.
  • 1323: [Linux] sensors_temperatures() may fail with ValueError.

New in psutil 5.4.6 (Jun 8, 2018)

  • Bug fixes:
  • 1258: [Windows] Process.username() may cause a segfault (Python interpreter crash). (patch by Jean-Luc Migot)
  • 1273: net_if_addr() namedtuple's name has been renamed from "snic" to "snicaddr".
  • 1274: [Linux] there was a small chance Process.children() may swallow AccessDenied exceptions.

New in psutil 5.4.5 (Apr 14, 2018)

  • 1268: setup.py's extra_require parameter requires latest setuptools version, breaking quite a lot of installations.

New in psutil 5.4.4 (Apr 13, 2018)

  • Enhancements:
  • 1239: [Linux] expose kernel "slab" memory for psutil.virtual_memory(). (patch by Maxime Mouial)
  • Bug fixes:
  • 694: [SunOS] 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 physical) return a wrong (smaller) number on systems using process groups (> 64 cores).
  • 771: [Windows] cpu_times(percpu=True) return fewer CPUs on systems using process groups (> 64 cores).
  • 771: [Windows] cpu_stats() and cpu_freq() may return incorrect results on systems using process groups (> 64 cores).
  • 1193: [SunOS] Return uid/gid from /proc/pid/psinfo if there aren't enough permissions for /proc/pid/cred. (patch by Georg Sauthoff)
  • 1194: [SunOS] Return nice value from psinfo as getpriority() doesn't support real-time processes. (patch by Georg Sauthoff)
  • 1194: [SunOS] Fix double free in psutil_proc_cpu_num(). (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: fix compatibility with python 2.6 on Windows (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 raise TimeoutExpired.
  • 1238: [Linux] sensors_battery() may return None in 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 with IOError "no such file".
  • 1255: [FreeBSD] swap_memory() stats were erroneously represented in KB. (patch by Denis Krienbühl)
  • Backward compatibility:
  • 771: [Windows] cpu_count(logical=False) on Windows XP and Vista is no longer supported and returns None.

New in psutil 5.4.3 (Jan 3, 2018)

  • Enhancements:
  • 775: disk_partitions() on Windows return mount points.
  • Bug fixes:
  • 1193: pids() may return False on OSX.

New in psutil 5.4.2 (Dec 7, 2017)

  • Enhancements:
  • 1173: introduced PSUTIL_DEBUG environment variable which can be set in order to print useful debug messages on stderr (useful in case of nasty errors).
  • 1177: added support for sensors_battery() on OSX. (patch by Arnon Yaari)
  • 1183: Process.children() is 2x faster on UNIX and 2.4x faster on Linux.
  • 1188: deprecated method Process.memory_info_ex() now warns by using FutureWarning instead of DeprecationWarning.
  • Bug fixes:
  • 1152: [Windows] disk_io_counters() may return an empty dict.
  • 1169: [Linux] users() "hostname" returns username instead. (patch by janderbrain)
  • 1172: [Windows] make test does not work.
  • 1179: [Linux] Process.cmdline() is now able to splits cmdline args for misbehaving processes which overwrite /proc/pid/cmdline and use spaces instead of null bytes as args separator.
  • 1181: [OSX] Process.memory_maps() may raise ENOENT.
  • 1187: [OSX] pids() does not return PID 0 on recent OSX versions.

New in psutil 5.4.1 (Nov 8, 2017)

  • Enhancements:
  • 1164: [AIX] add support for Process.num_ctx_switches(). (patch by Arnon Yaari)
  • 1053: abandon Python 3.3 support (psutil still works but it's no longer tested).
  • Bug fixes:
  • 1150: [Windows] when a process is terminate()d now the exit code is set to SIGTERM instead of 0. (patch by Akos Kiss)
  • 1151: python -m psutil.tests fail
  • 1154: [AIX] psutil won't compile on AIX 6.1.0. (patch by Arnon Yaari)
  • 1167: [Windows] net_io_counter() packets count now include also non-unicast packets. (patch by Matthew Long)

New in psutil 5.4.0 (Nov 3, 2017)

  • Enhancements:
  • [AIX] added support for AIX platform. (patch by Arnon Yaari)
  • Bug fixes:
  • disk_io_counters()'s read_time and write_time were expressed in tens of micro seconds instead of milliseconds.
  • can't compile on newer versions of Visual Studio 2017 15.4. (patch by Max Bélanger)

New in psutil 5.3.0 (Sep 6, 2017)

  • Enhancements:
  • 802: disk_io_counters() and net_io_counters() numbers no longer wrap (restart from 0). Introduced a new "nowrap" argument.
  • 928: psutil.net_connections() and psutil.Process.connections() "laddr" and "raddr" are now named tuples.
  • 1015: swap_memory() now relies on /proc/meminfo instead of sysinfo() syscall so that it can be used in conjunction with PROCFS_PATH in order to retrieve memory info about Linux containers such as Docker and Heroku.
  • 1022: psutil.users() provides a new "pid" field.
  • 1025: process_iter() accepts two new parameters in order to invoke Process.as_dict(): "attrs" and "ad_value". With this you can iterate over all processes in one shot without needing to catch NoSuchProcess and do list/dict comprehensions.
  • 1040: implemented full unicode support.
  • 1051: disk_usage() on Python 3 is now able to accept bytes.
  • 1058: test suite now enables all warnings by default.
  • 1060: source distribution is dynamically generated so that it only includes relevant files.
  • 1079: [FreeBSD] net_connections()'s fd number is now being set for real (instead of -1). (patch by Gleb Smirnoff)
  • 1091: [SunOS] implemented Process.environ(). (patch by Oleksii Shevchuk)
  • Bug fixes:
  • 989: [Windows] boot_time() may return a negative value.
  • 1007: [Windows] boot_time() can have a 1 sec fluctuation between calls; the value of the first call is now cached so that boot_time() always returns the same value if fluctuation is <= 1 second.
  • 1013: [FreeBSD] psutil.net_connections() may return incorrect PID. (patch by Gleb Smirnoff)
  • 1014: [Linux] Process class can mask legitimate ENOENT exceptions as NoSuchProcess.
  • 1016: disk_io_counters() raises RuntimeError on a system with no disks.
  • 1017: net_io_counters() raises RuntimeError on a system with no network cards installed.
  • 1021: [Linux] open_files() may erroneously raise NoSuchProcess instead of skipping a file which gets deleted while open files are retrieved.
  • 1029: [OSX, FreeBSD] Process.connections('unix') on Python 3 doesn't properly handle unicode paths and may raise UnicodeDecodeError.
  • 1033: [OSX, FreeBSD] memory leak for net_connections() and Process.connections() when retrieving UNIX sockets (kind='unix').
  • 1040: fixed many unicode related issues such as UnicodeDecodeError on Python 3 + UNIX and invalid encoded data on Windows.
  • 1042: [FreeBSD] psutil won't compile on FreeBSD 12.
  • 1044: [OSX] different Process methods incorrectly raise AccessDenied for zombie processes.
  • 1046: [Windows] disk_partitions() on Windows overrides user's SetErrorMode.
  • 1047: [Windows] Process username(): memory leak in case exception is thrown.
  • 1048: [Windows] users()'s host field report an invalid IP address.
  • 1050: [Windows] Process.memory_maps memory() leaks memory.
  • 1055: cpu_count() is no longer cached; this is useful on systems such as Linux where CPUs can be disabled at runtime. This also reflects on Process.cpu_percent() which no longer uses the cache.
  • 1058: fixed Python warnings.
  • 1062: disk_io_counters() and net_io_counters() raise TypeError if no disks or NICs are installed on the system.
  • 1063: [NetBSD] net_connections() may list incorrect sockets.
  • 1064: [NetBSD] swap_memory() may segfault in case of error.
  • 1065: [OpenBSD] Process.cmdline() may raise SystemError.
  • 1067: [NetBSD] Process.cmdline() leaks memory if process has terminated.
  • 1069: [FreeBSD] Process.cpu_num() may return 255 for certain kernel processes.
  • 1071: [Linux] cpu_freq() may raise IOError on old RedHat distros.
  • 1074: [FreeBSD] sensors_battery() raises OSError in 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 to None if <= 1.
  • 1087: Process.cpu_percent() guard against cpu_count() returning None and assumes 1 instead.
  • 1093: [SunOS] memory_maps() shows wrong 64 bit addresses.
  • 1094: [Windows] psutil.pid_exists() may lie. Also, all process APIs relying on OpenProcess Windows API now check whether the PID is actually running.
  • 1098: [Windows] Process.wait() may erroneously return sooner, when the PID is still alive.
  • 1099: [Windows] Process.terminate() may raise AccessDenied even if the process already died.
  • 1101: [Linux] sensors_temperatures() may raise ENODEV.
  • Porting notes:
  • 1039: returned types consolidation: - Windows / Process.cpu_times(): fields #3 and #4 were int instead of float - Linux / FreeBSD: connections('unix'): raddr is now set to "" instead of
  • None
  • OpenBSD: connections('unix'): laddr and raddr are now set to "" instead of None
  • 1040: all strings are encoded by using OS fs encoding.
  • 1040: the following Windows APIs on Python 2 now return a string instead of unicode: - Process.memory_maps().path - WindowsService.bin_path() - WindowsService.description() - WindowsService.display_name() - WindowsService.username()