Repository navigation
Description
Feature request
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
psutilbehavior whenpsutilis installed; - if
psutilis 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.
Current workaround
For now, I can run successfully with:
ipykernel==6.9.1
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.