Conda/mamba

Installing miniconda or miniforge

mkdir -p src local/bin

cd src

wget https://repo.continuum.io/miniconda/Miniconda3-latest-[Linux/MacOSX]-x86_64.sh

bash Miniconda3-latest-[Linux/MacOSX]-x86_64.sh


wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh

wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh

bash Miniforge3-MacOSX-x86_64.sh

activate conda

eval "$(/miniconda3/bin/conda shell.bash hook)"

eval "$(/root/miniconda3/bin/conda shell.bash hook)"

Update conda

conda update conda

conda update anaconda

conda update --all

conda list 

conda info

Setup environment using conda

conda info --envs

mamba create -n test_env python=3.10 --y

mamba create -n test_env ipykernel xarray --y

conda env create -f env.yaml

mamba env create -f environment.yml


conda activate test_env # >C:\Users\XXXXXX\AppData\Local\Continuum\anaconda3\Scripts\activate test_env

mamba install -c conda-forge jupyter pandas scipy

conda install PACKAGE.tar.gz


conda create -n test_env -c conda-forge --file requirements.txt

pip install -r requirements.txt


conda env export > environment.yml

open source env.yaml:

name: main

channels:

  - nodefaults

  - conda-forge

dependencies:

  - python=3.9

  - numpy

artifactory env.yml

name: main

channels:

  - https://dtn.jfrog.io/artifactory/api/conda/conda/dtn

  - https://dtn.jfrog.io/artifactory/api/conda/conda

  - nodefaults

dependencies:

  - python=3.10 





conda activate environment ?

mamba env update -f environment.yml 


conda remove --name test_env --all --y

conda clean --all

mamba clean --all

conda clean --packages --tarballs

conda-recipe/conda_build_config.yaml

numpy:

  - 1.23.4

Installing and removing using conda

$ conda install scipy curl

$ conda update scipy curl

$ conda remove scipy curl


Testing

conda create -n _ python=3.8 PACKAGE -c conda-forge --dry-run

CONDA_SUBDIR=win-64 mamba create -n _ python=3.8 PACKAGE -c conda-forge --dry-run

CONDA_SUBDIR=win-64 mamba repoquery depends PACKAGE -c conda-forge

CONDA_SUBDIR=win-64 mamba repoquery whoneeds PACKAGE -c conda-forge

mamba repoquery search "pandas<=1.2.5"

See dependencies

conda activate main

mamba repoquery whoneeds pandas -c conda-forge

See underlying code that is installed

import PACKAGE PACKAGE.__file__

cd /Users/ray/miniforge3/envs/ENV/lib/python3.10/site-packages/PACKAGE/

Update a conda-forge package

Find the feedstock for the recipe and clone it.

https://github.com/conda-forge/PACKAGENAME-feedstock

In recipe/meta.yaml increase the version number and update the sha256 (vi - daw) by going to pypi -> Download files -> Click on view hashes next to the .tar.gz file and copy the sha256


May also need to re-render the feedstock (https://conda-forge.org/docs/maintainer/updating_pkgs.html#rerendering-feedstocks)

$ conda install -c conda-forge conda-smithy

$ conda smithy rerender -c auto

Upload a package to conda forge

Fork https://github.com/conda-forge/staged-recipes

git clone staged-recipes # from your directory

$ git checkout -b shiny-new-feature

.condarc

envs_dirs:

  - /home/${USER}/.conda/envs

pkgs_dirs:

  - /home/${USER}/.conda/pkgs

channel_priority: flexible