Installation instructions for macOS with M1 or M2 chip
Requirements
Conda is a package management system and environment management system.
- Go to https://docs.conda.io/en/latest/miniconda.html
- Download Miniconda3 macOS Apple M1 64-bit bash in Latest Miniconda Installer Links
- Run in your Downloads folder, in the Terminal
bash Miniconda3-latest-MacOSX-arm64.sh
- Type 'Enter'
space (several times)
'yes'
'ENTER' (default)
and answer 'yes' to (conda init)
It will download basic packages and install Miniconda x86_64 at the specified path. Finally it will run conda init
.
Please check the modified configuration file to deal with possible problems (most of the time this file is ~/.zshrc or ~/.bash_profile).
- Close and reopen terminal window.
Setting up the conda environment
nm-bridge requires on macOS a conda environment with osx-64 architecture and python version <=3.10.
Run the following command to get the right architecture and python 3.10
CONDA_SUBDIR=osx-64 conda create -n neuromod python=3.10
This line has created the conda environment necessary for the demo and called neuromod. We simply set the CONDA_SUBDIR environment variable to indicate that conda should create the environment with an x86 Python executable.
Then we activate the environment as follows
conda activate neuromod
The following line ensures that conda installs x86 versions of Python packages into the environment.
conda config --env --set subdir osx-64
mamba allows to manage conda environments more efficiently than conda, in particular for installing packages. To install mamba in the neuromod environment, run the following
conda install -c conda-forge mamba
In tne neuromod environment, we will need several dependencies, used in the demo script, which we install as follows
mamba install -c conda-forge r-igraph jupyter
(answer 'yes')
Installing nm-bridge
We install nm-bridge in the neuromod environment as follows:
mamba install -c neuromod -c conda-forge nm-bridge python=3.10
(answer 'yes')
Updating nm-bridge
In case of update of nm-bridge, run inside the neuromod environment
mamba update -c neuromod -c conda-forge nm-bridge
Troubleshooting
If you try to use nm-bridge in R, while being in the same conda environment as before, and you meet the following problem:
> library(nmbridge)
Error in library(nmbridge) : there is no package called ‘nmbridge’
there is probably a conflict at conda init
command.
If ~/.zshrc was modified at conda init
command, there is probably another configuration file such as ~/.zprofile that needs to be modified and the same content as in ~/.zshrc should be added into it (same process for ~/.bash_profile and ~/.bashrc if it is the case).