# nameError when using slicer.util.pip\_install

**URL:** <https://discourse.slicer.org/t/nameerror-when-using-slicer-util-pip-install/30160>\
**Category:** Development\
**Created:** [June 20, 2023, 4:53pm UTC](https://discourse.slicer.org/t/nameerror-when-using-slicer-util-pip-install/30160 "2023-06-20T16:53:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Kirby](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/justin_kirby/32/66502_2.png) [@Justin\_Kirby](https://discourse.slicer.org/u/Justin_Kirby)\
**Post date:** [June 20, 2023, 4:53pm UTC](https://discourse.slicer.org/t/nameerror-when-using-slicer-util-pip-install/30160/1 "2023-06-20T16:53:36Z")

</div>

Hi, I’m working on the TCIABrowser extension. Part of the code relies on a PyPI package called tcia\_utils. The code we used to load it worked fine in the 5.2 stable release, but in the 5.3 preview releases this is failing. Did something change about how we should be doing things or is this a bug related to slicer.util?

slicer.util.pip\_install(‘tcia\_utils’)  
NameError: name ‘slicer’ is not defined

Here’s the full traceback:

Traceback (most recent call last):  
File “C:\Users\neoma\Downloads\TCIABrowser-master\TCIABrowser\TCIABrowserLib\TCIAClient.py”, line 2, in   
import tcia\_utils.nbia  
ModuleNotFoundError: No module named ‘tcia\_utils’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “”, line 1, in   
File “C:\Users\neoma\AppData\Local\slicer.org\Slicer 5.3.0-2023-06-19\lib\Python\Lib\imp.py”, line 169, in load\_source  
module = \_exec(spec, sys.modules[name])  
File “”, line 613, in \_exec  
File “”, line 850, in exec\_module  
File “”, line 228, in \_call\_with\_frames\_removed  
File “C:/Users/neoma/Downloads/TCIABrowser-master/TCIABrowser/TCIABrowser.py”, line 23, in   
from TCIABrowserLib import APISettingsPopup, clinicalDataPopup, TCIAClient  
File “C:\Users\neoma\Downloads\TCIABrowser-master\TCIABrowser\TCIABrowserLib\TCIAClient.py”, line 4, in   
slicer.util.pip\_install(‘tcia\_utils’)  
NameError: name ‘slicer’ is not defined

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 20, 2023, 4:54pm UTC](https://discourse.slicer.org/t/nameerror-when-using-slicer-util-pip-install/30160/2 "2023-06-20T16:54:32Z")

</div>

> slicer.util.pip\_install(‘tcia\_utils’)  
> NameError: name ‘slicer’ is not defined

Calling `import slicer` before `slicer.util....` should fix the problem.

---

<div class="post-metadata">

**Author:** ![Justin\_Kirby](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/justin_kirby/32/66502_2.png) [@Justin\_Kirby](https://discourse.slicer.org/u/Justin_Kirby)\
**Post date:** [June 20, 2023, 5:06pm UTC](https://discourse.slicer.org/t/nameerror-when-using-slicer-util-pip-install/30160/3 "2023-06-20T17:06:20Z")

</div>

Yikes…how did I miss that? 😆 Thanks.
