Installation failed in Mac 10.14.6

Hi! I tried to install the program on a Mac and I got this error. I couldn’t find anything similar on the forum, any ideas?


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



Checking OS type and version...

Darwin pc142215 18.7.0 Darwin Kernel Version 18.7.0: Mon Mar  8 22:11:48 PST 2021; root:xnu-4903.278.65~1/RELEASE_X86_64 x86_64
ProductVersion:	10.14.6

Checking requirements...


OK!


SCT version ......... 5.4
Installation type ... package
Operating system .... osx (10.14.6)
Shell config ........ /Users/s5110052/.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/s5110052/sct_5.4]



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

Copying source files from /Users/s5110052/Downloads/spinalcordtoolbox-5.4 to /Users/s5110052/sct_5.4

....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Installing conda...


rm -rf /Users/s5110052/sct_5.4/python


mkdir -p /Users/s5110052/sct_5.4/python


curl -sS -o /var/folders/gk/f3jth6811mjds0drzp171tg1y9rf7_/T/tmp.C2Y1TFgN/miniconda.sh -L https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh


bash /var/folders/gk/f3jth6811mjds0drzp171tg1y9rf7_/T/tmp.C2Y1TFgN/miniconda.sh -p /Users/s5110052/sct_5.4/python -b -f

PREFIX=/Users/s5110052/sct_5.4/python
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                       
Solving environment: done

## Package Plan ##

  environment location: /Users/s5110052/sct_5.4/python

  added / updated specs:
    - brotlipy==0.7.0=py39h9ed2024_1003
    - ca-certificates==2021.7.5=hecd8cb5_1
    - certifi==2021.5.30=py39hecd8cb5_0
    - cffi==1.14.6=py39h2125817_0
    - chardet==4.0.0=py39hecd8cb5_1003
    - conda-package-handling==1.7.3=py39h9ed2024_1
    - conda==4.10.3=py39hecd8cb5_0
    - cryptography==3.4.7=py39h2fd3fbb_0
    - idna==2.10=pyhd3eb1b0_0
    - libcxx==10.0.0=1
    - libffi==3.3=hb1e8313_2
    - ncurses==6.2=h0a44026_1
    - openssl==1.1.1k=h9ed2024_0
    - pip==21.1.3=py39hecd8cb5_0
    - pycosat==0.6.3=py39h9ed2024_0
    - pycparser==2.20=py_2
    - pyopenssl==20.0.1=pyhd3eb1b0_1
    - pysocks==1.7.1=py39hecd8cb5_0
    - python.app==3=py39h9ed2024_0
    - python==3.9.5=h88f2d9e_3
    - readline==8.1=h9ed2024_0
    - requests==2.25.1=pyhd3eb1b0_0
    - ruamel_yaml==0.15.100=py39h9ed2024_0
    - setuptools==52.0.0=py39hecd8cb5_0
    - six==1.16.0=pyhd3eb1b0_0
    - sqlite==3.36.0=hce871da_0
    - tk==8.6.10=hb0a8c7a_0
    - tqdm==4.61.2=pyhd3eb1b0_1
    - tzdata==2021a=h52ac0ba_0
    - urllib3==1.26.6=pyhd3eb1b0_1
    - wheel==0.36.2=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-py39h9ed2024_1003
  ca-certificates    pkgs/main/osx-64::ca-certificates-2021.7.5-hecd8cb5_1
  certifi            pkgs/main/osx-64::certifi-2021.5.30-py39hecd8cb5_0
  cffi               pkgs/main/osx-64::cffi-1.14.6-py39h2125817_0
  chardet            pkgs/main/osx-64::chardet-4.0.0-py39hecd8cb5_1003
  conda              pkgs/main/osx-64::conda-4.10.3-py39hecd8cb5_0
  conda-package-han~ pkgs/main/osx-64::conda-package-handling-1.7.3-py39h9ed2024_1
  cryptography       pkgs/main/osx-64::cryptography-3.4.7-py39h2fd3fbb_0
  idna               pkgs/main/noarch::idna-2.10-pyhd3eb1b0_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.3-py39hecd8cb5_0
  pycosat            pkgs/main/osx-64::pycosat-0.6.3-py39h9ed2024_0
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-20.0.1-pyhd3eb1b0_1
  pysocks            pkgs/main/osx-64::pysocks-1.7.1-py39hecd8cb5_0
  python             pkgs/main/osx-64::python-3.9.5-h88f2d9e_3
  python.app         pkgs/main/osx-64::python.app-3-py39h9ed2024_0
  readline           pkgs/main/osx-64::readline-8.1-h9ed2024_0
  requests           pkgs/main/noarch::requests-2.25.1-pyhd3eb1b0_0
  ruamel_yaml        pkgs/main/osx-64::ruamel_yaml-0.15.100-py39h9ed2024_0
  setuptools         pkgs/main/osx-64::setuptools-52.0.0-py39hecd8cb5_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
  sqlite             pkgs/main/osx-64::sqlite-3.36.0-hce871da_0
  tk                 pkgs/main/osx-64::tk-8.6.10-hb0a8c7a_0
  tqdm               pkgs/main/noarch::tqdm-4.61.2-pyhd3eb1b0_1
  tzdata             pkgs/main/noarch::tzdata-2021a-h52ac0ba_0
  urllib3            pkgs/main/noarch::urllib3-1.26.6-pyhd3eb1b0_1
  wheel              pkgs/main/noarch::wheel-0.36.2-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

## Package Plan ##

  environment location: /Users/s5110052/sct_5.4/python/envs/venv_sct

  added / updated specs:
    - python=3.6


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2021.10.26 |       hecd8cb5_2         115 KB
    certifi-2020.12.5          |   py36hecd8cb5_0         141 KB
    libcxx-12.0.0              |       h2f01273_0         805 KB
    ncurses-6.3                |       hca72f7f_2         856 KB
    openssl-1.1.1l             |       h9ed2024_0         2.2 MB
    pip-21.0.1                 |   py36hecd8cb5_0         1.8 MB
    python-3.6.13              |       h88f2d9e_0        16.8 MB
    setuptools-58.0.4          |   py36hecd8cb5_0         777 KB
    tk-8.6.11                  |       h7bc2e8c_0         3.0 MB
    wheel-0.37.0               |     pyhd3eb1b0_1          33 KB
    ------------------------------------------------------------
                                           Total:        26.6 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2021.10.26-hecd8cb5_2
  certifi            pkgs/main/osx-64::certifi-2020.12.5-py36hecd8cb5_0
  libcxx             pkgs/main/osx-64::libcxx-12.0.0-h2f01273_0
  libffi             pkgs/main/osx-64::libffi-3.3-hb1e8313_2
  ncurses            pkgs/main/osx-64::ncurses-6.3-hca72f7f_2
  openssl            pkgs/main/osx-64::openssl-1.1.1l-h9ed2024_0
  pip                pkgs/main/osx-64::pip-21.0.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-58.0.4-py36hecd8cb5_0
  sqlite             pkgs/main/osx-64::sqlite-3.36.0-hce871da_0
  tk                 pkgs/main/osx-64::tk-8.6.11-h7bc2e8c_0
  wheel              pkgs/main/noarch::wheel-0.37.0-pyhd3eb1b0_1
  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
tk-8.6.11            | 3.0 MB    | ##################################### | 100% 
pip-21.0.1           | 1.8 MB    | ##################################### | 100% 
ncurses-6.3          | 856 KB    | ##################################### | 100% 
libcxx-12.0.0        | 805 KB    | ##################################### | 100% 
setuptools-58.0.4    | 777 KB    | ##################################### | 100% 
openssl-1.1.1l       | 2.2 MB    | ##################################### | 100% 
ca-certificates-2021 | 115 KB    | ##################################### | 100% 
python-3.6.13        | 16.8 MB   | ##################################### | 100% 
wheel-0.37.0         | 33 KB     | ##################################### | 100% 
certifi-2020.12.5    | 141 KB    | ##################################### | 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

sed: can't read s/^ENABLE_USER_SITE.*$/ENABLE_USER_SITE = False/: No such file or directory

Installation failed!

Please copy the output of this Terminal (starting with the command install_sct) and upload it as a .txt attachment in a new topic on SCT's forum:

--> http://forum.spinalcordmri.org/c/sct

Hi @esiesil, sorry about that. You’re running into a bit of workaround code I wrote. I’m guessing you did brew install gnu-sed at some point, and I didn’t think to consider that in my workaround!

We’re on the way to fixing this up for you.

2 Likes

Until we get a new release for you, you can run this (copy paste the whole thing) to get it working

cd /Users/s5110052/sct_5.4
patch <<EOF
From 6592dfc01cf7900dad33788ecabfdaf23b5f4338 Mon Sep 17 00:00:00 2001
From: Joshua Newton <joshuacwnewton@gmail.com>
Date: Wed, 17 Nov 2021 12:45:21 -0500
Subject: [PATCH] \`install_sct\`: Replace sed with \`perl -pi -e\`

---
 install_sct | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/install_sct b/install_sct
index 205a1a20c..26fe7e7d9 100755
--- a/install_sct
+++ b/install_sct
@@ -325,17 +325,6 @@ if [ "\$(uname)" = "Darwin" ]; then
   (command -v realpath >/dev/null) || realpath() {
     python3 -c 'import sys, os; [print(os.path.realpath(f)) for f in sys.argv[1:]]' "\$@"
   }
-
-
-  # glue over the difference between how BSD and GNU sed work with -i
-  # https://code-examples.net/en/q/56e314
-  sed_i() {
-    sed -i '' "\$@"
-  }
-else
-  sed_i() {
-    sed -i "\$@"
-  }
 fi
 
 # ======================================================================================================================
@@ -613,7 +602,7 @@ find "\$SCT_DIR/\$PYTHON_DIR" -type f -exec touch {} +
 # * https://github.com/spinalcordtoolbox/spinalcordtoolbox/issues/3200
 # this needs to be added very early in python's boot process
 # so using sitecustomize.py or even just appending to the file are impossible.
-sed_i 's/^ENABLE_USER_SITE.*\$/ENABLE_USER_SITE = False/' "\$SCT_DIR/\$PYTHON_DIR/envs/venv_sct/lib/python"*"/site.py"
+perl -pi -e 's/^ENABLE_USER_SITE.*\$/ENABLE_USER_SITE = False/' "\$SCT_DIR/\$PYTHON_DIR/envs/venv_sct/lib/python"*"/site.py"
 
 # activate miniconda
 # shellcheck disable=SC1091
@@ -721,11 +710,11 @@ conda deactivate >/dev/null 2>&1
 if [[ -e "\$RC_FILE_PATH" ]]; then
     if grep "sct_env" "\$RC_FILE_PATH"; then
       print info "In case an old version SCT is already installed (4.0.0-beta.1 or before), remove 'sct_env' declaration in RC file"
-      sed_i '/sct_env/ s/^#*/#/' "\$RC_FILE_PATH"
+      perl -pi -e '/sct_env/ s/^#*/#/' "\$RC_FILE_PATH"
     fi
     if grep "^export MPLBACKEND=Agg" "\$RC_FILE_PATH"; then
       print info "Commenting out 'export MPLBACKEND=Agg' from previous SCT installation"
-      sed_i 's/^export MPLBACKEND=Agg/# The line below has been commented out by a more recent installation of SCT,\\
+      perl -pi -e 's/^export MPLBACKEND=Agg/# The line below has been commented out by a more recent installation of SCT,\\
 # because export MPLBACKEND=Agg is no longer needed as of SCT v5.4.0\\
 # export MPLBACKEND=Agg/' "\$RC_FILE_PATH"
     fi
-- 
2.34.0

EOF
./install_sct

Thanks for your quick reply @nguenthe.
I tried your code above, but the installation failed. Please see below:

 chardet            pkgs/main/osx-64::chardet-4.0.0-py39hecd8cb5_1003
  conda              pkgs/main/osx-64::conda-4.10.3-py39hecd8cb5_0
  conda-package-han~ pkgs/main/osx-64::conda-package-handling-1.7.3-py39h9ed2024_1
  cryptography       pkgs/main/osx-64::cryptography-3.4.7-py39h2fd3fbb_0
  idna               pkgs/main/noarch::idna-2.10-pyhd3eb1b0_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.3-py39hecd8cb5_0
  pycosat            pkgs/main/osx-64::pycosat-0.6.3-py39h9ed2024_0
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-20.0.1-pyhd3eb1b0_1
  pysocks            pkgs/main/osx-64::pysocks-1.7.1-py39hecd8cb5_0
  python             pkgs/main/osx-64::python-3.9.5-h88f2d9e_3
  python.app         pkgs/main/osx-64::python.app-3-py39h9ed2024_0
  readline           pkgs/main/osx-64::readline-8.1-h9ed2024_0
  requests           pkgs/main/noarch::requests-2.25.1-pyhd3eb1b0_0
  ruamel_yaml        pkgs/main/osx-64::ruamel_yaml-0.15.100-py39h9ed2024_0
  setuptools         pkgs/main/osx-64::setuptools-52.0.0-py39hecd8cb5_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
  sqlite             pkgs/main/osx-64::sqlite-3.36.0-hce871da_0
  tk                 pkgs/main/osx-64::tk-8.6.10-hb0a8c7a_0
  tqdm               pkgs/main/noarch::tqdm-4.61.2-pyhd3eb1b0_1
  tzdata             pkgs/main/noarch::tzdata-2021a-h52ac0ba_0
  urllib3            pkgs/main/noarch::urllib3-1.26.6-pyhd3eb1b0_1
  wheel              pkgs/main/noarch::wheel-0.36.2-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

## Package Plan ##

  environment location: /Users/s5110052/sct_5.4/python/envs/venv_sct

  added / updated specs:
    - python=3.6


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2021.10.26 |       hecd8cb5_2         115 KB
    certifi-2020.6.20          |     pyhd3eb1b0_3         155 KB
    libcxx-12.0.0              |       h2f01273_0         805 KB
    ncurses-6.3                |       hca72f7f_2         856 KB
    openssl-1.1.1l             |       h9ed2024_0         2.2 MB
    pip-21.2.2                 |   py36hecd8cb5_0         1.8 MB
    python-3.6.13              |       h88f2d9e_0        16.8 MB
    setuptools-58.0.4          |   py36hecd8cb5_0         777 KB
    tk-8.6.11                  |       h7bc2e8c_0         3.0 MB
    wheel-0.37.0               |     pyhd3eb1b0_1          33 KB
    ------------------------------------------------------------
                                           Total:        26.6 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2021.10.26-hecd8cb5_2
  certifi            pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3
  libcxx             pkgs/main/osx-64::libcxx-12.0.0-h2f01273_0
  libffi             pkgs/main/osx-64::libffi-3.3-hb1e8313_2
  ncurses            pkgs/main/osx-64::ncurses-6.3-hca72f7f_2
  openssl            pkgs/main/osx-64::openssl-1.1.1l-h9ed2024_0
  pip                pkgs/main/osx-64::pip-21.2.2-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-58.0.4-py36hecd8cb5_0
  sqlite             pkgs/main/osx-64::sqlite-3.36.0-hce871da_0
  tk                 pkgs/main/osx-64::tk-8.6.11-h7bc2e8c_0
  wheel              pkgs/main/noarch::wheel-0.37.0-pyhd3eb1b0_1
  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
openssl-1.1.1l       | 2.2 MB    | ##################################### | 100% 
certifi-2020.6.20    | 155 KB    | ##################################### | 100% 
setuptools-58.0.4    | 777 KB    | ##################################### | 100% 
pip-21.2.2           | 1.8 MB    | ##################################### | 100% 
python-3.6.13        | 16.8 MB   | ##################################### | 100% 
wheel-0.37.0         | 33 KB     | ##################################### | 100% 
libcxx-12.0.0        | 805 KB    | ##################################### | 100% 
ca-certificates-2021 | 115 KB    | ##################################### | 100% 
tk-8.6.11            | 3.0 MB    | ##################################### | 100% 
ncurses-6.3          | 856 KB    | ##################################### | 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

/opt/anaconda2/etc/conda/deactivate.d/ants_env.sh: line 2: unset: `ANTSPATH=/opt/anaconda2/bin/n': not a valid identifier

Installation failed!

Please copy the output of this Terminal (starting with the command install_sct) and upload it as a .txt attachment in a new topic on SCT's forum:

--> http://forum.spinalcordmri.org/c/sct

Based on the error message, my best guess is that some point in the past, ANTs was installed on your system using conda, and the corresponding conda environment was modified to add the ANTSPATH environment variable. But, I think there might be an issue with how this environment variable is being unset.

To verify that this is the problem, in a new terminal window, try deactivating the existing conda environment to see if you encounter the same error:

conda deactivate

If the same error occurs, you may want to double-check Line 2 of your /opt/anaconda2/etc/conda/deactivate.d/ants_env.sh script to make sure that ANTSPATH is being set correctly. (See also: this StackOverflow answer.)

Apart from that, as far as the SCT installation is concerned, can you make sure that any existing conda environments are deactivated before you start SCT’s install script?

Cheers,
Joshua

Hi @joshuacwnewton, thanks for your help!
Sorry, but I haven’t been able to troubleshoot the issue. I’m not experienced with this, apologies.

I tried conda deactivate as suggested. No output comes up on the terminal. I proceeded to install spinal cord toolbox again but the same error persists:

$ conda deactivate

sed: can’t read s/^ENABLE_USER_SITE.*$/ENABLE_USER_SITE = False/: No such file or directory

Installation failed!

I’ve checked the ants_env.sh file, as per your recommendation. I have found I have many files (?) with this name (this is a shared computer, not sure who installed ANTS before). Three ants_env.sh are stored in the activate.d folder and the other three are in the deactivate.d folder. The paths for each of the three files in the deactivate folder are:
/opt/anaconda2/pkgs/ants-2.3.1-0/etc/conda/deactivate.d/ants_env.sh
/opt/anaconda3/pkgs/ants-2.3.1-0/etc/conda/deactivate.d/ants_env.sh
/opt/anaconda2/etc/conda/deactivate.d/ants_env.sh

When I type in the terminal which conda, I get: /opt/anaconda2/bin/conda

The content of each of the ants_env.sh are:

  1. /opt/anaconda2/pkgs/ants-2.3.1-0/etc/conda/deactivate.d/ants_env.sh:
    #!/bash/bin
    unset ANTSPATH=/opt/anaconda2/bin/ANTS\n

  2. /opt/anaconda3/pkgs/ants-2.3.1-0/etc/conda/deactivate.d/ants_env.sh:
    #!/bash/bin
    unset ANTSPATH=/Users/mdiazmel/miniconda3/conda-bld/ants_1585902972372/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/\n

  3. /opt/anaconda2/etc/conda/deactivate.d/ants_env.sh:
    #!/bash/bin
    unset ANTSPATH=/opt/anaconda2/bin/\n
    In this deactivate.d folder, there are other files (deactivate_clang_osx-64.sh, deactivate_clangxx_osx-64.sh, deactivate-gfortran_osx-64.sh and java_home.sh)

Any ideas on how to proceed? Apologies once again for all this mess…
Thanks,
Eva

Hi Eva,

Thank you for being so thorough with your response. The extra details that you provided make it very easy to debug your problem. :slightly_smiling_face:

I would recommend modifying all three files to remove the extra “=” text. For example:

Before:

#!/bash/bin
unset ANTSPATH=/opt/anaconda2/bin/ANTS\n

After:

#!/bash/bin
unset ANTSPATH

(The goal is to make your “ants_env.sh” scripts inside the “deactivate.d/” folders look similar to “Step 4.” from this guide, by excluding the “=” part.)

Once you make this change and save your files, then please run the suggestion from @nguenthe’s comment once more.

Kind regards,
Joshua