Issue to Install SCT on MAC M 1

Description

I have a new MAC M1 and I am trying to follow the instructions for SCT installation using the command line on my terminal ./install_sct

Commands and terminal output

./install_sct


*******************************
* Welcome to SCT installation *
*******************************



Checking OS type and version...

Darwin SV-69M-031 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101 arm64
ProductVersion:	11.4

Checking requirements...


OK!


SCT version ......... dev
Installation type ... in-place
Operating system .... osx (11.4)
Shell config ........ /Users/bachali/.bashrc

To improve user experience and fix bugs, the SCT development team is using a
report system to automatically receive crash reports and errors from users.
These reports are anonymous.

Do you agree to help us improve SCT? [y]es/[n]o: y

--> Crash reports will be sent to the SCT development team. Thank you!


SCT will be installed here: [/Users/bachali/desktop/spinalcordtoolbox]



Do you agree? [y]es/[n]o: y

Do you want to add the sct_* scripts to your PATH environment? [y]es/[n]o: y

Skipping copy of source files (source and destination folders are the same)


Installing conda...


rm -rf /Users/bachali/desktop/spinalcordtoolbox/python


mkdir -p /Users/bachali/desktop/spinalcordtoolbox/python


curl -o /var/folders/lw/jty1xr614w33qrycd0bmwdfc0000gp/T/tmp.PyUYaYhP/miniconda.sh -L https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 54.4M  100 54.4M    0     0  8206k      0  0:00:06  0:00:06 --:--:-- 9154k

bash /var/folders/lw/jty1xr614w33qrycd0bmwdfc0000gp/T/tmp.PyUYaYhP/miniconda.sh -p /Users/bachali/desktop/spinalcordtoolbox/python -b -f

PREFIX=/Users/bachali/desktop/spinalcordtoolbox/python
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                       
Solving environment: done

## Package Plan ##

  environment location: /Users/bachali/desktop/spinalcordtoolbox/python

  added / updated specs:
    - brotlipy==0.7.0=py38h9ed2024_1003
    - ca-certificates==2020.10.14=0
    - certifi==2020.6.20=pyhd3eb1b0_3
    - cffi==1.14.3=py38h2125817_2
    - chardet==3.0.4=py38hecd8cb5_1003
    - conda-package-handling==1.7.2=py38h22f3db7_0
    - conda==4.9.2=py38hecd8cb5_0
    - cryptography==3.2.1=py38hbcfaee0_1
    - idna==2.10=py_0
    - libcxx==10.0.0=1
    - libedit==3.1.20191231=h1de35cc_1
    - libffi==3.3=hb1e8313_2
    - ncurses==6.2=h0a44026_1
    - openssl==1.1.1h=haf1e3a3_0
    - pip==20.2.4=py38hecd8cb5_0
    - pycosat==0.6.3=py38h1de35cc_1
    - pycparser==2.20=py_2
    - pyopenssl==19.1.0=pyhd3eb1b0_1
    - pysocks==1.7.1=py38_1
    - python.app==2=py38_10
    - python==3.8.5=h26836e1_1
    - readline==8.0=h1de35cc_0
    - requests==2.24.0=py_0
    - ruamel_yaml==0.15.87=py38haf1e3a3_1
    - setuptools==50.3.1=py38hecd8cb5_1
    - six==1.15.0=py38hecd8cb5_0
    - sqlite==3.33.0=hffcf06c_0
    - tk==8.6.10=hb0a8c7a_0
    - tqdm==4.51.0=pyhd3eb1b0_0
    - urllib3==1.25.11=py_0
    - wheel==0.35.1=pyhd3eb1b0_0
    - xz==5.2.5=h1de35cc_0
    - yaml==0.2.5=haf1e3a3_0
    - zlib==1.2.11=h1de35cc_3


The following NEW packages will be INSTALLED:

  brotlipy           pkgs/main/osx-64::brotlipy-0.7.0-py38h9ed2024_1003
  ca-certificates    pkgs/main/osx-64::ca-certificates-2020.10.14-0
  certifi            pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3
  cffi               pkgs/main/osx-64::cffi-1.14.3-py38h2125817_2
  chardet            pkgs/main/osx-64::chardet-3.0.4-py38hecd8cb5_1003
  conda              pkgs/main/osx-64::conda-4.9.2-py38hecd8cb5_0
  conda-package-han~ pkgs/main/osx-64::conda-package-handling-1.7.2-py38h22f3db7_0
  cryptography       pkgs/main/osx-64::cryptography-3.2.1-py38hbcfaee0_1
  idna               pkgs/main/noarch::idna-2.10-py_0
  libcxx             pkgs/main/osx-64::libcxx-10.0.0-1
  libedit            pkgs/main/osx-64::libedit-3.1.20191231-h1de35cc_1
  libffi             pkgs/main/osx-64::libffi-3.3-hb1e8313_2
  ncurses            pkgs/main/osx-64::ncurses-6.2-h0a44026_1
  openssl            pkgs/main/osx-64::openssl-1.1.1h-haf1e3a3_0
  pip                pkgs/main/osx-64::pip-20.2.4-py38hecd8cb5_0
  pycosat            pkgs/main/osx-64::pycosat-0.6.3-py38h1de35cc_1
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-19.1.0-pyhd3eb1b0_1
  pysocks            pkgs/main/osx-64::pysocks-1.7.1-py38_1
  python             pkgs/main/osx-64::python-3.8.5-h26836e1_1
  python.app         pkgs/main/osx-64::python.app-2-py38_10
  readline           pkgs/main/osx-64::readline-8.0-h1de35cc_0
  requests           pkgs/main/noarch::requests-2.24.0-py_0
  ruamel_yaml        pkgs/main/osx-64::ruamel_yaml-0.15.87-py38haf1e3a3_1
  setuptools         pkgs/main/osx-64::setuptools-50.3.1-py38hecd8cb5_1
  six                pkgs/main/osx-64::six-1.15.0-py38hecd8cb5_0
  sqlite             pkgs/main/osx-64::sqlite-3.33.0-hffcf06c_0
  tk                 pkgs/main/osx-64::tk-8.6.10-hb0a8c7a_0
  tqdm               pkgs/main/noarch::tqdm-4.51.0-pyhd3eb1b0_0
  urllib3            pkgs/main/noarch::urllib3-1.25.11-py_0
  wheel              pkgs/main/noarch::wheel-0.35.1-pyhd3eb1b0_0
  xz                 pkgs/main/osx-64::xz-5.2.5-h1de35cc_0
  yaml               pkgs/main/osx-64::yaml-0.2.5-haf1e3a3_0
  zlib               pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3


Preparing transaction: done
Executing transaction: done
installation finished.
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.9.2
  latest version: 4.10.1

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /Users/bachali/desktop/spinalcordtoolbox/python/envs/venv_sct

  added / updated specs:
    - python=3.6


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2021.4.13  |       hecd8cb5_1         114 KB
    certifi-2020.12.5          |   py36hecd8cb5_0         141 KB
    openssl-1.1.1k             |       h9ed2024_0         2.2 MB
    pip-21.1.1                 |   py36hecd8cb5_0         1.8 MB
    python-3.6.13              |       h88f2d9e_0        16.8 MB
    readline-8.1               |       h9ed2024_0         333 KB
    setuptools-52.0.0          |   py36hecd8cb5_0         710 KB
    sqlite-3.35.4              |       hce871da_0         1.1 MB
    wheel-0.36.2               |     pyhd3eb1b0_0          33 KB
    ------------------------------------------------------------
                                           Total:        23.3 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2021.4.13-hecd8cb5_1
  certifi            pkgs/main/osx-64::certifi-2020.12.5-py36hecd8cb5_0
  libcxx             pkgs/main/osx-64::libcxx-10.0.0-1
  libffi             pkgs/main/osx-64::libffi-3.3-hb1e8313_2
  ncurses            pkgs/main/osx-64::ncurses-6.2-h0a44026_1
  openssl            pkgs/main/osx-64::openssl-1.1.1k-h9ed2024_0
  pip                pkgs/main/osx-64::pip-21.1.1-py36hecd8cb5_0
  python             pkgs/main/osx-64::python-3.6.13-h88f2d9e_0
  readline           pkgs/main/osx-64::readline-8.1-h9ed2024_0
  setuptools         pkgs/main/osx-64::setuptools-52.0.0-py36hecd8cb5_0
  sqlite             pkgs/main/osx-64::sqlite-3.35.4-hce871da_0
  tk                 pkgs/main/osx-64::tk-8.6.10-hb0a8c7a_0
  wheel              pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
  xz                 pkgs/main/osx-64::xz-5.2.5-h1de35cc_0
  zlib               pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3



Downloading and Extracting Packages
pip-21.1.1           | 1.8 MB    | ##################################### | 100% 
ca-certificates-2021 | 114 KB    | ##################################### | 100% 
sqlite-3.35.4        | 1.1 MB    | ##################################### | 100% 
wheel-0.36.2         | 33 KB     | ##################################### | 100% 
readline-8.1         | 333 KB    | ##################################### | 100% 
python-3.6.13        | 16.8 MB   | ##################################### | 100% 
setuptools-52.0.0    | 710 KB    | ##################################### | 100% 
certifi-2020.12.5    | 141 KB    | ##################################### | 100% 
openssl-1.1.1k       | 2.2 MB    | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate venv_sct
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Error: Activating venv_sct failed to switch Python interpreter to Miniconda. (Incorrect interpreter loaded: /Users/bachali/desktop/spinalcordtoolbox/python/envs/venv_sct/bin/python3.6)

1 Like

Hi @idris!

I have an M1 mac and was able to install SCT a few months ago I believe.

Could you try the following commands and show what gets printed out for each of them?

which python
where python
where conda
echo $PATH

which python
/opt/anaconda3/envs/fsleyes_env/bin/python

Where doesn’t work on my mac

echo $PATH

/opt/anaconda3/envs/fsleyes_env/bin:/opt/homebrew/opt/python@3.8/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/python@3.8/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Great - thanks @idris!

Here’s an update on my side, followed by some questions for you and then action tasks:

Update
I was able to install SCT successfully on my side. To do so, I first created a new user on my Mac, and followed the SCT installation instructions from Github (here).

As such, I am suspecting that your issue may be related to your OS/Path configuration and not solely due to having an M1 processor.

Note: we have some differences in our setup.

1 - You have anaconda also installed (per your result of which python).
2 - You are using a bash shell whereas I am using the zshrc shell (this is a change in the latest versions of Apple operating systems.

As such, I installed anaconda, and SCT installed successfully after that.

I also installed SCT successfully after switching from a zshrc shell to bash (+ Anaconda).

Questions for you

Could you please report the following information

  • Your operating system
  • If you migrated to your M1 Mac (transferred all your settings/files from an old laptop) or started from a clean install.

Action tasks for you

If possible, please do the following to help in debugging your issue

  • First, try another installation, but edit the install_sct file (using a file editor) by adding the following after line 618:

echo $EXPECTED_PYTHON
echo $ACTUAL_PYTHON

If you can’t, let me know and I can send you the edited file.

Afterwards, copy or screenshot the output after your attempted installation. eg, this is what I get:

(note the two identical lines for python3.6; you’ll likely get different paths due to your error).

  • Secondly, if possible, create a new user and try to install SCT in that fresh profile. Report back on if it works or not, and the results of the commands I asked you for in my earlier comment.
1 Like

Hi @idris – just wanted to know if you had tried some of my suggestions above to help debug your issue.

Hi @mathieuboudreau! I’m picking up this tread because I am having difficulties installing SCT on a mac M1 running BigSur + zshrc shell.

I’ll start by giving the output you requested to

which python

output:
/Users/evaalonsoortiz/opt/anaconda2/bin/python

where python

output:
/Users/evaalonsoortiz/opt/anaconda2/bin/python /Users/evaalonsoortiz/opt/anaconda2/bin/python /Users/evaalonsoortiz/opt/anaconda2/bin/python /usr/local/bin/python /usr/bin/python

where conda

output:
conda () { if [ "$#" -lt 1 ] then "$CONDA_EXE" $_CE_M $_CE_CONDA else \local cmd="$1" shift case "$cmd" in (activate | deactivate) __conda_activate "$cmd" "$@" ;; (install | update | upgrade | remove | uninstall) CONDA_INTERNAL_OLDPATH="${PATH}" __add_sys_prefix_to_path "$CONDA_EXE" $_CE_M $_CE_CONDA "$cmd" "$@" \local t1=$? PATH="${CONDA_INTERNAL_OLDPATH}" if [ $t1 = 0 ] then __conda_reactivate else return $t1 fi ;; (*) CONDA_INTERNAL_OLDPATH="${PATH}" __add_sys_prefix_to_path "$CONDA_EXE" $_CE_M $_CE_CONDA "$cmd" "$@" \local t1=$? PATH="${CONDA_INTERNAL_OLDPATH}" return $t1 ;; esac fi } /Users/evaalonsoortiz/opt/anaconda2/bin/conda /Users/evaalonsoortiz/opt/anaconda2/bin/conda /Users/evaalonsoortiz/opt/anaconda2/bin/conda /Users/evaalonsoortiz/opt/anaconda2/condabin/conda

echo $PATH

output:

/Users/evaalonsoortiz/sct_5.3.0/bin:/Users/evaalonsoortiz/sct_5.3.0/bin:/Users/evaalonsoortiz/opt/anaconda2/bin:/usr/local/fsl/bin:/opt/minc/1.9.16/bin:/opt/minc/1.9.16/pipeline:/opt/romeo_macOS/bin::~/Documents/bin/:/Applications/MATLAB_R2021a.app/bin/:/opt/local/bin:/opt/local/sbin:/Users/evaalonsoortiz/sct_5.3.0/bin:/Users/evaalonsoortiz/opt/anaconda2/bin:/usr/local/fsl/bin:/opt/minc/1.9.16/bin:/opt/minc/1.9.16/pipeline:/opt/romeo_macOS/bin::~/Documents/bin/:/Applications/MATLAB_R2021a.app/bin/:/opt/local/bin:/opt/local/sbin:/Users/evaalonsoortiz/sct_5.3.0/bin:/Users/evaalonsoortiz/opt/anaconda2/bin:/Users/evaalonsoortiz/opt/anaconda2/condabin:/usr/local/fsl/bin:/opt/minc/1.9.16/bin:/opt/minc/1.9.16/pipeline:/opt/romeo_macOS/bin::~/Documents/bin/:/Applications/MATLAB_R2021a.app/bin/:/opt/local/bin:/opt/local/sbin:/usr/local/fsl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5488_0/bin:/Users/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5488_0/bin:/Users/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5488_0/bin

Further info:

  • I migrated to my M1 mac
  • I’ve also edited the install_sct file as you suggested
  • ./install_sct seems to run fine
  • after the installation when I run source .zshrc and everytime I open my shell, the following appears:

>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
  File "/Users/evaalonsoortiz/opt/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 137, in main
    from ..activate import main as activator_main
  File "/Users/evaalonsoortiz/opt/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 23, in <module>
    from ._vendor.auxlib.compat import Utf8NamedTemporaryFile
  File "/Users/evaalonsoortiz/opt/anaconda2/lib/python2.7/site-packages/conda/_vendor/auxlib/compat.py", line 10, in <module>
    from ._vendor.five import WhateverIO as StringIO, with_metaclass
  File "/Users/evaalonsoortiz/opt/anaconda2/lib/python2.7/site-packages/conda/_vendor/auxlib/_vendor/five.py", line 80, in <module>
    absolute_to_nanoseconds = CoreServices.AbsoluteToNanoseconds
  File "/Users/evaalonsoortiz/opt/anaconda2/lib/python2.7/ctypes/__init__.py", line 379, in __getattr__
    func = self.__getitem__(name)
  File "/Users/evaalonsoortiz/opt/anaconda2/lib/python2.7/ctypes/__init__.py", line 384, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, AbsoluteToNanoseconds): symbol not found

$ /Users/evaalonsoortiz/opt/anaconda2/bin/conda shell.posix activate base

environment variables:
CIO_TEST=
CONDA_CHANGEPS1=false
CONDA_EXE=/Users/evaalonsoortiz/opt/anaconda2/bin/conda
CONDA_PYTHON_EXE=/Users/evaalonsoortiz/opt/anaconda2/bin/python
CONDA_ROOT=/Users/evaalonsoortiz/opt/anaconda2
CONDA_SHLVL=0
DYLD_LIBRARY_PATH=/opt/minc/1.9.16/lib:/opt/minc/1.9.16/lib/InsightToolkit:/opt/minc/1.9
.16/lib:/opt/minc/1.9.16/lib/InsightToolkit:/opt/minc/1.9.16/lib:/opt/
minc/1.9.16/lib/InsightToolkit:/opt/minc/1.9.16/lib:/opt/minc/1.9.16/l
ib/InsightToolkit:
MANPATH=/opt/minc/1.9.16/man:/opt/minc/1.9.16/man:/opt/minc/1.9.16/man:/opt/mi
nc/1.9.16/man:
MNI_DATAPATH=/opt/minc/1.9.16/…/share
PATH=/Users/evaalonsoortiz/opt/anaconda2/bin:/usr/local/fsl/bin:/opt/minc/1
.9.16/bin:/opt/minc/1.9.16/pipeline:/opt/romeo_macOS/bin::~/Documents/
bin/:/Applications/MATLAB_R2021a.app/bin/:/opt/local/bin:/opt/local/sb
in:/Users/evaalonsoortiz/sct_5.3.0/bin:/Users/evaalonsoortiz/sct_5.3.0
/bin:/Users/evaalonsoortiz/opt/anaconda2/bin:/usr/local/fsl/bin:/opt/m
inc/1.9.16/bin:/opt/minc/1.9.16/pipeline:/opt/romeo_macOS/bin::~/Docum
ents/bin/:/Applications/MATLAB_R2021a.app/bin/:/opt/local/bin:/opt/loc
al/sbin:/Users/evaalonsoortiz/sct_5.3.0/bin:/Users/evaalonsoortiz/opt/
anaconda2/bin:/usr/local/fsl/bin:/opt/minc/1.9.16/bin:/opt/minc/1.9.16
/pipeline:/opt/romeo_macOS/bin::~/Documents/bin/:/Applications/MATLAB_
R2021a.app/bin/:/opt/local/bin:/opt/local/sbin:/Users/evaalonsoortiz/s
ct_5.3.0/bin:/Users/evaalonsoortiz/opt/anaconda2/bin:/Users/evaalonsoo
rtiz/opt/anaconda2/condabin:/usr/local/fsl/bin:/opt/minc/1.9.16/bin:/o
pt/minc/1.9.16/pipeline:/opt/romeo_macOS/bin::~/Documents/bin/:/Applic
ations/MATLAB_R2021a.app/bin/:/opt/local/bin:/opt/local/sbin:/usr/loca
l/fsl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/U
sers/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5488_0/bin
:/Users/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5488_0/
bin:/Users/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5488
_0/bin:/Users/evaalonsoortiz/opt/anaconda2/pkgs/nextflow-19.10.0-hecc5
488_0/bin
REQUESTS_CA_BUNDLE=
SSL_CERT_FILE=

 active environment : None
        shell level : 0
   user config file : /Users/evaalonsoortiz/.condarc

populated config files :
conda version : 4.8.3
conda-build version : 3.18.9
python version : 2.7.16.final.0
virtual packages : __osx=10.16
base environment : /Users/evaalonsoortiz/opt/anaconda2 (read only)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /Users/evaalonsoortiz/opt/anaconda2/pkgs
/Users/evaalonsoortiz/.conda/pkgs
envs directories : /Users/evaalonsoortiz/.conda/envs
/Users/evaalonsoortiz/opt/anaconda2/envs
platform : osx-64
user-agent : conda/4.8.3 requests/2.22.0 CPython/2.7.16 Darwin/20.5.0 OSX/10.16
UID:GID : 501:20
netrc file : None
offline mode : False

An unexpected error has occurred. Conda has prepared the above report.


  • Lastly, after running the sct installer, if I type sct I get the following message:
    command not found: sct

Thanks for your insights!

Hi Eva!

To me the biggest red flag while reading your error report is that you might be using Anaconda that was downloaded/compiled for your previous machine that you migrated from.

I think I’d try creating a new user account on your machine, and test it there with a clean system. If Anaconda was installed system-wide, then maybe remove the paths to that anaconda installation in the zsh profile file for that new user account. Afterwards try the SCT install again there.

I know that Anaconda is finicky on the new Mac M1 and am uncertain if even the latest version is fully compatible; I’ve read that we should instead use this version of Miniforge instead as a substitute for the time being: https://github.com/conda-forge/miniforge. (see here for more info: https://medium.com/gft-engineering/macbook-m1-tensorflow-on-jupyter-notebooks-6171e1f48060).

As for the sct binaries not being available on the command line, that is likely due to the binaries (if they were correctly installed) not being added to your zsh path; have you checked if there is a link there to your SCT folder and if the binaries are actually in it?

Hope some of this helps! If this doesn’t resolve it, we could maybe do a pair-programming video call where we compare settings on both our systems and try the install together.

1 Like

Update: I got the installation to work with @mathieuboudreau 's suggestions.

What I did: I commented out all references to anaconda in my .zshrc file. Then I downloaded and installed miniforge. After that I re-ran the sct installer. Now I can run sct command line tools.

2 Likes