Getting started¶
The notebooks can be downloaded from a tutorials folder on GitHub
This note will cover the technical setup that allows to locally run the notebooks and reproduce the results. It is recommended to use a micromamba environment and this section will be using it to setup a jupyter notebook or VScode workflows.
Setup¶
The two cases either use the Jupyter notebook interface, or Visual Studio Code to run the tutorials.
Once you have downloaded the repo or copied the tutorials notebooks into a folder, navigate to it via the terminal. Once inside, run the following:
[ ]:
# with conda
conda env create -n snail_env \
python=3.11 geopandas shapely rasterio python-igraph
conda activate snail_env
# with micromamba
micromamba create -n snail-env \
python=3.11 geopandas shapely rasterio python-igraph -c conda-forge
micromamba activate snail-env
The previous step will setup a conda or micromamba virtual environment with some packages and activate it. Next, install the snail package, it will bring with intself a bunch of dependencies to run the tutorials.
[ ]:
pip install nismod-snail
Running the tutorials¶
At this point, if you type jupyter notebook
in the terminal and execute, a jupyter server will start and open a browser window with the repository containing the tutorials.
Using VSCode¶
If you are using VSCode, you might run into issues with micromamba as it does not recognise it by default, it will look for venv
and conda
virtual environments only. Open VSCode from inside the tutorials folder and open the first tutorial. Now back to the terminal, execute the following command:
[ ]:
# on MAC
which python
# on Windows
where python
Now on the upper right corner of VSCode choose Select Kernel. When the options show up, go for Select another kernel. In the searchbar, paste the output of the terminal command, it should be something like: USERNAME/micromamba/envs/snail-env/bin/python
After that, VSCode will connect to the virtual environment you created earlier and you will be all set up !