Operating system: Windows
Slicer version: 4.8.0
Hello everyone,
I am using the Python Console in Slicer to work with a MR image, and I am facing problems when importing some modules. I wanted to use cv2 and medpy. I managed to find a workaround for which I did not need cv2, but I need to use medpy and I am getting stuck with its import.
I ran the following commands:
import pip
pip.main([‘install’, ‘medpy’])
The errors in the output were:
Failed building wheel for medpy
Failed cleaning build dir for medpy
Traceback (most recent call last):
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\basecommand.py”, line 215, in main
status = self.run(options, args)
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\commands\install.py”, line 342, in run
prefix=options.prefix_path,
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\req\req_set.py”, line 784, in install
**kwargs
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\req\req_install.py”, line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\req\req_install.py”, line 1064, in move_wheel_files
isolated=self.isolated,
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\wheel.py”, line 345, in move_wheel_files
clobber(source, lib_dir, True)
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\wheel.py”, line 316, in clobber
ensure_dir(destdir)
File “C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\pip\utils_init_.py”, line 83, in ensure_dir
os.makedirs(path)
File “C:/Program Files/Slicer 4.8.0/lib/Python/Lib\os.py”, line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 5] Access denied: ‘C:\Program Files\Slicer 4.8.0\lib\Python\Lib\site-packages\scipy’
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.
Now, the upgrade command does not work. I tried to use CMD directly, but the system keeps triggering Syntax Errors and ‘File not found’ errors. Strangely, the default 2.7 Python version of mi computer does not have pip installed; thus, I can’t use pip to install any module. “Import pip” does work with Slicer though. However, it doesn’t seem to be working either due to the errors I mention above.
Questions:
- Do I have to consider the Python 2.7 version in Slicer and the Python 2.7 version in my computer as different things? Can’t I attempt the installation of a module for the Python console in slicer in CMD, with permits?
- How do I run command “python -m pip install --upgrade pip”? In the Slicer console it clearly does not work. In Windows console, neither (because it tells me “pip” does not exist and so on).
Thank you for any clarification.
Virginia