You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make psutil optional for constrained platforms #1523
Would it be possible to make psutil an optional dependency, or to provide a configuration flag allowing ipykernel to run without psutil on constrained platforms?
Context
I am running ipykernel inside a Python-for-Android / Kivy application. This setup works with ipykernel==6.9.1, but newer versions import psutil during kernel startup. On Android / python-for-android, psutil is difficult to support because it contains platform-specific native code and relies on process-inspection APIs that are not always available or useful in this environment.
The kernel itself works for the main use case:
Jupyter messaging
remote QtConsole control
normal Python execution
NumPy operations
application-side control through the kernel namespace
The blocking point is that newer ipykernel versions require psutil even though the features using it appear to be related mainly to process/resource reporting and child-process management.
Observed psutil usage
From inspection, psutil appears to be used in areas such as:
usage_request
_process_children
_signal_children
These seem useful on desktop/server platforms, but they are not essential for all embedded/mobile use cases.
Proposed behavior
One possible approach would be:
keep full psutil behavior when psutil is installed;
if psutil is unavailable, allow the kernel to start anyway;
degrade gracefully for features requiring process introspection;
return limited or unavailable resource information from usage_request;
treat child-process enumeration as empty or unsupported.
For example, ipykernel could catch ImportError around psutil and use a small internal fallback layer.
Why this would help
This would make recent ipykernel versions usable on constrained or unusual Python targets, including:
Android / python-for-Android
embedded Linux systems
restricted containers
environments where native extension builds are not practical
Currently, users in those environments may need to pin to older ipykernel versions only to avoid the hard psutil dependency.
Activity
Carreau commentedon Jun 10, 2026
Yes, that would be resaonable request, we already I belive have it optional for IPython in pyodide (I think we might even have a shim for that) .
Feel free to send PR.
ianthomas23 commentedon Jul 17, 2026
Closed by #1527.