Slicer-Python Packages Use and Install


(ZiyunLiang) #43

Hi, I’m having the same problem when I try to install packages to my computer. I tried the pip way as you described but it did not work for me. No matter what package I try to install, it always report to following errors:
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: ‘/private/var/folders/4m/3zz84kjj0rb8r7twkxksmplw0000gn/T/pip-req-tracker-dVJBGY/39e3ab1dfb11346e7d530d2e1ee1ef3dc8bbf9578e5f497994026cda’
and some times like this: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: ‘/Volumes/Slicer-4.10.0-macosx-amd64/Slicer.app/Contents/lib/Python/lib/python2.7/site-packages/python_dateutil-2.8.0.dist-info’
I was wondering if this is because I didn’t run slicer as an administrator. I’m using mac and when I right click on the icon, I didn’t see more and run as administrator. Does anyone know to run slicer on mac as an administrator? And does anyone know how to fix this error?
Please help.

Thanks,
Andrea


(Steve Pieper) #44

Hi - it looks like you didn’t drag the application to a writable location.

https://www.slicer.org/wiki/Documentation/4.10/SlicerApplication/Installation#Mac


(ZiyunLiang) #45

Hi, Thank you for the advice! I checked and I think Slicer is at a writable location right now. And I also tried to open it as an administrator by command Applications andrealiang$ sudo open Slicer.app at the terminal. But I still get the following error:
Requirement already satisfied: pandas in ./Slicer.app/Contents/lib/Python/lib/python2.7/site-packages (0.24.1)

Requirement already satisfied: python-dateutil>=2.5.0 in ./Slicer.app/Contents/lib/Python/lib/python2.7/site-packages (from pandas) (2.8.0)

Requirement already satisfied: numpy>=1.12.0 in ./Slicer.app/Contents/lib/Python/lib/python2.7/site-packages/numpy-1.13.1-py2.7-macosx-10.9-x86_64.egg (from pandas) (1.13.1)

Requirement already satisfied: pytz>=2011k in ./Slicer.app/Contents/lib/Python/lib/python2.7/site-packages (from pandas) (2018.9)

Requirement already satisfied: six>=1.5 in ./Slicer.app/Contents/lib/Python/lib/python2.7/site-packages (from python-dateutil>=2.5.0->pandas) (1.11.0)

Collecting importlib

Using cached https://files.pythonhosted.org/packages/31/77/3781f65cafe55480b56914def99022a5d2965a4bb269655c89ef2f1de3cd/importlib-1.0.4.zip

Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: ‘/private/var/folders/4m/3zz84kjj0rb8r7twkxksmplw0000gn/T/pip-req-tracker-rEfQlE/20483040384e67f98bad799531b988be6a42bb897823a965fb554d64’

It looks like it has already installed the package pandas, but is having trouble with the second package. Does anyone know how to fix this bug?

Thanks!
Andrea


(ZiyunLiang) #46

Hi everyone, after days of trying, my problem is solved in two ways. And I’d like to share my solutions with you.

  1. As for me, I’m using mac, and to successfully install the packages, mac users need to put the software in the directory Users/yourname/Applications rather than /Applications. Or if your software is in the directory /Applications, you can open it by option+open
  2. you can use multithreading, which is to run Python script using a non-Slicer Python environment as described here.

(Alex Vergara) #47

I don’t get your point, no matter what I am not able to run multithreading, all packages run in a single processor even if they split threads. I have tried with multiprocessing, cython, numba, ipyparallel, joblib, handythreads. Everything has same behaviour, yes they can be installed but multithreading is just not working. Using an external python for this is not efficient since you have to pass big arrays (files). Can you elaborate more this point please?


(Andras Lasso) #48

Have you actually measured the time to pass large arrays through files? My experience is that if you don’t use compression then it works extremely fast. I guess that pickling of numpy arrays is quite well optimized, too. If you find that data transfer is the performance bottleneck then you can go lower level and use shared memory transfer.