How to Install miniforge

    This guide explains how to install "miniforge" in the work area of SQUID.
     
    1. Log in to SQUID and follow the steps below. In this guide, we use /sqfs/work/(group_name)/(user_id)/miniforge as the directory for installing Miniforge. Please replace it with your own directory as appropriate.

    2. Set the environment variables needed to use Miniforge. This setting is not necessary for subsequent uses.

    (Note) Executing conda init updates ~/.bashrc. However, if conda-related software is already installed, ~/.bashrc may not be updated correctly. In such a case, edit .bashrc, delete the lines from "# >>> conda initialize >>>" to "# <<< conda initialize <<<", and then re-execute conda init.
    (Note) Please note that "default" channel cannot be used. If you have it registered as a channel, please remove it by executing the command conda config --remove channels defaults.

     

 

How to use

    List of virtual environments

      Displays the list of virtual environments that have already been built.

      conda info -e

      # conda environments:
      #
      base /sqfs/work/(group_name)/(user_id)/miniforge

       

    Creating a new virtual environment

      The following is the procedure for creating a new virtual environment called test-env in the user area.

      First, specify the conda_env directory under the work area as the destination of the virtual environment. (If you do not specify any directory, the virtual environment will be created in the .conda directory under the home area, which may overflow the capacity.)

      conda config --add envs_dirs /sqfs/work/(group_name)/(user_id)/conda_env
      conda config --add pkgs_dirs /sqfs/work/(group_name)/(user_id)/conda_pkg

      Generate the virtual environment test-env.

      conda create --name test-env python=3.8

      If you view the list of virtual environments, you will see that test-env has been generated.

      conda info -e
      # conda environments:
      #
      test-env * /sqfs/work/(group_name)/(user_id)/conda_env/test-env
      base /sqfs/work/(group_name)/(user_id)/miniforge

       

    Enabling the virtual environment

      Enable the virtual environment test-env.

      conda activate test-env

       

    Installing software in a virtual environment

      We install the Python library numpy in the virtual environment test-env. Since communication to the outside world is not possible from a compute node, please make sure to do this on the login node.

      conda install numpy

       

    Disable the virtual environment

      Disable the virtual environment test-env.

      conda deactivate

       

    Example: How to Use Pytorch with Miniforge

      Create and activate the virtual environment pytorch-env.

      conda create --name pytorch-env python=3.12
      conda activate pytorch-env

      Refer to the official Pytorch page to install Pytorch using the Conda Package compatible with CUDA 11 series.

      As of August 2024, the command is as follows:

      conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

    How to use in SQUID calculation node

    Please make the following job script when you enable the virtual environment "test-env" and execute test.py.