# Improved python package installation: slicer.packaging

**URL:** <https://discourse.slicer.org/t/improved-python-package-installation-slicer-packaging/47088>\
**Category:** Support\
**Tags:** feature, python\
**Created:** [May 19, 2026, 3:58pm UTC](https://discourse.slicer.org/t/improved-python-package-installation-slicer-packaging/47088 "2026-05-19T15:58:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [May 19, 2026, 3:58pm UTC](https://discourse.slicer.org/t/improved-python-package-installation-slicer-packaging/47088/1 "2026-05-19T15:58:35Z")

</div>

An improved python package installation experience is now available out of the box for extension developers: [`slicer.packaging`](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#module-slicer.packaging).

This feature was [merged](https://github.com/Slicer/Slicer/pull/9010) about a month ago and is available in the preview version of Slicer.

The existing `slicer.util.pip_install` has been expanded in functionality to support a more interactive experience: a GUI like the one shown below when blocking, or the possibility to run without blocking the application.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/9/a9e372df086c99c3a720589043d5420ab994f3b8.png)

Additionally, new functions have been added:

| **Function** | **Purpose** |
| --- | --- |
| `slicer.packaging.load_requirements(path)` | Parse a `requirements.txt` into `Requirement` objects. |
| `slicer.packaging.load_pyproject_dependencies(path)` | Parse `[project.dependencies]` from a `pyproject.toml` |
| `slicer.packaging.pip_check(reqs)` | Are the requirements already satisfied? |
| `slicer.packaging.pip_install(...)` | Install, with various modes and hooks. |
| `slicer.packaging.pip_ensure(reqs, requester="...")` | High-level workflow: check, prompt, install with progress, and offer restart if needed. |

The bottom line for extension developers is: Use [`slicer.packaging.pip_ensure`](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.packaging.pip_ensure)! If you need lower level control, you can instead use `slicer.packaging.pip_check` and `slicer.packaging.pip_install` directly.

See the following for more details:

- the [python package management](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#python-package-management) section of the script repository
- the [`slicer.packaging` API docs](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#module-slicer.packaging)
- the [Kitware blog post](https://www.kitware.com/improving-python-dependency-handling-for-3d-slicer-extension-development/)
