- Step 1: Request for a powershell terminal.
Using nomachine:
- Select Applications tab
- Select RCE Powered Applications
- Select Anaconda Shell (Python 3.6) 5.2.0
- Select required number of cores and RAM
This will open a terminal.
- Step 2: Make sure that conda is installed. Run:
which condaIf conda is installed, the command should return a path. For example:
/nfs/tools/lib/anaconda/3-5.2.0/bin/conda- Step 3: Under your user account, create
.condafolder. For example, my account name isnak443and my.condafolder is located in the following path:
nfs/home/N/nak443/shared_space/ci3_nak443/.conda- Step 4: Under the
.condafolder, createpkgsandenvsfolders. - Step 5: Export the path of these folders. In my case, it will be:
export CONDA_PKGS_DIRS=/nfs/home/N/nak443/shared_space/ci3_nak443/.conda/pkgs
export CONDA_ENVS_PATH=/nfs/home/N/nak443/shared_space/ci3_nak443/.conda/envs- Step 6: Take a look at the current environment:
conda env listIf your environment is already exist, move to step xyz.
- Step 7: Create a recipe for environment. For example this is r_env.yaml file content. You can put the library version infront of the library name and make the environment more customized.
name: r_env
channels:
- conda-forge
- anaconda
dependencies:
- r-base=4.1
- r-tidyverse
- r-devtools
- r-xgboost
- r-superlearner
- r-earth
- r-ranger
- r-gam
- r-kernsmooth
- r-gnm
- r-polycor
- r-wcorr
- r-rlang
- r-glue
- r-logger
- r-cli
- python
- cmake
- jupyterlab
- jupyter_client- Step 8: Create your environment.
conda env create -n r_env -f r_env.yaml- Step 9: Activate your environment.
conda activate r_env- Step 10: Start an R session.
R- Step 11: Install IRkernel and register kernel in jupyter lab
# In R
library('devtools')
devtools::install_github("IRkernel/IRkernel")
IRkernel::installspec()- Step 12: Install other packages. For example, I want to install nloptr and lme4 packages.
install.packages('nloptr')
install.packages('lme4')- Step 13: Now you can either use interactive R or start a Jupyter lab. If you decided to go with jupyter lab, type:
jupyter lab