Closed jidicula closed 1 year ago
As a sidenote: if anyone on the team has bought one of the new Macs, it would be great if they could test the installation steps once we've written them up 😄
Happy to test this if you give me some user scenarios to try and provide feedback on
@mathieuboudreau could you start by trying to install it fresh into a new conda virtualenv (instructions here) following these directions and then running the full unit test suite?
First note: Python 3.7 isn't available on conda channel for ARM. Anaconda/Miniconda isn't compatible with Mac M1 at the moment, Miniforge is needed, and so it's restricting which Python version I can get.
Here is the output:
Last login: Tue Feb 9 14:02:28 on ttys001
(base) dev@MacBook-Pro ~ % conda create -n shim_venv python=3.7
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.7
Current channels:
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Trying using Python 3.8 as an alternative.
Numpy fails to install, due to a Fortran error.
Unsure why SCT didn't result in this error for numpy. You're forcing version 1.9.x vs SCT is downloading the latest version.
Installing the latest Numpy in your venv doesn't work either, it throws an error.
Looking into the Conda venv generated by SCT, it's using Python 3.6.12 (!?!) and Numpy 1.19.5 (!?!?!). @jcohenadad are your dependencies in SCT conda venv precompiled/packaged? Is that why it's maybe working for that tool but I can't use them here when pulling them through Miniforge?
I think the issue might be installing through pip
like you are vs conda channels that have builds ready for arm.
I just tried using Python 3.8.5 conda venv and conda install numpy
and it installed successfully.
Note: none of the above were done using the arch -x86_64
command
Thank you @mathieuboudreau for these investigations! cross-referencing https://github.com/neuropoly/spinalcordtoolbox/issues/3211 and tagging @joshuacwnewton @drulex @kousu @ahill187
are your dependencies in SCT conda venv precompiled/packaged? Is that why it's maybe working for that tool but I can't use them here when pulling them through Miniforge?
Our dependencies use pip, and I think they are precompiled (using wheels). But the rest of the team can correct me.
Possibly-related: https://github.com/neuropoly/spinalcordtoolbox/issues/2841
Note: none of the above were done using the
arch -x86_64
command
Thanks @mathieuboudreau! I was hoping to establish a baseline of what steps might fail, and you've given us a great picture of what our package experience currently looks like on the M1 Macs.
If it's not too much trouble, could you also try the same instructions above but prefixing commands with arch -x86_64
or running them in a Terminal that always runs through Rosetta?
Minor update (positive news!)
I created a new user account on my MBP and ran all the instructions with the prefix arch -x86_64
, here is my experience so far.
venv log installation log pytest log
Key things to note:
arch -x86_64
: source
, condo activate
, and cd
.
cd
doesn't show any error but doesn't actually open the folder. arch -x86_64
prefix.dcm2niix
and FSL in this user profile 🤦I'll now go through the process of installing both of those dependencies using arch -x86_64
and report back.
Another minor update with more positive news.
I installed dcm2niix (built from source) and FSL using the prefix arch -x86_64
. Note, FSL has a banner on their website stating incompatibility with M1 Macs, but I like to live life dangerously, so I tried it anyways.
dcm2niix build log FSL installation log re-running pytest log
Key things to note:
I checked and dcm2niix is in my path, so it may be that this tool isn't currently compatible with M1?
(shim_venv) dev-rosetta@MacBook-Pro shimming-toolbox % dcm2
dcm2bids dcm2bids_helper dcm2niibatch
dcm2bids2 dcm2bids_scaffold dcm2niix
There isn't any issues open on the dcm2niix about this. Maybe I should not try to install from source and instead install from conda?
I just tried installing dcm2niix using conda (with the arch -x86_64
prefix), and not only do the tests still fail, but now more tests fail.
Funny thing, I just tried running dcm2niix
on a sample dataset I found on google [here]((https://medistim.com/dicom/) (bmode), and it ran fine:
And the image looks fine on FSLeyes (!!! @jcohenadad, it works on M1! (at least through the full FSL installation + the arch -x86_64
prefix)):
So maybe dcm2niix
isn't the the sole reason for the test failures above on the M1?
Also @jcohenadad as a sidenote, the very strange thing about FSLeyes working is that I didn't do any manual changes related to the OpenGL issue we previously encountered...? 🛸
Thank you @mathieuboudreau . This is overall quite promising indeed, but I am worried how we will document the installation of Python, requirements and every 3rd party software. Anyways, your investigations are gold 🏅
In this transition period that people with M1 macs are experiencing, maybe a video walkthrough of the installation experience would suffice for this edge case?
I got my hands on a M1 laptop and tested the installation of shimming toolbox.
MacBook Pro (13-inch, M1, 2020) MacOS Monterey Version 12.0.1
I downloaded fsl using their latest available version: MacOS BigSur Version 10.16 Everything downloaded and installed fine. I'm able to run prelude and fsleyes.
I downloaded SCT and ran into an error while installing:
Check if Keras (2.3.1) is installed................../install_sct: line 748: 31052 Illegal instruction: 4 sct_check_dependencies`
There is already a PR in the work addressing this issue: https://github.com/spinalcordtoolbox/spinalcordtoolbox/pull/3569
I followed the normal MacOS instructions using make install
and was able to call the CLIs. I tested the installation by running pytest in the venv it created. The only tests that did not pass were the ones requiring SCT which obviously did not work since SCT was not able to be installed properly.
So this is great news! We don't seem to need separate instructions for shimming-toolbox.
Thank you for reporting this @po09i , regarding the SCT installation error, can you please try installing the stable 5.4 release? tagging @joshuacwnewton
Thank you for reporting this @po09i , regarding the SCT installation error, can you please try installing the stable 5.4 release?
I installed v5.4 and everything is working fine.
Shimming toolbox st_check_dependencies
also works fine now that SCT is installed properly.
Checklist
Description of Problem / Inefficiency:
Our current documentation is fine for macOS on Intel chips, but with the new lineup of M1 Macs using the Apple Silicon architecture, each of the commands would have to be prefixed with
arch -x86_64
to use the Rosetta 2 emulator[1].Implementation Suggestion:
Add a section just for M1 Macs with each command (including prelude installation) prefixed with
arch -x86_64
.Additional Context / Screenshots:
[1] https://news.ycombinator.com/item?id=25132679