To create a Python environment

Synopsis

conda create -n geo_env
conda activate geo_env

To install new Python packages

Assumes you are in an environment.

Synopsis

This example uses Geopandas. Note that this is already installled in the shared packages directory.

conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda install python=3 geopandas

To turn your environment into Jupyter kernel

Synopsis

Be sure to replaace your_env with your actual environment name. Now, when you start Jupyter Lab you will see your environment as a kernel option (not from FastX, but from the first screen when you go to the Ivy link above).

conda activate your_env
conda install -c conda-forge ipykernel
python -m ipykernel install --user --name=your_env

Setting up Conda

THIS IS NO LONGER NECESSARY! We have enough space in our home directories.

Because there is not enough space in our home directories on Ivy, we need to tell conda (Anaconda's Python package manager) to use directories in our allocated directory, which is located at /data/galen-ics363/ivy-hip-cfd. Here are the steps to follow.

For convenience, here is the URL to our Ivy machine: https://10.254.8.212/

Synopsis

cd
conda init
source .bashrc
mv .condarc .condarc_old
conda config
conda config --add pkgs_dirs /data/galen-ics363/ivy-hip-cfd/.conda-stuff/shared/pkgs
conda config --add envs_dirs /data/galen-ics363/ivy-hip-cfd/.conda-stuff/$USER/envs
conda info

Step-by-Step

  1. Do everything from your home directory.
    1. Run: cd
  2. If you have not done so already, initialize conda.
    1. Run: conda init
    2. Run: source .bashrc
  3. If you already have a .condarc file, rename it or delete it.
    1. To rename, run: mv .condarc .condarc_old
    2. To delete, run: rm .condarc
    3. If you don't know, run either command; a benign error will be thrown if you don't have one.
  4. Create a new .condarc file.
    1. Run: conda config
  5. Add the new locations for conda to use.
    1. Run: conda config --add pkgs_dirs /data/galen-ics363/ivy-hip-cfd/.conda-stuff/shared/pkgs/
      1. Note that this is a shared directory–this means if someone installed something, we all can use it.
    2. Run: conda config --add envs_dirs /data/galen-ics363/ivy-hip-cfd/.conda-stuff/$USER/envs/
      1. This directory is for your environments; they won't be shared.
  6. Confirm that things are as they should be.
    1. Run: conda info

Plan B

  1. If we run into problems with the shared package directory, follow steps 3 to 6 above, but skip 5.a and replace 5.b with:
    1. conda config --add pkgs_dirs /data/galen-ics363/ivy-hip-cfd/.conda-stuff/$USER/pkgs/







  • No labels