# MacOS Python Problem

**URL:** <https://discourse.slicer.org/t/macos-python-problem/7198>\
**Category:** SlicerSALT\
**Tags:** macos\
**Created:** [June 17, 2019, 10:29am UTC](https://discourse.slicer.org/t/macos-python-problem/7198 "2019-06-17T10:29:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iPsych](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iPsych](https://discourse.slicer.org/u/iPsych)\
**Post date:** [June 17, 2019, 10:29am UTC](https://discourse.slicer.org/t/macos-python-problem/7198/1 "2019-06-17T10:29:36Z")

</div>

![46%20PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/8/38ae37d375aac065672d80defe682f4aaabff257.png)

The nightly version (1.1) 2019-06-14 doesn’t work in Mac.  
It can display .vtk files when imported, but Can’t process ANY SPHARM process.  
I also tested stable (1.0) version, but same issue.  
It’s weird since SlicerSalt seems embed it’s own python.

Any successful test is existing in Mac environment?

---

<div class="post-metadata">

**Author:** ![bpaniagua](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bpaniagua/32/20_2.png) [@bpaniagua](https://discourse.slicer.org/u/bpaniagua)\
**Post date:** [June 18, 2019, 8:49pm UTC](https://discourse.slicer.org/t/macos-python-problem/7198/2 "2019-06-18T20:49:33Z")

</div>

Hi @iPsych

Does this also happen with input volumes? i.e. nrrd type data?

Thanks,  
Bea

cc. @jcfr

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [June 18, 2019, 8:52pm UTC](https://discourse.slicer.org/t/macos-python-problem/7198/3 "2019-06-18T20:52:02Z")

</div>

This is related to transition of Slicer to Python3 and should be reproducible in any environment.

Could you provide an example dataset along with the steps allowing to reproduce the problem ? Thanks

---

<div class="post-metadata">

**Author:** ![iPsych](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iPsych](https://discourse.slicer.org/u/iPsych)\
**Post date:** [June 24, 2019, 1:58am UTC](https://discourse.slicer.org/t/macos-python-problem/7198/4 "2019-06-24T01:58:05Z")

</div>

I thought that it may possible interruption by Anaconda python environments.  
I found python3.6m in the package, and it should work properly.  
However, the same error happens when  
1)run SPHARM-PDM generator  
2)Set input and output directory (input directory contains segmented .nii file.)

Tested in both system with and without anaconda environment. Same error happens.

---

<div class="post-metadata">

**Author:** ![iPsych](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iPsych](https://discourse.slicer.org/u/iPsych)\
**Post date:** [June 27, 2019, 5:46am UTC](https://discourse.slicer.org/t/macos-python-problem/7198/6 "2019-06-27T05:46:56Z")

</div>

@jcfr  
I found the errors.  
Please refer the comment of link below.  
[https://tickets.metabrainz.org/browse/PICARD-1328](https://tickets.metabrainz.org/browse/PICARD-1328)

In MacOS, to run the python codes, all the strings seem to change to byte as below.

```
exts = [".gipl", ".gipl.gz", ".mgh", ".mgh,gz", ".nii", ".nii.gz",".nrrd", ".vtk", ".vtp", ".hdr", ".mhd"]

```

to

```
exts = [b'.gipl', b'.gipl.gz', b'.mgh', b'.mgh,gz', b'.nii', b'.nii.gz',b'.nrrd', b'.vtk', b'.vtp', b'.hdr', b'.mhd']

```

and

```
SPHARMMeshRootname = SPHARMMeshOutputDirectory + "/" + self.inputRootname + "_flip" + flipName[i - 1] + "_pp_surf"

```

to

```
SPHARMMeshRootname = SPHARMMeshOutputDirectory + b'/' + self.inputRootname + b'_flip' + flipName[i - 1] + b'_pp_surf'

```

(and all the lines like above).

I believe there might be a smart way to resolve it.  
Currently, it seems the Python part will work in Windows but not in the MacOS.
