Dear SCT team!
I was installing SCT 5.6 but the installation process failed.
Commands I used:
$ git clone https://github.com/spinalcordtoolbox/spinalcordtoolbox sct_v5.6.0
$ cd sct_v5.6.0
$ git checkout 5.6
$ ./install_sct
The end of the installation output:
#source /usr/local/lib/sct/bin/sct_env
In case an old version SCT is already installed (4.0.0-beta.1 or before), remove 'sct_env' declaration in RC file
syntax error at -e line 1, near "/sct_env/ s/^#*/#/"
Execution of -e aborted due to compilation errors.
Installation failed!
The complete file log is attached.
Info about my system:
$ sct_check_dependencies -short (5.6|\u20261)
--
Spinal Cord Toolbox (git-HEAD-45b1c1759f991332697b4120160303e963f7a3c7)
sct_check_dependencies -short
--
SCT info:
- version: git-HEAD-45b1c1759f991332697b4120160303e963f7a3c7
- path: /usr/local/lib/sct_latest
OS: linux (Linux-5.10.0-0.bpo.9-amd64-x86_64-with-debian-10.12)
CPU cores: Available: 16, Used by ITK functions: 16
RAM: Total: 128744MB, Used: 27730MB, Available: 99281MB
Best,
Jan
install_sct_log.txt (78.3 KB)
Hello,
This is absolutely a bug. It looks like it was introduced in https://github.com/spinalcordtoolbox/spinalcordtoolbox/pull/3591. I think we never tested that particular line, because it’s a rare case.
To get around it, can you open up your ~/.bashrc
, find the lines that say sct_env
, and just delete them? Sorry for the trouble. We’ll get that patched for the next version.
Or, better yet, do you think you could first upload your ~/.bashrc
so we can test against it? And second, if you’re feeling confident reading patches and shell code, maybe could you test the patch I have:
diff --git a/install_sct b/install_sct
index 317393303c..2a44e763ea 100755
--- a/install_sct
+++ b/install_sct
@@ -717,7 +717,7 @@ 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"
- perl -pi -e '/sct_env/ s/^#*/#/' "$RC_FILE_PATH"
+ perl -pi -e 's/^(sct_env)/# \1/' "$RC_FILE_PATH"
fi
if grep "^export MPLBACKEND=Agg" "$RC_FILE_PATH"; then
print info "Commenting out 'export MPLBACKEND=Agg' from previous SCT installation"
I think this does the right thing but I don’t have an easy way to test. I would have to dig up an old version of SCT and I’m not sure that all the parts would even still download right.
1 Like
I have in my ~/.zshrc
file just following two lines related to the SCT:
# SCT latest
export PATH="/usr/local/lib/sct_latest/bin:$PATH"
export SCT_DIR="/usr/local/lib/sct_latest"
i.e., I have no line containing sct_env
.
(I have several SCT versions - sct_latest synchronised with the master branch and several others for individual tags (e.g., 5.6). I use primarily the latest version, that’s why I have just these two lines included in my ~/.zshrc
.)
Anyway, I have tried your patch and the installation finished successfully!
git pull
git checkout ng/3804-fix
./install_sct
Thanks for your quick response!
Jan