Slicer-Python Packages Use and Install

I’ve tried this on the latest nightly version and it all works well for me!

  1. Start Slicer as administrator: in the start menu, instead of left-click on the Slicer icon, use right-click, then select More... and Run as Administrator.

  2. Install a package by using pip. For example, installing of requests package:

Enter this into the Python interactor:

import pip
pip.main(['install', 'requests'])

The package is successfully downloaded and installed:

Collecting requests
  Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
Collecting idna<2.7,>=2.5 (from requests)
  Downloading idna-2.6-py2.py3-none-any.whl (56kB)
Collecting urllib3<1.23,>=1.21.1 (from requests)
  Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
Collecting certifi>=2017.4.17 (from requests)
  Downloading certifi-2017.7.27.1-py2.py3-none-any.whl (349kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
Installing collected packages: idna, urllib3, certifi, chardet, requests
  Found existing installation: chardet 2.3.0
    Uninstalling chardet-2.3.0:
      Successfully uninstalled chardet-2.3.0
Successfully installed certifi-2017.7.27.1 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
0

Dependent packages are updated, therefore before using the installed requests package, you need to restart Slicer (you can use the restart() command in the Python console).