IPython Generic Utilities
ipython-genutils (version 0.2.0) is a collection of IPython-specific utility functions and modules that were extracted from the main IPython project. It served as a dependency for older IPython components and related projects during the Python 2 to 3 transition. It is considered vestigial, no longer actively developed, with its last release in 2017. New projects should avoid direct reliance on it.
Common errors
-
ModuleNotFoundError: No module named 'ipython_genutils'
cause The 'ipython-genutils' package, or a higher-level dependency like Jupyter that relies on it, is not installed in the active Python 3 environment.fixInstall the package using `pip install ipython-genutils`. If this package is a dependency of another tool (like Jupyter), ensure that tool is installed correctly, as it should pull 'ipython-genutils' as a dependency. -
ImportError: No module named ipython_genutils
cause This error is the Python 2 equivalent of 'ModuleNotFoundError' and occurs when the 'ipython-genutils' package is a missing dependency for older versions of IPython or Jupyter components in a Python 2 environment.fixInstall the package using `pip install ipython-genutils`. Verify that you are using the correct Python 2 environment and its associated `pip` for installation. -
ModuleNotFoundError: No module named 'ipython_genutils.py3compat'
cause An older library or a specific version of a Jupyter component, particularly from the Python 2 to Python 3 transition period, is attempting to import the 'py3compat' module from 'ipython_genutils', but it is either missing, inaccessible, or incompatible in the current Python environment.fixEnsure 'ipython-genutils' is installed (`pip install ipython-genutils`). If the error persists, it often indicates a dependency conflict; consider upgrading the main package that triggers this import or isolating the environment to resolve the problematic dependency.
Warnings
- deprecated This library is considered vestigial and is no longer actively maintained. Its utilities have largely been superseded by modern Python standard library features (e.g., `pathlib`, `tempfile`) or integrated into other active projects (e.g., `jupyter_core.paths` for path utilities).
- gotcha Due to its lack of maintenance, `ipython-genutils` does not receive updates for new Python versions. While it currently works on recent Python 3, future Python versions may introduce incompatibilities that will not be addressed.
- gotcha The utilities within `ipython-genutils` were extracted from IPython's internal codebase and are generally low-level. They are not intended for direct end-user application development in most cases and may have unexpected edge cases or limited scope.
Install
-
pip install ipython-genutils
Imports
- version_info
from ipython_genutils.version import version_info
- PY3
from ipython_genutils.py3compat import PY3
- get_ipython_dir
from ipython_genutils.path import get_ipython_dir
- TemporaryDirectory
from ipython_genutils.tempdir import TemporaryDirectory
Quickstart
from ipython_genutils.version import version_info
from ipython_genutils.py3compat import PY3
from ipython_genutils.path import get_ipython_dir
print(f"ipython-genutils version: {'.'.join(map(str, version_info))}")
print(f"Running on Python 3: {PY3}")
# Note: This path utility is largely internal to IPython/Jupyter now.
# For new projects, consider `jupyter_core.paths` or `pathlib`.
ipython_dir = get_ipython_dir()
print(f"Detected IPython directory (if configured): {ipython_dir}")