Installation and Setup Instructions
This guide outlines the steps to install and set up the necessary tools and packages for the short course, including R, Python, and rpy2
for connecting Python to R.
Step 1: Install Conda
1.1 Install Miniconda or Anaconda
- Visit the official Conda website.
- Download the installer for Miniconda (lightweight) or Anaconda (full distribution) appropriate for your operating system.
- Follow the installation instructions for your operating system.
Step 2: Create a Conda Environment
- Open your terminal (or command prompt on Windows).
- Create a new Conda environment with Python 3.10 by running:
conda create -n my_env python=3.10
- Activate the new environment:
conda activate my_env
Step 3: Install R and Required R Packages
3.1 Install R
Option 1 (recommended): Install R by conda
conda install r-base
Option 2: Install R independently
- Go to the R Project website.
- Download the appropriate version of R for your operating system (Windows, macOS, or Linux).
- Follow the installation instructions to complete the setup.
- Since rpy2 is a dependency, please refer to rpy2 official documentation in case any issue is raised.
3.2 Install required R package
Open an R session and run the following commands to install the required packages:
install.packages("tidyverse")
install.packages("geoR")
install.packages("BRISC")
install.packages("spNNGP")
install.packages("RandomForestGLS")
Please install other dependencies used in the lecture in similar manner accordingly.
Step 4: Install GeospaNN
4.1 Manual dependency installation
We provide options to install PyG libraries using conda and pip.
Option 1 (recommended): Using Conda
For conda, installation in the following order is recommended. It may take around 10 minutes for conda to solve the environment for pytorch-sparse. The following chunk has been tested in a python 3.10 environment.
conda install pytorch torchvision -c pytorch
conda install pyg -c pyg
conda install pytorch-sparse -c pyg
Option 2: Using pip
For pip, installation in the following order is recommended to avoid any compilation issue. It may take around 15 minutes to finish the installation. The following chunk has been tested in a python 3.10 environment.
pip install numpy==1.26 --no-cache-dir
pip install torch==2.0.0 --no-cache-dir
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.0.0.html --no-cache-dir
pip install torch-sparse -f https://data.pyg.org/whl/torch-2.0.0.html --no-cache-dir
pip install torch-cluster -f https://data.pyg.org/whl/torch-2.0.0.html --no-cache-dir
pip install torch_geometric --no-cache-dir
4.2 Main installation
Once PyTorch and PyG are successfully installed, use the following command in the terminal for the latest version (recommended):
pip install https://github.com/WentaoZhan1998/geospaNN/archive/main.zip
To install the pypi version, use the following command in the terminal:
pip install geospaNN