# Module for Internal Dosimetry in Nuclear Medicine

**URL:** https://discourse.slicer.org/t/module-for-internal-dosimetry-in-nuclear-medicine/3317
**Category:** Development
**Tags:** registration, segmentation, dosimetry
**Created:** [June 27, 2018, 2:46pm UTC](https://discourse.slicer.org/t/module-for-internal-dosimetry-in-nuclear-medicine/3317 "2018-06-27T14:46:25Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)
#### Post date: [January 16, 2019, 10:46am UTC](https://discourse.slicer.org/t/module-for-internal-dosimetry-in-nuclear-medicine/3317/14 "2019-01-16T10:46:39Z")

</div>

This is a little piece of code that lets you to install any missing package from within the python interpreter itself, just create a file named slicer\_python\_package\_installer.py inside SlicerPlugins folder in your home folder (create if not exists and add it to modules paths). Then add the following

```python
# import pip main
try:
    from pip import main as pipmain
except:
    from pip._internal import main as pipmain
import importlib

def install_and_import(package):
    try:   
        importlib.import_module(package)
    except:
        pipmain(['install', package])
        importlib.import_module(package)
        pass

def install_package(package):
    try:
        importlib.import_module(package)
    except:
        pipmain(['install', package])
        pass

```

Then in the python interpreter write the following:

```python
from slicer_python_package_installer import *

```

And voila! you can easily do

```python
install_and_import('joblib')

```

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

---

_[View the full topic](https://discourse.slicer.org/t/module-for-internal-dosimetry-in-nuclear-medicine/3317)._
